A minimal package to ensure pip-managed packages on import. Oriented towards scripting in local environments
Project description
ensurepkg
ensurepkg
is a minimal package to ensure a pip-managed package exists.
example
from ensurepkg import EnsurePkg
for guard in EnsurePkg(dict(dotenv="python-dotenv")):
with guard:
import dotenv
with EnsurePkg(dict(git="GitPython"), cache_dir="/tmp/ensurepkg"):
import git
print(dotenv.__name__)
print(git.__name__, git.__version__)
cache_dir
cache_dir
is where ensurepkg installs the packages. It is isolated from other environments and it's resolved as:
- setting programatically via
EnsurePkg(cache_dir="...")
- from env var $ENSUREPKG_DIR
- from env var $XDG_CACHE_HOME/ensurepkg
- from env var $HOME/.cache/ensurepkg
- /tmp/ensurepkg
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ensurepkg-0.1.0.tar.gz
(6.5 kB
view details)
Built Distribution
File details
Details for the file ensurepkg-0.1.0.tar.gz
.
File metadata
- Download URL: ensurepkg-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Linux/5.15.146.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33100924969484d0dba62f896848a1072c90d6e1801c33066d1ab1a7d9a131e5 |
|
MD5 | 9d54a2c5979f630395f41f6df2d79897 |
|
BLAKE2b-256 | a3c719f3de8786db926c253bd1b69c7829aa4ec574bf470e1e2dcffc4fac2828 |
File details
Details for the file ensurepkg-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: ensurepkg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Linux/5.15.146.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 142916ecf431990ed883c45519e5d55419e1272ff9a32b4fd748d5149efd367a |
|
MD5 | dd070337ebec39a8e40121688f5c24b9 |
|
BLAKE2b-256 | f1c8bf2ae5966b02104c9557b35a1d76a8c5eda6e6afabe0ffdd2261eb84f437 |