Skip to main content

Lock hatch environments using pip-deepfreeze

Project description

hatch-pip-deepfreeze

PyPI - Version PyPI - Python Version


A hatch virtual environment plugin to lock dependencies with pip-deepfreeze.

Installation

hatch-pip-deepfreeze must be installed in the same environment as hatch itself.

If hatch has been installed with pipx:

pipx runpip hatch install hatch-pip-deepfreeze

If hatch has been installed with pip in the user environment:

pip install --user hatch-pip-deepfreeze

Usage

In the tool.hatch.envs.{name} section, add type = "pip-deepfreeze". Such environments behave similarly to the standard hatch virtual environments, except the installation and synchronization is performed using pip-deepfreeze sync.

This will automatically generate locked dependencies in requirements.txt, and uninstall unneeded dependencies after removing them from pyproject.toml. It also pins optional dependencies groups in requirements-{extra}.txt.

You can use the features to install project.optional-dependencies in environments.

Note that this pluging does not support per environment dependencies, because pip-deepfreeze works exclusively with project.optional-dependencies for that. Fortunately this is well supported by hatch.

As an example, you can adapt a pyproject.toml generated by hatch new like so:

Declare optional dependencies for test:

[project.optional-dependencies]
test = [
    "pytest",
    "pytest-cov",
]

Update the default environment section to remove dependencies and add features:

[tool.hatch.envs.default]
type = "pip-deepfreeze"
features = ["test"]

Use the usual hatch environment activation features such as hatch shell and notice pip-deepfreeze in action.

License

hatch-pip-deepfreeze is distributed under the terms of the MIT license.

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

hatch_pip_deepfreeze-0.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

hatch_pip_deepfreeze-0.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file hatch_pip_deepfreeze-0.1.tar.gz.

File metadata

  • Download URL: hatch_pip_deepfreeze-0.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for hatch_pip_deepfreeze-0.1.tar.gz
Algorithm Hash digest
SHA256 ddd65db58450b170aee52b1e803a26dd9c0861116db31d644f918d2017bb0a40
MD5 2438548eaa8152b86db4a839655dae6c
BLAKE2b-256 9b30cb4e32c607812d95d2b81f15bc6c66a997c8a1982dd927444f74d254493b

See more details on using hashes here.

File details

Details for the file hatch_pip_deepfreeze-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hatch_pip_deepfreeze-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 565cc29767703d0c7ef52c2f1017b9a38ab7124e326549880cefb66e545f639e
MD5 a7af4560eef5d12ed5c2b6feace2ce47
BLAKE2b-256 872134d566b768cfb56459a674e324635b63c1de69fce6e4499001bc5df18b7c

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