Improve the developer bootstrap docs

This commit is contained in:
jonct 2024-07-15 19:48:29 -04:00
parent c41ac9cd83
commit a3854531da
1 changed files with 10 additions and 13 deletions

View File

@ -214,20 +214,17 @@ The rootfs image `jlmkr.py` downloads comes from the [Linux Containers Image ser
## Development ## Development
After cloning the project, navigate into its working directory and create a self-contained Python [virtual environment](https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-and-using-virtual-environments). After cloning the project, navigate into its working directory and create a self-contained Python [virtual environment](https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-and-using-virtual-environments). Traditionally you would do that using the following command. Unfortunately, TrueNAS SCALE has [left out](https://ixsystems.atlassian.net/browse/NAS-130029) a necessary library from the base installation and *this command will fail:*
python3 -m venv --no-setuptools .venv python3 -m venv .venv
> *Note: Due to [NAS-130029](https://ixsystems.atlassian.net/browse/NAS-130029), the user's safe working Python environment can only be bootstrapped from TrueNAS SCALE's [developer mode](https://www.truenas.com/docs/scale/scaletutorials/systemsettings/advanced/developermode/), or in a jail or elsewhere. If you like to take long walks with strangers, the following might suffice as an alternative to the above one-liner.* The following workaround should accomplish the same task in more steps.
> ```
> ``` python3 -m venv --without-pip .venv
> curl -L https://github.com/brettcannon/microvenv/archive/refs/tags/v2023.5.tar.gz | tar xz --strip-components=1 microvenv-2023.5/microvenv curl -OL https://bootstrap.pypa.io/pip/pip.pyz
> python3 -m microvenv .venv/bin/python3 pip.pyz install pip
> curl -OL https://bootstrap.pypa.io/pip/pip.pyz rm pip.pyz
> .venv/bin/python3 pip.pyz install virtualenv ```
> .venv/bin/virtualenv --no-setuptools .venv
> rm -rf microvenv pip.pyz
> ```
*Note: This process and the resulting build environment will cache some items under `~/.local/share` in addition to the project directory.* *Note: This process and the resulting build environment will cache some items under `~/.local/share` in addition to the project directory.*
Activate the venv into your *current* shell session. Activate the venv into your *current* shell session.
@ -242,7 +239,7 @@ For more information on Python standard venvs, go to [the source](https://packag
### Hatching a build ### Hatching a build
While in an *active* session, install the [Hatch](https://hatch.pypa.io) project manager. This will load quite a flurry of dependencies, but will only do so into the new `.venv` directory. While in an *active* session, install the [Hatch](https://hatch.pypa.io) project manager. This will load quite a flurry of dependencies, but will only do so into the new `.venv` directory. *(And a bit into self-managed directories under `~/.local/share`.)*
pip install hatch pip install hatch