hatch plugin to use pip-compile to manage project dependencies
Project description
hatch-pip-compile
hatch plugin to use pip-compile (or uv) to manage project dependencies and lockfiles.
Usage
The hatch-pip-compile
plugin will automatically run pip-compile
whenever your
environment needs to be updated. Behind the scenes, this plugin creates a lockfile
at requirements.txt
(non-default lockfiles are located at
requirements/requirements-{env_name}.txt
). Once the dependencies are resolved
the plugin will install the lockfile into your virtual environment and keep it
up-to-date.
Installation
Declare hatch-pip-compile
as a dependency in your pyproject.toml
file under the
[tool.hatch.env]
table and hatch will automatically install it. You must also have
your environment type set to pip-compile
(see Configuration).
-
pyproject.toml
[tool.hatch.env] requires = [ "hatch-pip-compile" ] [tool.hatch.envs.default] type = "pip-compile"
-
hatch.toml
[env] requires = [ "hatch-pip-compile" ] [envs.default] type = "pip-compile"
Configuration
Set your environment type to pip-compile
to use this plugin for the respective environment:
-
pyproject.toml
[tool.hatch.envs.default] type = "pip-compile"
-
hatch.toml
[envs.default] type = "pip-compile"
Common Scenarios
- lock-filename - changing the default lockfile path
- pip-compile-constraint - syncing dependency versions across environments
- Upgrading Dependencies - how to upgrade dependencies
- Using Hashes - how to include hashes in your lockfile
- Using uv instead of pip-compile - how to use
uv
instead ofpip-compile
Configuration Options
The plugin gives you options to configure how lockfiles are generated and how they are installed into your environment.
The following example shows how to specify the pip-compile-hashes
option
on your environment in your pyproject.toml
file:
[tool.hatch.envs.default]
type = "pip-compile"
pip-compile-hashes = true
Generating Lockfiles
name | type | description |
---|---|---|
lock-filename | str |
The filename of the ultimate lockfile. default env is requirements.txt , non-default is requirements/requirements-{env_name}.txt |
pip-compile-constraint | str |
An environment to use as a constraint file, ensuring that all shared dependencies are pinned to the same versions. |
pip-compile-hashes | bool |
Whether to generate hashes in the lockfile. Defaults to false . |
pip-compile-resolver | str |
Whether to use pip-compile or uv to resolve dependencies into the project. Defaults to pip-compile |
pip-compile-args | list[str] |
Additional command-line arguments to pass to pip-compile-resolver |
pip-compile-verbose | bool |
Set to true to run pip-compile in verbose mode instead of quiet mode, set to false to silence warnings |
Installing Lockfiles
name | type | description |
---|---|---|
pip-compile-installer | str |
Whether to use pip , pip-sync , or uv to install dependencies into the project. Defaults to pip |
pip-compile-install-args | list[str] |
Additional command-line arguments to pass to pip-compile-installer |
Check Out the Docs
Looking to contribute? See the Contributing Guide
See the Changelog
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
File details
Details for the file hatch_pip_compile-1.11.3.tar.gz
.
File metadata
- Download URL: hatch_pip_compile-1.11.3.tar.gz
- Upload date:
- Size: 573.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 786ab69c83ef3d731cbab315d34a06ce4606ffd9c389a785955e96708c320c3b |
|
MD5 | 373aee04c7389c8cf402a09540212544 |
|
BLAKE2b-256 | 7287905951abe964380a488eb15c182600e1d8d7e3916d5175beada969c19269 |
File details
Details for the file hatch_pip_compile-1.11.3-py3-none-any.whl
.
File metadata
- Download URL: hatch_pip_compile-1.11.3-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c18a2656b168a20a3dcc308a4d69870fcece017175bed29fff910bd5233364cd |
|
MD5 | 0884ae590f706dc50429ae62a5ba9262 |
|
BLAKE2b-256 | 52de2245d018a4169b0fc302928ef7cae923c9ecdf28c7a6c313741bf84d8765 |