Skip to main content

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 virtualenv state to invoke relenv.create under the hood
    • Purge entire relenv directories

Requirements

  • SaltStack ≥ 3000
  • Python 3.10+
  • The relenv Python package available on master and minions

Installation

  1. Clone this repository onto your Salt master (or distribute to minions):

    .. code-block:: bash

    salt * pip.install salt-ext-relenv

  2. Sync your custom modules and states:

    .. code-block:: bash

    salt '' saltutil.sync_modules salt '' saltutil.sync_states

  3. 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

  1. Install dev dependencies:

    .. code-block:: bash

    pip install -r requirements/tests.txt

  2. Test:

    .. code-block:: bash

    pytest

  3. Lint:

    .. code-block:: bash

    flake8 mypy

Contributing

  1. Fork the repository and create a feature branch.
  2. Write tests under tests/ for new behavior.
  3. Submit a Pull Request against main, referencing any related issues.

License

Apache License 2.0 – see the bundled LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

saltext_relenv-0.1.3-py2.py3-none-any.whl (7.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file saltext_relenv-0.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for saltext_relenv-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6c1c7d1f20e21378c04acb36fe71f51522e8b9dfe82a65d0d80f992bcfe5954c
MD5 4fd806a96d743888f6eb20dc333a434d
BLAKE2b-256 7a9a405e234cb720c01c213773b68af5f7fa4bf5eff019f894c3f7f50b1ff305

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page