Usage: pip-compile [OPTIONS] [SRC_FILES]...
Compile requirements.txt from source files.
Valid sources are requirements.in, pyproject.toml, setup.cfg, or setup.py
specs.
Options:
-h, --help Show this message and exit.
--version Show the version and exit.
--color / --no-color Force output to be colorized or not, instead
of auto-detecting color support
-v, --verbose Show more output
-q, --quiet Give less output
-n, --dry-run Only show what would happen, don't change
anything
-p, --pre Allow resolving to prereleases (default is
not)
-r, --rebuild Clear any caches upfront, rebuild from
scratch
--extra TEXT Name of an extras_require group to install;
may be used more than once. Pass ``--all-
extras`` to include every declared extra.
--all-extras Install all extras_require groups (see also:
``--extra`` for one at a time)
-f, --find-links TEXT Look for archives in this directory or on
this HTML page; may be used more than once
-i, --index-url TEXT Change index URL (defaults to
https://pypi.org/simple)
--no-index Ignore package index (only looking at
--find-links URLs instead).
--extra-index-url TEXT Add another index URL to search; may be used
more than once
--cert TEXT Path to alternate CA bundle.
--client-cert TEXT Path to SSL client certificate, a single
file containing the private key and the
certificate in PEM format.
--trusted-host TEXT Mark this host as trusted, even though it
does not have valid or any HTTPS; may be
used more than once
--uploaded-prior-to TEXT Only consider package versions uploaded
prior to the given date/time. Accepts ISO
8601 strings (e.g., '2023-01-01T00:00:00Z').
Requires pip >= 26.0.
--header / --no-header Add header to generated file
--emit-trusted-host / --no-emit-trusted-host
Add trusted host option to generated file
--annotate / --no-annotate Annotate results, indicating where
dependencies come from
--annotation-style [line|split]
Choose the format of annotation comments
-U, --upgrade / --no-upgrade Try to upgrade all dependencies to their
latest versions
-P, --upgrade-package TEXT Re-resolve the named package against the
index, ignoring any pin from the existing
requirements file. May be used more than
once. Other packages keep their seeded pins.
-o, --output-file FILENAME Output file name. Required if more than one
input file is given. Will be derived from
input file otherwise.
--newline [lf|crlf|native|preserve]
Override the newline control characters used
--allow-unsafe / --no-allow-unsafe
Pin packages considered unsafe: distribute,
pip, setuptools.
WARNING: Future versions of pip-tools will
enable this behavior by default. Use --no-
allow-unsafe to keep the old behavior. It is
recommended to pass the --allow-unsafe now
to adapt to the upcoming change.
--strip-extras / --no-strip-extras
Assure output file is constraints
compatible, avoiding use of extras.
--generate-hashes Generate pip 8 style hashes in the resulting
requirements file.
--reuse-hashes / --no-reuse-hashes
Improve the speed of --generate-hashes by
reusing the hashes from an existing output
file.
--max-rounds INTEGER Maximum number of rounds before resolving
the requirements aborts.
--build-isolation / --no-build-isolation
Enable isolation when building a modern
source distribution. With ``--no-build-
isolation`` you must pre-install every PEP
518 build dependency (``setuptools``,
``wheel``, ``hatchling``, etc.) into the
active environment; missing build deps
surface as import errors during the backend
invocation, far from the underlying cause.
--emit-find-links / --no-emit-find-links
Add the find-links option to generated file
--cache-dir DIRECTORY Store the cache data in DIRECTORY. [env
var: PIP_TOOLS_CACHE_DIR; default:
/home/docs/.cache/pip-tools]
--pip-args TEXT Arguments to pass directly to the pip
command.
--resolver [legacy|backtracking]
Choose the dependency resolver.
--emit-index-url / --no-emit-index-url
Add index URL to generated file
--emit-options / --no-emit-options
Add options to generated file
--unsafe-package TEXT Specify a package to consider unsafe; may be
used more than once. Replaces default unsafe
packages: distribute, pip, setuptools
--config FILE Read configuration from TOML file. By
default, looks for the following files in
the given order: .pip-tools.toml,
pyproject.toml.
--no-config Do not read any config file.
-c, --constraint TEXT Constrain versions using the given
constraints file; may be used more than
once.
--build-deps-for [editable|sdist|wheel]
Name of a build target to extract
dependencies for. Static dependencies
declared in 'pyproject.toml::build-
system.requires' will be included as well;
may be used more than once.
--all-build-deps Extract dependencies for all build targets.
Static dependencies declared in
'pyproject.toml::build-system.requires' will
be included as well.
--only-build-deps Extract a package only if it is a build
dependency.
Examples:
Compile requirements.in to requirements.txt:
$ pip-compile
Upgrade all packages to their latest versions:
$ pip-compile --upgrade
Upgrade specific packages:
$ pip-compile -P django -P requests
Include package hashes for extra security:
$ pip-compile --generate-hashes
Compile with optional extras:
$ pip-compile --extra dev pyproject.toml