Python library to ensure the runtime executing your code meets application requirements.
Project description
Environmentinator
Python library to ensure the runtime executing your code meets application requirements.
Capabilities include:
- Ensure a python runtime version is
>
or<
Major.Minor version requirements (eg "only let this tool run on python3.10+
") - Ensure
pip
packages are installed, installing them to a.pyenv
folder if they do not exist on the host
Example usage
# We do not assume environmentinator has been installed,
# so we have one prelude to pip install it
try:
import environmentinator
except:
import pip
pip.main(['install', '--user', 'environmentinator'])
import environmentinator
# First arg is comparison expression; eg '==3.10', '<3.7', '>=3.8'
# Second argument is an optional list of alternative folders to
# search for python runtimes that could match the requested version,
# if the current one does not match.
environmentinator.ensure_py_version('>3.8',)
# If json5 exists in `.pyenv` great, if not use pip to install with `--target=.pyenv`
json5 = environmentinator.ensure_module('json5')
Generating Library Docs
python gen_docs.py
Publishing Notes
HATCH_INDEX_USER='__token__' HATCH_INDEX_AUTH=$(cat /path/to/my/pypi-token.txt) python publish.py
Examples
See ./examples/
for all examples.
example_01.py
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
environmentinator-0.1.3.tar.gz
(92.8 kB
view hashes)
Built Distribution
Close
Hashes for environmentinator-0.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aeb03ff6fa757e6372c38c7d86e531e6311fa47737b8e284ef7a4ade0ffb3ab7 |
|
MD5 | 83f140a37d28f0fff27c0746124908a3 |
|
BLAKE2b-256 | cd7762b78a26eee76e6c6244302591819497af6dc3e95a903d4972bef83263b4 |