Skip to main content

hatch-pip-compile

hatch plugin to use pip-compile (or uv) to manage project dependencies and lockfiles.

PyPI PyPI - Python Version GitHub License docs Testing Status Hatch project Pip Tools project uv Ruff pre-commit semantic-release Gitmoji

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

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

Release files for hatch-pip-compile 1.11.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hatch-pip-compile 1.11.8
File Size Uploaded
hatch_pip_compile-1.11.8.tar.gz 575.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hatch-pip-compile 1.11.8
File Interpreter ABI Platform
hatch_pip_compile-1.11.8-py3-none-any.whl Python 3 none any Details

Total release size: 593.0 kB

Release files / hatch_pip_compile-1.11.8.tar.gz

Download URL hatch_pip_compile-1.11.8.tar.gz
Size 575.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8c1a4dbdcd962a1c22e67391d8e321e1533bc18d6de09e4ae81b09b59c29685c
BLAKE2b-256 checksum
How to use checksums
286b57cb55b70da576a17bf879299d69caac11a1263cf2294281855c92d2ebc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / hatch_pip_compile-1.11.8-py3-none-any.whl

Download URL hatch_pip_compile-1.11.8-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7038c60b338a7832aecc88853e7284d70cb73c2ac05755f87e00962c4571b22
BLAKE2b-256 checksum
How to use checksums
29a2d277744ff3a4cfd83a1e1d6c7c55611a7b568a2b8ae716d9d89ba329942b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.11.8 This release

2 release files

1.11.7

2 release files

1.11.6

2 release files

1.11.5

2 release files

1.11.4

2 release files

1.11.2

2 release files

1.11.1

2 release files

1.11.0

2 release files

1.10.0

2 release files

1.9.2

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.3

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page