salt-ext-relenv
A Salt extension for managing relocatable Python environments via relenv.
Provides both an execution module (relenv.*) and a state module (relenv.*) that wrap native pip and virtualenv functionality to create, update, and remove “relenv” environments.
Features
- Execution module (
relenv.fetch,relenv.toolchain,relenv.create)- Fetch relenv build tools and C toolchains
- Create a fully relocatable Python virtual environment
- Optional cross‐architecture and Python‐version parameters
- State module (
relenv.installed,relenv.removed,relenv.uptodate,relenv.managed,relenv.absent)- Install or remove packages inside a relenv
- Ensure a relenv is up to date
- Wraps Salt’s
virtualenvstate to invokerelenv.createunder the hood - Purge entire relenv directories
Requirements
- SaltStack ≥ 3000
- Python 3.10+
- The
relenvPython package available on master and minions
Installation
-
Clone this repository onto your Salt master (or distribute to minions):
.. code-block:: bash
salt * pip.install salt-ext-relenv
-
Sync your custom modules and states:
.. code-block:: bash
salt '' saltutil.sync_modules salt '' saltutil.sync_states
-
Verify the relenv modules are available:
.. code-block:: bash
salt '' sys.list_modules | grep relenv salt '' sys.list_states | grep relenv
Execution Module Usage
Fetch build tools (downloads relenv wheel and helpers):
.. code-block:: bash
salt '*' relenv.fetch arch=amd64 python=3.10.17
Fetch C toolchain (for building C extensions):
.. code-block:: bash
salt '*' relenv.toolchain arch=amd64 clean=True crosstool_only=True
Create a relenv (must run fetch & toolchain first; ownership optional):
.. code-block:: bash
salt '*' relenv.create /opt/my_relenv arch=amd64 python=3.10.17 user=deploy
State Module Usage
Manage a relenv directory (wraps virtualenv.managed to use relenv.create):
.. code-block:: yaml
create_myenv: relenv.managed: - name: /opt/my_relenv - arch: amd64 - python: 3.10.17 - user: deploy
Install a package into an existing relenv:
.. code-block:: yaml
install_requests: relenv.installed: - name: requests - relenv: /opt/my_relenv - require: - relenv: create_myenv
Remove a package from a relenv:
.. code-block:: yaml
remove_requests: relenv.removed: - name: requests - relenv: /opt/my_relenv
Ensure relenv is up to date (upgrade pip & dependencies):
.. code-block:: yaml
update_relenv: relenv.uptodate: - name: /opt/my_relenv
Remove a relenv entirely:
.. code-block:: yaml
delete_myenv: relenv.absent: - name: /opt/my_relenv
Development
-
Install dev dependencies:
.. code-block:: bash
pip install -r requirements/tests.txt
-
Test:
.. code-block:: bash
pytest
-
Lint:
.. code-block:: bash
flake8 mypy
Contributing
- Fork the repository and create a feature branch.
- Write tests under
tests/for new behavior. - Submit a Pull Request against
main, referencing any related issues.
License
Apache License 2.0 – see the bundled LICENSE file for details.
Metadata
Release files for saltext.relenv 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| saltext_relenv-0.1.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Release files / saltext_relenv-0.1.3-py2.py3-none-any.whl
| Download URL | saltext_relenv-0.1.3-py2.py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6c1c7d1f20e21378c04acb36fe71f51522e8b9dfe82a65d0d80f992bcfe5954c
|
|
BLAKE2b-256 checksum How to use checksums |
7a9a405e234cb720c01c213773b68af5f7fa4bf5eff019f894c3f7f50b1ff305
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|