Skip to main content

A minimal re-implementation of Python's venv module

Project description

microvenv

Create a minimal virtual environment.

This module is meant 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 is only used as a fallback.

Usage

python microvenv.py [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") -> None

The microvenv.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 module 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.1.2.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

microvenv-2023.1.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: microvenv-2023.1.2.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for microvenv-2023.1.2.tar.gz
Algorithm Hash digest
SHA256 6e6337e6551104ee7dffbf54d1e871091c20601097f7ee2bf8e9c6238595b00c
MD5 4035f18f9045ffca013a4a113e7d820a
BLAKE2b-256 073e92c54c09c83f1f83a7c2a89ec584ac2924df77fc6cd140fdd90a39eb3661

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for microvenv-2023.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d216d964e069a98aacfdca75b33315cd220d7a792c3356bf116f9b0c6c01bfb
MD5 d980dbf4e909d3145954ad797b6e87af
BLAKE2b-256 2a7d154fb63010f4fed0c0c1cf97cb64506538c698da9d5716be752ad41eb16a

See more details on using hashes here.

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