Skip to main content

A minimal re-implementation of Python's venv module plus utilities

Project description

microvenv

Create a minimal virtual environment (and utility code around environments).

The key purpose of this module is for when the venv module has been removed from the standard library by your Python distribution. Because venv is not available on PyPI and is developed in the stdlib, it is not possible to install it using pip or simply copy the code and expect it to work with older versions of Python. This module then attempts to be that portable alternative for creating virtual environments.

In general, though, using the venv module should be preferred and this module used as a fallback.

There is also utility code around virtual environments. See the docs for details.

CLI Usage

NOTE: The CLI is not available on Windows.

python microvenv.py [--without-scm-ignore-files] [env_dir=".venv"]

If an argument is provided to the script, it is used as the path to create the virtual environment in. Otherwise, the virtual environment is created in .venv.

For programmatic usage, there is the create() function, which is analogous to the venv.create() function.

def create(env_dir: os.PathLike[str] | str = ".venv", *, scm_ignore_files={"git"}) -> None

The microvenv/_create.py file is also small enough to have its contents passed in via the -c flag to python.

Differences compared to the venv module

The code operates similarly to py -m venv --symlinks --without-pip .venv, except that:

  • There are no activation scripts (you can execute python in the virtual environment directly)
  • Windows is not supported

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

microvenv-2023.4.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

microvenv-2023.4-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file microvenv-2023.4.tar.gz.

File metadata

  • Download URL: microvenv-2023.4.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for microvenv-2023.4.tar.gz
Algorithm Hash digest
SHA256 0f8539efcd22a4ca81f2c14754c3fba8346dcaf02477036f3b35e6574b79bc1f
MD5 9d94d320cce251d4e9100d5b703ddb0e
BLAKE2b-256 0adeb1361dcf66f2565387994d7bf4a7739eafe03b65e12d06a20060e86c5842

See more details on using hashes here.

Provenance

File details

Details for the file microvenv-2023.4-py3-none-any.whl.

File metadata

  • Download URL: microvenv-2023.4-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for microvenv-2023.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d0a70db035c9c2cde0b76d65a5b9eb02ff47956eba234a48e43560710c46e5e5
MD5 df12358f5feb630801cb99451dd03c30
BLAKE2b-256 10c5d5e62b8ccbb2e81d52e1ee521894b877826eb1b01ef024144504a93535a3

See more details on using hashes here.

Provenance

Supported by

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