Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit 33e650d

Browse files
authored
Merge pull request ebezzam#5 from ebezzam/remote_dev
Add doc on remote development.
2 parents 7fe5538 + 211d00e commit 33e650d

5 files changed

Lines changed: 40 additions & 2 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
project_env/
2+
.DS_Store
23

34
# Byte-compiled / optimized / DLL files
45
__pycache__/
163 KB
Loading

‎docs/source/documentation.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Here are some recommended steps to get started with Sphinx:
6161
(docs_env) pip install -r requirements.txt
6262
6363
#. Inside your virtual environment, run ``sphinx-quickstart`` to creates a lot of the boilerplate configurations. This will guide you through a set of questions, such as your project details. We recommend creating separate ``source`` and ``build`` directories.
64-
#. Build the documentation, e.g. with ``make html``.
64+
#. Build the documentation, e.g. with ``make html`` (from inside the ``docs`` folder).
6565
#. Open ``docs/build/html/index.html`` in a browser to see your initial documentation!
6666

6767
Editing your documentation
@@ -89,7 +89,7 @@ Adding new pages to your documentation amount to:
8989

9090
#. Creating new RST files.
9191
#. Including them in your ``index.rst`` file.
92-
#. Rebuilding the documentation, e.g. with ``make html``.
92+
#. Rebuilding the documentation, e.g. with ``make html`` (from inside the ``docs`` folder).
9393

9494
You may also need to edit the ``conf.py`` file to use different features.
9595
Check out our `index.rst <https://raw.githubusercontent.com/ebezzam/python-dev-tips/main/docs/source/index.rst>`__

‎docs/source/index.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Contents
1515

1616
.. toctree::
1717

18+
remote_development
1819
documentation
1920
badges
2021

‎docs/source/remote_development.rst‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Remote Development
2+
==================
3+
4+
In machine learning and scientific computing applications, you may find yourself in a situation where you need to develop and deploy code on a remote machine.
5+
This may limit your ability to visualize results as your interaction with the remote machine is typically limited to the command line.
6+
One way to get around this is to use a interactive development environment (IDE) that allows you to run code on a remote machine.
7+
With Visual Studio (VS) Code, you can use the `Remote - SSH <https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh>`__ extension to connect to a remote machine and develop code on it.
8+
9+
`This page <https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh>`__ gives you pretty much everything you need to setup remote development with VS Code, most notably `connecting to a remote host <https://code.visualstudio.com/docs/remote/ssh#_connect-to-a-remote-host>`__.
10+
11+
12+
Using Jupyter notebooks to visualize plots
13+
------------------------------------------
14+
15+
Running Jupyter notebooks on a remote machine through VS Code allows you to conveniently visualize results.
16+
17+
First, be sure to install the ``ipykernel`` package in your virtual environment (on the remote machine).
18+
19+
.. code-block:: bash
20+
21+
pip install ipykernel
22+
23+
When opening your notebook, select your virtual environment.
24+
25+
.. image:: ../images/vscode_jupyter_notebook.png
26+
27+
28+
Running long scripts
29+
--------------------
30+
31+
When you close an SSH connection, the process running on the remote machine is killed.
32+
If you would like to run a long script on a remote machine, there are several command line tools that let you run a script even after logging out:
33+
34+
* `screen <https://linuxize.com/post/how-to-use-linux-screen/>`__ (Linux or `WSL <https://learn.microsoft.com/en-us/windows/wsl/install>`__ for Windows).
35+
* `tmux <https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/>`__ (Linux, WSL, and macOS).
36+
* `nohup <https://www.geeksforgeeks.org/nohup-command-in-linux-with-examples/>`__ (Linux or WSL).

0 commit comments

Comments
 (0)