1
- [ ![ jazzband] ( https:// jazzband.co/static/img/badge.svg )] ( https:// jazzband.co/ )
2
- [ ![ pypi] ( https://img.shields.io/ pypi/v/pip-tools.svg )] ( https:// pypi.org/project/pip-tools/ )
3
- [ ![ pyversions] ( https://img.shields.io/pypi/ pyversions/pip-tools.svg )] ( https://pypi.org/project/pip-tools/ )
4
- [ ![ pre-commit] ( https://results. pre-commit.ci/badge/github/jazzband/pip-tools/main.svg )] ( https://results. pre-commit.ci/latest/github/jazzband/pip-tools/main )
5
- [ ![ buildstatus-gha] ( https://github.com/jazzband/pip-tools/workflows/CI/badge.svg )] ( https://github.com/jazzband/pip-tools/actions?query=workflow%3ACI )
6
- [ ![ codecov] ( https:// codecov.io/gh/jazzband/pip-tools/branch/main/graph/badge.svg )] ( https:// codecov.io/gh/jazzband/pip-tools )
1
+ [ ![ jazzband] [ jazzband-image ]] ( jazzband )
2
+ [ ![ pypi] [ pypi-image ]] ( pypi )
3
+ [ ![ pyversions] [ pyversions-image ]] ( pyversions )
4
+ [ ![ pre-commit] [ pre-commit-image ]] ( pre-commit )
5
+ [ ![ buildstatus-gha] [ buildstatus-gha-image ]] ( buildstatus-gha )
6
+ [ ![ codecov] [ codecov-image ]] ( codecov )
7
7
8
8
# pip-tools = pip-compile + pip-sync
9
9
10
10
A set of command line tools to help you keep your ` pip ` -based packages fresh,
11
11
even when you've pinned them. You do pin them, right? (In building your Python application and its dependencies for production, you want to make sure that your builds are predictable and deterministic.)
12
12
13
- [ ![ pip-tools overview for phase II] ( https://github.com/jazzband/ pip-tools/raw/main/img/pip-tools- overview.svg )] ( https://github.com/jazzband/ pip-tools/raw/main/img/pip-tools- overview.svg )
13
+ [ ![ pip-tools overview for phase II] [ pip-tools- overview ]] ( pip-tools- overview )
14
14
15
15
## Installation
16
16
17
17
Similar to ` pip ` , ` pip-tools ` must be installed in each of your project's
18
18
[ virtual environments] ( https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments ) :
19
19
20
- ```
20
+ ``` console
21
21
$ source /path/to/venv/bin/activate
22
22
(venv) $ python -m pip install pip-tools
23
23
```
@@ -62,7 +62,7 @@ or [flit](https://flit.pypa.io/).
62
62
Suppose you have a 'foobar' Python application that is packaged using ` Setuptools ` ,
63
63
and you want to pin it for production. You can declare the project metadata as:
64
64
65
- ```
65
+ ``` toml
66
66
[build-system ]
67
67
requires = [" setuptools" , " setuptools-scm" ]
68
68
build-backend = " setuptools.build_meta"
@@ -82,7 +82,7 @@ want to pin it for production. You also want to pin your development tools
82
82
in a separate pin file. You declare ` django ` as a dependency and create an
83
83
optional dependency ` dev ` that includes ` pytest ` :
84
84
85
- ```
85
+ ``` toml
86
86
[build-system ]
87
87
requires = [" hatchling" ]
88
88
build-backend = " hatchling.build"
@@ -98,7 +98,7 @@ dev = ["pytest"]
98
98
99
99
You can produce your pin files as easily as:
100
100
101
- ```
101
+ ``` console
102
102
$ pip-compile -o requirements.txt pyproject.toml
103
103
#
104
104
# This file is autogenerated by pip-compile with Python 3.10
@@ -166,7 +166,7 @@ django
166
166
167
167
Now, run ` pip-compile requirements.in ` :
168
168
169
- ```
169
+ ``` console
170
170
$ pip-compile requirements.in
171
171
#
172
172
# This file is autogenerated by pip-compile with Python 3.10
@@ -199,7 +199,7 @@ To force `pip-compile` to update all packages in an existing
199
199
To update a specific package to the latest or a specific version use the
200
200
` --upgrade-package ` or ` -P ` flag:
201
201
202
- ```
202
+ ``` console
203
203
# only update the django package
204
204
$ pip-compile --upgrade-package django
205
205
@@ -214,7 +214,7 @@ You can combine `--upgrade` and `--upgrade-package` in one command, to
214
214
provide constraints on the allowed upgrades. For example to upgrade all
215
215
packages whilst constraining requests to the latest version less than 3.0:
216
216
217
- ```
217
+ ``` console
218
218
$ pip-compile --upgrade --upgrade-package ' requests<3.0'
219
219
```
220
220
@@ -223,7 +223,7 @@ $ pip-compile --upgrade --upgrade-package 'requests<3.0'
223
223
If you would like to use _ Hash-Checking Mode_ available in ` pip ` since
224
224
version 8.0, ` pip-compile ` offers ` --generate-hashes ` flag:
225
225
226
- ```
226
+ ``` console
227
227
$ pip-compile --generate-hashes requirements.in
228
228
#
229
229
# This file is autogenerated by pip-compile with Python 3.10
@@ -252,14 +252,14 @@ To output the pinned requirements in a filename other than
252
252
multiple files, for example with different constraints on django to test a
253
253
library with both versions using [ tox] ( https://tox.readthedocs.io/en/latest/ ) :
254
254
255
- ```
255
+ ``` console
256
256
$ pip-compile --upgrade-package ' django<1.0' --output-file requirements-django0x.txt
257
257
$ pip-compile --upgrade-package ' django<2.0' --output-file requirements-django1x.txt
258
258
```
259
259
260
260
Or to output to standard output, use ` --output-file=- ` :
261
261
262
- ```
262
+ ``` console
263
263
$ pip-compile --output-file=- > requirements.txt
264
264
$ pip-compile - --output-file=- < requirements.in > requirements.txt
265
265
```
@@ -269,7 +269,7 @@ $ pip-compile - --output-file=- < requirements.in > requirements.txt
269
269
Any valid ` pip ` flags or arguments may be passed on with ` pip-compile ` 's
270
270
` --pip-args ` option, e.g.
271
271
272
- ```
272
+ ``` console
273
273
$ pip-compile requirements.in --pip-args " --retries 10 --timeout 30"
274
274
```
275
275
@@ -280,7 +280,7 @@ confusing consumers of your custom script you can override the update command
280
280
generated at the top of requirements files by setting the
281
281
` CUSTOM_COMPILE_COMMAND ` environment variable.
282
282
283
- ```
283
+ ``` console
284
284
$ CUSTOM_COMPILE_COMMAND=" ./pipcompilewrapper" pip-compile requirements.in
285
285
#
286
286
# This file is autogenerated by pip-compile with Python 3.10
@@ -340,7 +340,7 @@ pytz==2023.3
340
340
Now compile the dev requirements and the ` requirements.txt ` file is used as
341
341
a constraint:
342
342
343
- ```
343
+ ``` console
344
344
$ pip-compile dev-requirements.in
345
345
#
346
346
# This file is autogenerated by pip-compile with Python 3.10
@@ -369,13 +369,13 @@ the dev environment.
369
369
370
370
To install requirements in production stage use:
371
371
372
- ```
372
+ ``` console
373
373
$ pip-sync
374
374
```
375
375
376
376
You can install requirements in development stage by:
377
377
378
- ```
378
+ ``` console
379
379
$ pip-sync requirements.txt dev-requirements.txt
380
380
```
381
381
@@ -385,7 +385,7 @@ You might use `pip-compile` as a hook for the [pre-commit](https://github.com/pr
385
385
See [ pre-commit docs] ( https://pre-commit.com/ ) for instructions.
386
386
Sample ` .pre-commit-config.yaml ` :
387
387
388
- ```
388
+ ``` yaml
389
389
repos :
390
390
- repo : https://github.com/jazzband/pip-tools
391
391
rev : 6.13.0
@@ -395,7 +395,7 @@ repos:
395
395
396
396
You might want to customize ` pip-compile` args by configuring `args` and/or `files`, for example:
397
397
398
- ```
398
+ ` ` ` yaml
399
399
repos:
400
400
- repo: https://github.com/jazzband/pip-tools
401
401
rev: 6.13.0
@@ -407,7 +407,7 @@ repos:
407
407
408
408
If you have multiple requirement files make sure you create a hook for each file.
409
409
410
- ```
410
+ ` ` ` yaml
411
411
repos:
412
412
- repo: https://github.com/jazzband/pip-tools
413
413
rev: 6.13.0
@@ -447,7 +447,7 @@ or upgrade.
447
447
**Be careful**: `pip-sync` is meant to be used only with a
448
448
` requirements.txt` generated by `pip-compile`.
449
449
450
- ```
450
+ ` ` ` console
451
451
$ pip-sync
452
452
Uninstalling flake8-2.4.1:
453
453
Successfully uninstalled flake8-2.4.1
@@ -463,7 +463,7 @@ Successfully installed click-4.1
463
463
To sync multiple `*.txt` dependency lists, just pass them in via command
464
464
line arguments, e.g.
465
465
466
- ```
466
+ ` ` ` console
467
467
$ pip-sync dev-requirements.txt requirements.txt
468
468
` ` `
469
469
@@ -472,7 +472,7 @@ Passing in empty arguments would cause it to default to `requirements.txt`.
472
472
Any valid `pip install` flags or arguments may be passed with `pip-sync`'s
473
473
` --pip-args` option, e.g.
474
474
475
- ```
475
+ ` ` ` console
476
476
$ pip-sync requirements.txt --pip-args "--no-cache-dir --no-deps"
477
477
` ` `
478
478
@@ -562,3 +562,18 @@ versions as the required `pip` versions.
562
562
| 6.4.0 | 21.2 - 21.3.\* | 3.6 - 3.10 |
563
563
| 6.5.0 - 6.10.0 | 21.2 - 22.3.\* | 3.7 - 3.11 |
564
564
| 6.11.0+ | 22.2+ | 3.7 - 3.11 |
565
+
566
+
567
+ [jazzband] : https://jazzband.co/
568
+ [jazzband-image] : https://jazzband.co/static/img/badge.svg
569
+ [pypi] : https://pypi.org/project/pip-tools/
570
+ [pypi-image] : https://img.shields.io/pypi/v/pip-tools.svg
571
+ [pyversions] : https://pypi.org/project/pip-tools/
572
+ [pyversions-image] : https://img.shields.io/pypi/pyversions/pip-tools.svg
573
+ [pre-commit] : https://results.pre-commit.ci/latest/github/jazzband/pip-tools/main
574
+ [pre-commit-image] : https://results.pre-commit.ci/badge/github/jazzband/pip-tools/main.svg
575
+ [buildstatus-gha] : https://github.com/jazzband/pip-tools/actions?query=workflow%3ACI
576
+ [buildstatus-gha-image] : https://github.com/jazzband/pip-tools/workflows/CI/badge.svg
577
+ [codecov] : https://codecov.io/gh/jazzband/pip-tools
578
+ [codecov-image] : https://codecov.io/gh/jazzband/pip-tools/branch/main/graph/badge.svg
579
+ [pip-tools-overview] : https://github.com/jazzband/pip-tools/raw/main/img/pip-tools-overview.svg
0 commit comments