Lock hatch environments using pip-deepfreeze
Project description
hatch-pip-deepfreeze
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
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
Built Distribution
Hashes for hatch_pip_deepfreeze-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2e749d6371b1e7ce3d90edae49361d70f0d7eb4897fd213ec7378826592078f |
|
MD5 | 726efeecbb2ecad817073341245a3fe3 |
|
BLAKE2b-256 | 0fec4528a7d1273bf9adeefe121ba9765d413857959b3f99fc254f2ed27f1ecc |