Skip to main content

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:

  1. setting programatically via EnsurePkg(cache_dir="...")
  2. from env var $ENSUREPKG_DIR
  3. from env var $XDG_CACHE_HOME/ensurepkg
  4. from env var $HOME/.cache/ensurepkg
  5. /tmp/ensurepkg

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

ensurepkg-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

ensurepkg-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for ensurepkg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 33100924969484d0dba62f896848a1072c90d6e1801c33066d1ab1a7d9a131e5
MD5 9d54a2c5979f630395f41f6df2d79897
BLAKE2b-256 a3c719f3de8786db926c253bd1b69c7829aa4ec574bf470e1e2dcffc4fac2828

See more details on using hashes here.

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

Hashes for ensurepkg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 142916ecf431990ed883c45519e5d55419e1272ff9a32b4fd748d5149efd367a
MD5 dd070337ebec39a8e40121688f5c24b9
BLAKE2b-256 f1c8bf2ae5966b02104c9557b35a1d76a8c5eda6e6afabe0ffdd2261eb84f437

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