Skip to content

Commit 568f0eb

Browse files
committed
Support '--use-feature' in requirements files
This patch adds support for `--use-feature` in requirements files so that a project that wants all contributors using the same pip features can specify it in the requirements file. For example, to ensure a requirements file uses the new resolver: ``` --use-feature=2020-resolver boto3 boto3==1.13.13 ``` This is a new version of #8293.
1 parent d01aeaa commit 568f0eb

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

news/8600.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support ``--use-feature`` in requirements files

src/pip/_internal/req/req_file.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
cmdoptions.require_hashes,
6363
cmdoptions.pre,
6464
cmdoptions.trusted_host,
65+
cmdoptions.use_new_feature,
6566
] # type: List[Callable[..., optparse.Option]]
6667

6768
# options to be passed to requirements

tests/unit/test_req_file.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@ def test_set_finder_allow_all_prereleases(self, line_processor, finder):
382382
line_processor("--pre", "file", 1, finder=finder)
383383
assert finder.allow_all_prereleases
384384

385+
def test_use_feature(self, line_processor):
386+
"""--use-feature can be set in requirements files."""
387+
line_processor("--use-feature=2020-resolver", "filename", 1)
388+
385389
def test_relative_local_find_links(
386390
self, line_processor, finder, monkeypatch, tmpdir
387391
):

0 commit comments

Comments
 (0)