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 -m microvenv [--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-2025.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

microvenv-2025.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: microvenv-2025.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for microvenv-2025.0.tar.gz
Algorithm Hash digest
SHA256 8a2568a8390a4ffb5af2f05e7642454e03b887e582d192b6316326974eab5d0f
MD5 ea993578ac9cb0165903923918ab964f
BLAKE2b-256 8489d30e42ec51af9f822087942a7bbfa0e156f35c8575be7949aead5d60f2b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for microvenv-2025.0.tar.gz:

Publisher: release.yml on brettcannon/microvenv

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

File details

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

File metadata

  • Download URL: microvenv-2025.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for microvenv-2025.0-py3-none-any.whl
Algorithm Hash digest
SHA256 568155ec18af01c89f270d35d123ab803b09672b480c3702d15fd69e9cc5bd1e
MD5 3034443747867fe8d6e35f444a28617f
BLAKE2b-256 6dbffef7bca8a0049da3535e5b0117e9e6c16d6ad9bc9f793074e621c5a572ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for microvenv-2025.0-py3-none-any.whl:

Publisher: release.yml on brettcannon/microvenv

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