Skip to content

Commit

Permalink
Merge branch 'master' into pep440-direct-reference
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentJeannot committed Apr 27, 2021
2 parents 4999357 + e8982fb commit dee9ddf
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 21.4b0
hooks:
- id: black
args: [--target-version=py36]
Expand All @@ -9,7 +9,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/asottile/pyupgrade
rev: v2.12.0
rev: v2.13.0
hooks:
- id: pyupgrade
args: [--py36-plus]
Expand Down
72 changes: 41 additions & 31 deletions README.rst
Expand Up @@ -30,7 +30,6 @@ even when you've pinned them. You do pin them, right? (In building your Python
:target: https://pypi.org/project/pip-tools/
.. _You do pin them, right?: http://nvie.com/posts/pin-your-packages/


Installation
============

Expand Down Expand Up @@ -62,9 +61,11 @@ project so conditional dependencies that require a specific Python version,
or other environment markers, resolve relative to your project's
environment.

**Note**: ensure you don't have ``requirements.txt`` if you compile
``setup.py`` or ``requirements.in`` from scratch, otherwise, it might
interfere.
**Note**: If ``pip-compile`` finds an existing ``requirements.txt`` file that
fulfils the dependencies then no changes will be made, even if updates are
available. To compile from scratch, first delete the existing
``requirements.txt`` file, or see `Updating requirements`_ for alternative
approaches.

Requirements from ``setup.py``
------------------------------
Expand Down Expand Up @@ -130,6 +131,42 @@ And it will produce your ``requirements.txt``, with all the Django dependencies

.. _it's easy to write one: https://packaging.python.org/guides/distributing-packages-using-setuptools/#configuring-your-project

.. _Updating requirements:

Updating requirements
---------------------

``pip-compile`` generates a ``requirements.txt`` file using the latest versions
that fulfil the dependencies of ``setup.py`` or ``requirements.in``.

If ``pip-compile`` finds an existing ``requirements.txt`` file that fulfils the
dependencies then no changes will be made, even if updates are available.

To force ``pip-compile`` to update all packages in an existing
``requirements.txt``, run ``pip-compile --upgrade``.

To update a specific package to the latest or a specific version use the
``--upgrade-package`` or ``-P`` flag:

.. code-block:: bash
# only update the django package
$ pip-compile --upgrade-package django
# update both the django and requests packages
$ pip-compile --upgrade-package django --upgrade-package requests
# update the django package to the latest, and requests to v2.0.0
$ pip-compile --upgrade-package django --upgrade-package requests==2.0.0
You can combine ``--upgrade`` and ``--upgrade-package`` in one command, to
provide constraints on the allowed upgrades. For example to upgrade all
packages whilst constraining requests to the latest version less than 3.0:

.. code-block:: bash
$ pip-compile --upgrade --upgrade-package 'requests<3.0'
Using hashes
------------

Expand Down Expand Up @@ -162,33 +199,6 @@ version 8.0, ``pip-compile`` offers ``--generate-hashes`` flag:
--hash=sha256:7c3dca29c022744e95b547e867cee89f4fce4373f3549ccd8797d8eb52cdb873 \
# via django
Updating requirements
---------------------

To update all packages, periodically re-run ``pip-compile --upgrade``.

To update a specific package to the latest or a specific version use the
``--upgrade-package`` or ``-P`` flag:

.. code-block:: bash
# only update the django package
$ pip-compile --upgrade-package django
# update both the django and requests packages
$ pip-compile --upgrade-package django --upgrade-package requests
# update the django package to the latest, and requests to v2.0.0
$ pip-compile --upgrade-package django --upgrade-package requests==2.0.0
You can combine ``--upgrade`` and ``--upgrade-package`` in one command, to
provide constraints on the allowed upgrades. For example to upgrade all
packages whilst constraining requests to the latest version less than 3.0:

.. code-block:: bash
$ pip-compile --upgrade --upgrade-package 'requests<3.0'
Output File
-----------

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli_compile.py
Expand Up @@ -384,7 +384,7 @@ def test_run_as_module_compile():


def test_editable_package(pip_conf, runner):
""" piptools can compile an editable """
"""piptools can compile an editable"""
fake_package_dir = os.path.join(PACKAGES_PATH, "small_fake_with_deps")
fake_package_dir = path_to_url(fake_package_dir)
with open("requirements.in", "w") as req_in:
Expand Down

0 comments on commit dee9ddf

Please sign in to comment.