From 7fc452ec1b4292c9c46d513f2bec3879b3b74138 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Sep 2024 03:19:14 +0000 Subject: [PATCH 1/4] Bump minima from 2.5.1 to 2.5.2 Bumps [minima](https://github.com/jekyll/minima) from 2.5.1 to 2.5.2. - [Release notes](https://github.com/jekyll/minima/releases) - [Changelog](https://github.com/jekyll/minima/blob/master/History.markdown) - [Commits](https://github.com/jekyll/minima/compare/v2.5.1...v2.5.2) --- updated-dependencies: - dependency-name: minima dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 2e857da08a..2b5e87b73a 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ source "https://rubygems.org" gem "jekyll", "~> 4.3.4" # This is the default theme for new Jekyll sites. You may change this to anything you like. -gem "minima", "~> 2.0" +gem "minima", "~> 2.5" # If you want to use GitHub Pages, remove the "gem "jekyll"" above and # uncomment the line below. To upgrade, run `bundle update github-pages`. diff --git a/Gemfile.lock b/Gemfile.lock index 69bc05585d..3406c6a9f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,7 +44,7 @@ GEM jekyll (>= 3.7, < 5.0) jekyll-sass-converter (3.0.0) sass-embedded (~> 1.54) - jekyll-seo-tag (2.7.1) + jekyll-seo-tag (2.8.0) jekyll (>= 3.8, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) @@ -58,7 +58,7 @@ GEM rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) mini_portile2 (2.8.7) - minima (2.5.1) + minima (2.5.2) jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) @@ -74,7 +74,7 @@ GEM rb-inotify (0.11.1) ffi (~> 1.0) rexml (3.3.7) - rouge (4.3.0) + rouge (4.4.0) safe_yaml (1.0.5) sass-embedded (1.78.0) google-protobuf (~> 4.27) @@ -104,7 +104,7 @@ DEPENDENCIES jekyll (~> 4.3.4) jekyll-asciidoc jekyll-feed (~> 0.17) - minima (~> 2.0) + minima (~> 2.5) nokogiri (~> 1.16) slim (~> 5.2.1) thread_safe (~> 0.3.5) From 1c22aac30979c1cffe99269e38d2c8f29c0addde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Sep 2024 03:19:14 +0000 Subject: [PATCH 2/4] Bump tzinfo-data from 1.2024.1 to 1.2024.2 Bumps [tzinfo-data](https://github.com/tzinfo/tzinfo-data) from 1.2024.1 to 1.2024.2. - [Release notes](https://github.com/tzinfo/tzinfo-data/releases) - [Commits](https://github.com/tzinfo/tzinfo-data/compare/v1.2024.1...v1.2024.2) --- updated-dependencies: - dependency-name: tzinfo-data dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 69bc05585d..3c0d9454d1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,7 +89,7 @@ GEM tilt (2.3.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - tzinfo-data (1.2024.1) + tzinfo-data (1.2024.2) tzinfo (>= 1.0.0) unicode-display_width (2.6.0) wdm (0.2.0) From da7c1fb91a52eec9ab83161fea91934d20550c29 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 00:19:27 +0000 Subject: [PATCH 3/4] Bump asciidoctor from 2.0.20 to 2.0.23 Bumps [asciidoctor](https://github.com/asciidoctor/asciidoctor) from 2.0.20 to 2.0.23. - [Release notes](https://github.com/asciidoctor/asciidoctor/releases) - [Changelog](https://github.com/asciidoctor/asciidoctor/blob/main/CHANGELOG.adoc) - [Commits](https://github.com/asciidoctor/asciidoctor/compare/v2.0.20...v2.0.23) --- updated-dependencies: - dependency-name: asciidoctor dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 69bc05585d..0cca7a4880 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) - asciidoctor (2.0.20) + asciidoctor (2.0.23) asciidoctor-tabs (1.0.0.beta.6) asciidoctor (>= 2.0.0, < 3.0.0) bigdecimal (3.1.8) From 96996d617af9301ea59e9b5655ce68b26df10866 Mon Sep 17 00:00:00 2001 From: Nate Contino Date: Wed, 18 Sep 2024 11:39:07 -0400 Subject: [PATCH 4/4] Use tabs for virtualenv options --- .../asciidoc/computers/os/using-python.adoc | 141 ++++++++++-------- .../asciidoc/computers/remote-access/ssh.adoc | 2 +- 2 files changed, 76 insertions(+), 67 deletions(-) diff --git a/documentation/asciidoc/computers/os/using-python.adoc b/documentation/asciidoc/computers/os/using-python.adoc index 687960b3b6..38dd9e20e3 100644 --- a/documentation/asciidoc/computers/os/using-python.adoc +++ b/documentation/asciidoc/computers/os/using-python.adoc @@ -59,117 +59,126 @@ Python users have long dealt with conflicts between OS package managers like `ap Starting in Raspberry Pi OS _Bookworm_, packages installed via `pip` _must be installed into a Python virtual environment_ (``venv``). A virtual environment is a container where you can safely install third-party modules so they won't interfere with your system Python. -==== Use pip with virtual environments +==== Use `pip` with virtual environments -To use a virtual environment, create a container to store the environment. There are several ways you can do this depending on how you want to work with Python. - -Run the following command to create a virtual environment configuration folder, replacing `` with the name you would like to use for the virtual environment (e.g. `env`): +To use a virtual environment, create a container to store the environment. There are several ways you can do this depending on how you want to work with Python: +[tabs] +====== +per-project environments:: ++ +Many users create separate virtual environments for each Python project. Locate the virtual environment in the root folder of each project, typically with a shared name like `env`. Run the following command from the root folder of each project to create a virtual environment configuration folder: ++ [source,console] ---- -$ python -m venv +$ python -m venv env ---- - -TIP: Pass the `--system-site-packages` flag before the folder name to preload all of the currently installed packages in your system Python installation into the virtual environment. - -Then, execute the `bin/activate` script in the virtual environment configuration folder to enter the virtual environment: - ++ +Before you work on a project, run the following command from the root of the project to start using the virtual environment: ++ [source,console] ---- -$ source /bin/activate +$ source env/bin/activate ---- - ++ You should then see a prompt similar to the following: - -[source,console?prompt=() $] ----- -() $ ----- - -The `()` command prompt prefix indicates that the current terminal session is in a virtual environment named ``. - -To check that you're in a virtual environment, use `pip list` to view the list of installed packages: - -[source,console?prompt=() $] ++ +[source,console?prompt=(env) $] ---- -() $ pip list -Package Version ----------- ------- -pip 23.0.1 -setuptools 66.1.1 +(env) $ ---- - -The list should be much shorter than the list of packages installed in your system Python. You can now safely install packages with `pip`. Any packages you install with `pip` while in a virtual environment only install to that virtual environment. In a virtual environment, the `python` or `python3` commands automatically use the virtual environment's version of Python and installed packages instead of the system Python. - -To leave a virtual environment, run the following command: - -[source,console?prompt=() $] ++ +When you finish working on a project, run the following command from any directory to leave the virtual environment: ++ +[source,console?prompt=(env) $] ---- -() $ deactivate +(env) $ deactivate ---- -==== Use a separate environment for each project - -Many users create separate virtual environments for each Python project. Locate the virtual environment in the root folder of each project, typically with a shared name like `env`. Run the following command from the root folder of each project to create a virtual environment configuration folder: - +per-user environments:: ++ +Instead of creating a virtual environment for each of your Python projects, you can create a single virtual environment for your user account. **Activate that virtual environment before running any of your Python code.** This approach can be more convenient for workflows that share many libraries across projects. ++ +When creating a virtual environment for multiple projects across an entire user account, consider locating the virtual environment configuration files in your home directory. Store your configuration in a https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory#Unix_and_Unix-like_environments[folder whose name begins with a period] to hide the folder by default, preventing it from cluttering your home folder. ++ +Use the following command to create a virtual environment in a hidden folder in the current user's home directory: ++ [source,console] ---- -$ python -m venv env +$ python -m venv ~/.env ---- - -Before you work on a project, run the following command from the root of the project to start using the virtual environment: - ++ +Run the following command from any directory to start using the virtual environment: ++ [source,console] ---- -$ source env/bin/activate +$ source ~/.env/bin/activate ---- - ++ You should then see a prompt similar to the following: - -[source,console?prompt=(env) $] ++ +[source,console?prompt=(.env) $] ---- -(env) $ +(.env) $ +---- ++ +To leave the virtual environment, run the following command from any directory: ++ +[source,console?prompt=(.env) $] +---- +(.env) $ deactivate ---- +====== -When you finish working on a project, run the following command from any directory to leave the virtual environment: +===== Create a virtual environment -[source,console?prompt=(env) $] +Run the following command to create a virtual environment configuration folder, replacing `` with the name you would like to use for the virtual environment (e.g. `env`): + +[source,console] ---- -(env) $ deactivate +$ python -m venv ---- -==== Use a separate environment for each user - -Instead of creating a virtual environment for each of your Python projects, you can create a single virtual environment for your user account. **Activate that virtual environment before running any of your Python code.** This approach can be more convenient for workflows that share many libraries across projects. +TIP: Pass the `--system-site-packages` flag before the folder name to preload all of the currently installed packages in your system Python installation into the virtual environment. -When creating a virtual environment for multiple projects across an entire user account, consider locating the virtual environment configuration files in your home directory. Store your configuration in a https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory#Unix_and_Unix-like_environments[folder whose name begins with a period] to hide the folder by default, preventing it from cluttering your home folder. +===== Enter a virtual environment -Use the following command to create a virtual environment in a hidden folder in the current user's home directory: +Then, execute the `bin/activate` script in the virtual environment configuration folder to enter the virtual environment: [source,console] ---- -$ python -m venv ~/.env +$ source /bin/activate ---- -Run the following command from any directory to start using the virtual environment: +You should then see a prompt similar to the following: -[source,console] +[source,console?prompt=() $] ---- -$ source ~/.env/bin/activate +() $ ---- -You should then see a prompt similar to the following: +The `()` command prompt prefix indicates that the current terminal session is in a virtual environment named ``. -[source,console?prompt=(.env) $] +To check that you're in a virtual environment, use `pip list` to view the list of installed packages: + +[source,console?prompt=() $] ---- -(.env) $ +() $ pip list +Package Version +---------- ------- +pip 23.0.1 +setuptools 66.1.1 ---- -To leave the virtual environment, run the following command from any directory: +The list should be much shorter than the list of packages installed in your system Python. You can now safely install packages with `pip`. Any packages you install with `pip` while in a virtual environment only install to that virtual environment. In a virtual environment, the `python` or `python3` commands automatically use the virtual environment's version of Python and installed packages instead of the system Python. -[source,console?prompt=(.env) $] +===== Exit a virtual environment + +To leave a virtual environment, run the following command: + +[source,console?prompt=() $] ---- -(.env) $ deactivate +() $ deactivate ---- === Use the Thonny editor diff --git a/documentation/asciidoc/computers/remote-access/ssh.adoc b/documentation/asciidoc/computers/remote-access/ssh.adoc index acdec020dc..aaa58862aa 100644 --- a/documentation/asciidoc/computers/remote-access/ssh.adoc +++ b/documentation/asciidoc/computers/remote-access/ssh.adoc @@ -65,7 +65,7 @@ Enter your account password when prompted. You should now see the Raspberry Pi command prompt: -[source,console] +[source,console?prompt=@ ~ $] ---- @ ~ $ ----