Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sbidoul/hatch-pip-deepfreeze
A hatch virtual environment plugin to lock dependencies with pip-deepfreeze
https://github.com/sbidoul/hatch-pip-deepfreeze
Last synced: 23 days ago
JSON representation
A hatch virtual environment plugin to lock dependencies with pip-deepfreeze
- Host: GitHub
- URL: https://github.com/sbidoul/hatch-pip-deepfreeze
- Owner: sbidoul
- License: mit
- Created: 2022-09-26T15:54:03.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-25T01:55:14.000Z (almost 2 years ago)
- Last Synced: 2024-10-03T20:18:23.164Z (about 1 month ago)
- Language: Python
- Size: 8.79 KB
- Stars: 19
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# hatch-pip-deepfreeze
[![PyPI - Version](https://img.shields.io/pypi/v/hatch-pip-deepfreeze.svg)](https://pypi.org/project/hatch-pip-deepfreeze)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-pip-deepfreeze.svg)](https://pypi.org/project/hatch-pip-deepfreeze)-----
A [hatch](https://pypi.org/project/hatch/) virtual
[environment](https://hatch.pypa.io/latest/config/environment/overview/) plugin to lock
dependencies with [pip-deepfreeze](https://pypi.org/project/pip-deepfreeze/).## Installation
`hatch-pip-deepfreeze` must be installed in the same environment as `hatch` itself.
If `hatch` has been installed with `pipx`:
```console
pipx runpip hatch install hatch-pip-deepfreeze
```If `hatch` has been installed with `pip` in the user environment:
```console
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:
```toml
[project.optional-dependencies]
test = [
"pytest",
"pytest-cov",
]
```Update the default environment section to remove `dependencies` and add `features`:
```toml
[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](https://spdx.org/licenses/MIT.html) license.