Metadata-Version: 2.1
Name: venv-modulefile
Version: 0.1.2
Summary: Python venv extension using Modulefile
Home-page: https://github.com/roland-lenain/venv-modulefile
Author: R. Lenain
Author-email: roland.lenain@cea.fr
License: UNKNOWN
Project-URL: Bug Reports, https://github.com/roland-lenain/venv-modulefile/issues
Project-URL: Doc, https://venv-modulefile.readthedocs.io/en/latest/index.html
Project-URL: Source, https://github.com/roland-lenain/venv-modulefile
Keywords: venv,modulefile
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.6, <4
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: packaging
Requires-Dist: requests
Requires-Dist: shellingham
Provides-Extra: docs
Requires-Dist: psutil (==5.9.4) ; extra == 'docs'
Requires-Dist: sphinx-rtd-theme (==1.1.1) ; extra == 'docs'
Requires-Dist: myst-parser (==0.16.1) ; extra == 'docs'
Requires-Dist: numpydoc (==1.1.0) ; extra == 'docs'
Provides-Extra: test
Requires-Dist: psutil (==5.9.4) ; extra == 'test'
Requires-Dist: pylint (>=2.13.9) ; extra == 'test'
Requires-Dist: pytest (>=7.0.1) ; extra == 'test'
Requires-Dist: pytest-cov (>=4.0.0) ; extra == 'test'
Requires-Dist: pytest-html (>=3.2.0) ; extra == 'test'
Requires-Dist: pytest-sugar (>=0.9.6) ; extra == 'test'
Requires-Dist: pytest-xdist (>=3.0.2) ; extra == 'test'

# venv-modulefile

[<img src="https://www.python.org/static/community_logos/python-logo-master-v3-TM.png" height="30"/>](Python)
[<img src="https://raw.githubusercontent.com/cea-hpc/modules/v5.2.0/doc/img/modules_red.svg" height="30" style="background-color: white"/>](Environment_Module)

- [venv-modulefile](#venv-modulefile)
  - [Description](#description)
  - [Quick start](#quick-start)
  - [Available commands](#available-commands)

## Description

Tool to create Python complient environment from non-pythonic tools in a Python virtual
environment.

It is based on [Environment Module](https://modules.readthedocs.io/en/latest/) to
modify the virtual environment.

The package offers several commands to build environment modules activated by the virtual
environnment

## Quick start

The following example adds `foo/bar/baz` to `LD_LIBRARY_PATH` when the environment is loaded

```bash

venvmod-initialize ${VIRTUAL_ENV}
venvmod-prepend-path ${VIRTUAL_ENV} LD_LIBRARY_PATH foo/bar/baz

```

## Available commands

The list of available commands is the following:

- `venvmod-initialize` is the first command to call. It is expected before everithing as it upgrades
  the virtual environment with modulefile.

- The following commands modify the modulefile of the virtual environment:
  - `venvmod-cmd-append-path` / `venvmod-cmd-prepend-path`: modifies an environment variable
  - `venvmod-cmd-module-load`: loads a modulefile
  - `venvmod-cmd-module-use`: adds a search path for modulefile
  - `venvmod-cmd-remove-path`: removes path from environment variable
  - `venvmod-cmd-setenv`: defines an environment variable
  - `venvmod-cmd-set-alias`: defines an alias
  - `venvmod-cmd-source-sh`: sources a script

- `venvmod-cmd-read-env`: reads modifications to do from environment variable:
  - `[NAME]_LD_LIBRARY_PATH`, `[NAME]_PYTHONPATH`, `[NAME]_PATH`: ``prepend`` for each element separated by ':'
  - `[NAME]_MODULE_USE`: ``module use`` for each element 'module' separated by ' '
  - `[NAME]_MODULEFILES`: ``module load`` for each element '/path/' separated by ' '
  - `[NAME]_SOURCEFILES`: ``source-sh`` for each element 'shell script [args...]' separated by ';'
  - `[NAME]_EXPORTS`: ``setenv`` for each element 'var=value' separated by ' '
  - `[NAME]_ALIASES`: ``set-alias`` for each element 'var="value"' separated by ' '
  - `[NAME]_REMOVE_PATHS`: ``remove-path`` for each element 'var=value' separated by ' '
  where `[NAME]` is the name of the environment module (case insensitive, "-" and "." are replaced by "_").

- `venvmod-add-appli` allows to create sub modulefile. `--appli` option of the above commands
  permit to modify these modulefiles.

- `venvmod-test-import`: tests the import of modules given as argument

See `--help` option for cli description of each command.

The sequence to modify the environment respects the sequence of call of the different functions.


