Skip to main content

A Python library for managing user-installed package lists.

Project description

UserEnv: User Installed Modules Manager

Do you work on a system where python environments are pre-configured, and your only way to add custom modules is using pip install --user ? UserEnv allows you to keep multiple sets of user packages in a single python environment, as user environments.

A Concrete Example

Let's say you need to use both NumPy-1 and NumPy-2 in the same environment. First, create a userenv for NumPy-1:

$ userenv create numpy1 && userenv activate numpy1
User environment 'numpy1' created at /home/adorni/.userenv/envs/numpy1.
User environment 'numpy1' activated.

$ pip install --user numpy==1.26.4
...
Successfully installed numpy-1.26.4

Then, create a userenv for NumPy 2:

$ userenv create numpy2 && userenv activate numpy2
User environment 'numpy2' created at /home/adorni/.userenv/envs/numpy2.
User environment 'numpy2' activated.

$ pip install --user numpy==2.4.4
...
Successfully installed numpy-2.4.4

Et voilà ! You can now use both versions of numpy the same way you would use a normal venv:

$ userenv activate numpy1 && python -c "import numpy; print(numpy.__version__)"
User environment 'numpy1' activated.
1.26.4

$ userenv activate numpy2 && python -c "import numpy; print(numpy.__version__)"
User environment 'numpy2' activated.
2.4.4

Installation

Install the latest development version directly from the github repo:

git clone git@github.com:pierreadorni/userenv.git
cd userenv
pip install .

Configure the environment variables in your shell configuration file (e.g., .bashrc, .zshrc)

export USERENV_DIR="$HOME/.userenv" # default value, adapt to your needs
export PYTHONUSERBASE="$USERENV_DIR"
export PATH="$PATH:$USERENV_DIR/bin"

then reload your config

source ~/.bashrc # example for .bashrc

You're good to go !

userenv --help
                                                                                                    
 Usage: userenv [OPTIONS] COMMAND [ARGS]...                                                         
                                                                                                    
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.                          │
│ --show-completion             Show completion for the current shell, to copy it or customize the │
│                               installation.                                                      │
│ --help                        Show this message and exit.                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────╮
│ list                                                                                             │
│ create                                                                                           │
│ activate                                                                                         │
│ active                                                                                           │
│ deactivate                                                                                       │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

Contributing

Feel free to submit pull requests and file bugs in the issue tracker.

Project details


Download files

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

Source Distribution

pyuserenv-1.0.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

pyuserenv-1.0.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pyuserenv-1.0.1.tar.gz.

File metadata

  • Download URL: pyuserenv-1.0.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyuserenv-1.0.1.tar.gz
Algorithm Hash digest
SHA256 dc1697515bfc8c223989ed5ec12083a1a2c2da6954d5ec0ff6fcc2708b71e71f
MD5 e4e5ba97b19591940703673c12422101
BLAKE2b-256 e433be5ba70a60c19a815c036ccd20b4bc19f47c646d3d246e549799f1542d89

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyuserenv-1.0.1.tar.gz:

Publisher: python-publish.yml on pierreadorni/userenv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyuserenv-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyuserenv-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyuserenv-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3324696d5a5363482447447d5f5355c68f2421002441d5debb78a532af1142c7
MD5 e44a3a422c3ba208cd18d9c27767cd8d
BLAKE2b-256 71a2e444485af17532431c9eeaa46b5b0ec9814a42adc30260e68a226bc9ab9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyuserenv-1.0.1-py3-none-any.whl:

Publisher: python-publish.yml on pierreadorni/userenv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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