Salt Extension for interacting with Relenv
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file saltext_relenv-0.1.3-py2.py3-none-any.whl.
File metadata
- Download URL: saltext_relenv-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c1c7d1f20e21378c04acb36fe71f51522e8b9dfe82a65d0d80f992bcfe5954c
|
|
| MD5 |
4fd806a96d743888f6eb20dc333a434d
|
|
| BLAKE2b-256 |
7a9a405e234cb720c01c213773b68af5f7fa4bf5eff019f894c3f7f50b1ff305
|