Skip to content

Commit

Permalink
Update examples in README (#1835)
Browse files Browse the repository at this point in the history
* Update --generate-hashes example in README

The previous output had a trailing backslash on the last hash line;
while this is apparently valid for both pip-sync and pip install, IMHO
it looks like a bug, and it also doesn’t reflect what pip-compile
currently emits (as of version 6.12.3), so update the example.

This puts the hashes example out of sync with some of the other examples
in the README, but they weren’t all in sync before either (various
examples were already referencing Django 4, 3 or 2), so I hope that’s
not an issue.

* Refresh all pip-compile outputs in README

In one case (layered requirements), I had to add a constraint on the
django-debug-toolbar version because otherwise no solution was found by
the legacy resolver. (The backtracking resolver does find a solution,
but isn’t the default yet.) This should probably be revisited later,
ideally by someone more knowledgeable than me :)
  • Loading branch information
lucaswerkmeister authored Apr 5, 2023
1 parent d931833 commit 09d4816
Showing 1 changed file with 48 additions and 60 deletions.
108 changes: 48 additions & 60 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,46 +105,42 @@ You can produce your pin files as easily as:
$ pip-compile -o requirements.txt pyproject.toml
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements.txt pyproject.toml
#
asgiref==3.5.2
# via django
django==4.1
asgiref==3.6.0
# via django
django==4.1.7
# via my-cool-django-app (pyproject.toml)
sqlparse==0.4.2
sqlparse==0.4.3
# via django
$ pip-compile --extra dev -o dev-requirements.txt pyproject.toml
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --extra=dev --output-file=dev-requirements.txt pyproject.toml
#
asgiref==3.5.2
asgiref==3.6.0
# via django
attrs==22.1.0
attrs==22.2.0
# via pytest
django==4.1
django==4.1.7
# via my-cool-django-app (pyproject.toml)
iniconfig==1.1.1
exceptiongroup==1.1.1
# via pytest
packaging==21.3
iniconfig==2.0.0
# via pytest
pluggy==1.0.0
packaging==23.0
# via pytest
py==1.11.0
pluggy==1.0.0
# via pytest
pyparsing==3.0.9
# via packaging
pytest==7.1.2
pytest==7.2.2
# via my-cool-django-app (pyproject.toml)
sqlparse==0.4.2
sqlparse==0.4.3
# via django
tomli==2.0.1
# via pytest
Expand Down Expand Up @@ -179,18 +175,16 @@ Now, run ``pip-compile requirements.in``:
$ pip-compile requirements.in
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile requirements.in
#
asgiref==3.2.3
asgiref==3.6.0
# via django
django==3.0.3
django==4.1.7
# via -r requirements.in
pytz==2019.3
# via django
sqlparse==0.3.0
sqlparse==0.4.3
# via django
And it will produce your ``requirements.txt``, with all the Django dependencies
Expand Down Expand Up @@ -242,26 +236,22 @@ version 8.0, ``pip-compile`` offers ``--generate-hashes`` flag:
$ pip-compile --generate-hashes requirements.in
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --generate-hashes requirements.in
#
asgiref==3.2.3 \
--hash=sha256:7e06d934a7718bf3975acbf87780ba678957b87c7adc056f13b6215d610695a0 \
--hash=sha256:ea448f92fc35a0ef4b1508f53a04c4670255a3f33d22a81c8fc9c872036adbe5 \
asgiref==3.6.0 \
--hash=sha256:71e68008da809b957b7ee4b43dbccff33d1b23519fb8344e33f049897077afac \
--hash=sha256:9567dfe7bd8d3c8c892227827c41cce860b368104c3431da67a0c5a65a949506
# via django
django==3.0.3 \
--hash=sha256:2f1ba1db8648484dd5c238fb62504777b7ad090c81c5f1fd8d5eb5ec21b5f283 \
--hash=sha256:c91c91a7ad6ef67a874a4f76f58ba534f9208412692a840e1d125eb5c279cb0a \
django==4.1.7 \
--hash=sha256:44f714b81c5f190d9d2ddad01a532fe502fa01c4cb8faf1d081f4264ed15dcd8 \
--hash=sha256:f2f431e75adc40039ace496ad3b9f17227022e8b11566f4b363da44c7e44761e
# via -r requirements.in
pytz==2019.3 \
--hash=sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d \
--hash=sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be \
# via django
sqlparse==0.3.0 \
--hash=sha256:40afe6b8d4b1117e7dff5504d7a8ce07d9a1b15aeeade8a2d10f130a834f8177 \
--hash=sha256:7c3dca29c022744e95b547e867cee89f4fce4373f3549ccd8797d8eb52cdb873 \
sqlparse==0.4.3 \
--hash=sha256:0323c0ec29cd52bceabc1b4d9d579e311f3e4961b98d174201d5622a23b85e34 \
--hash=sha256:69ca804846bb114d2ec380e4360a8a340db83f0ccf3afceeb1404df028f57268
# via django
Output File
Expand Down Expand Up @@ -306,18 +296,16 @@ generated at the top of requirements files by setting the
$ CUSTOM_COMPILE_COMMAND="./pipcompilewrapper" pip-compile requirements.in
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# ./pipcompilewrapper
#
asgiref==3.2.3
asgiref==3.6.0
# via django
django==3.0.3
django==4.1.7
# via -r requirements.in
pytz==2019.3
# via django
sqlparse==0.3.0
sqlparse==0.4.3
# via django
Workflow for layered requirements
Expand All @@ -344,22 +332,22 @@ selected for production in ``requirements.txt``.
# dev-requirements.in
-c requirements.txt
django-debug-toolbar
django-debug-toolbar<2.2
First, compile ``requirements.txt`` as usual:

.. code-block:: bash
$ pip-compile
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile
#
django==2.1.15
# via -r requirements.in
pytz==2019.3
pytz==2023.3
# via django
Expand All @@ -370,22 +358,22 @@ a constraint:
$ pip-compile dev-requirements.in
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile dev-requirements.in
#
django-debug-toolbar==2.2
# via -r dev-requirements.in
django==2.1.15
# via
# -c requirements.txt
# django-debug-toolbar
pytz==2019.3
django-debug-toolbar==2.1
# via -r dev-requirements.in
pytz==2023.3
# via
# -c requirements.txt
# django
sqlparse==0.3.0
sqlparse==0.4.3
# via django-debug-toolbar
As you can see above, even though a ``2.2`` release of Django is available, the
Expand Down

0 comments on commit 09d4816

Please sign in to comment.