Commit Graph

4212 Commits

Author SHA1 Message Date
Stéphane Bidoul 126e6f67a5 Install report format declared stable 2023-01-28 14:15:04 +01:00
Stéphane Bidoul 99dddc1616 pip inspect format declared stable 2023-01-28 14:15:04 +01:00
Stéphane Bidoul 38681f3d66 Allow multiple hashes in direct_url.json
This influences the recorded direct_url.json metadata,
and therefore the pip inspect output,
as well as the pip install --report format.
2023-01-28 13:25:38 +01:00
Роман Донченко 44c1ccaf40 Replace deprecated setup/teardown usage
As explained in
<https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose>,
`setup`/`teardown` are a part of nose compatibility, which is deprecated.
You're supposed to use `setup_method` and `teardown_method` instead.
2023-01-27 22:00:50 +03:00
Tzu-ping Chung 95a58e7ba5
Merge pull request #11663 from uranusjr/pep-668 2023-01-18 11:50:26 +08:00
Tzu-ping Chung 5e5480b3bc Only exclude --dry-run when used with --report 2023-01-17 15:04:56 +08:00
Daniil Konovalenko 15b2cc993e fix mypy 2023-01-14 12:27:51 +01:00
Daniil Konovalenko ed7dbe9843 fix formatting 2023-01-14 12:27:51 +01:00
Daniil Konovalenko 8374d818ac add test 2023-01-14 12:27:51 +01:00
Tzu-ping Chung 5eda50d237 Test and news for wheel cache restoration
The fix merged in 3b60e36289 also fixed
the wheel cache; this cherry-picks the test and news from the other pull
request to validate and document the fact.
2023-01-09 10:13:19 +08:00
Tzu-ping Chung 0233bf2757 Merge link_hash back into _hashes
Commit bad03ef931 introduced the new
link_hash attribute that holds the link's hash info, but that attribute
does the same thing as _hashes, and some existing usages still populate
that old attribute. Since the plural variant covers more use cases (a
file can be hashed with multiple algorithms), we restore the old logic
that uses _hashes before the commit, and consolidate link_hash back into
that attribute.
2023-01-04 18:42:52 +08:00
Tzu-ping Chung 8fe6563050 Fall back to non-localized message on Windows
Windows does not implement LC_MESSAGES, and since PEP 668 is mainly
designed for Linux distributions, we simply take the easier way out
until someone wants an equivalent on Windows.
2023-01-03 08:13:13 +08:00
Tzu-ping Chung 6750d847a7 Add PEP 668 functional tests 2023-01-03 07:57:21 +08:00
Tzu-ping Chung 3d1937f420 Add tests for EXTERNALLY-MANAGED parser 2023-01-03 07:57:21 +08:00
William Woodruff 64fe2235d8
Merge branch 'main' into ww/restrict-egg-fragement 2022-12-28 10:44:23 -05:00
q0w 8dabf3316a Test all edge cases 2022-12-21 23:23:20 +03:00
q0w 9c8e74bad9 Test deps with config-settings 2022-12-19 18:59:51 +03:00
doron zarhi e59ff2fc8c show: add editable location if package is editable (#11638) 2022-12-18 01:33:57 +02:00
q0w be21f0dd10 Add more tests 2022-12-15 04:22:47 +03:00
q0w 92730f6f63 Add more tests 2022-12-15 03:17:30 +03:00
q0w 1a93652c8f
Merge branch 'main' into per-req-config-settings 2022-12-15 02:28:02 +03:00
q0w d3062a1603 Add more tests 2022-12-15 02:24:34 +03:00
Tzu-ping Chung 6d1f25b222 Skip tests using custom SSL on 3.7 + Linux
This combination does not work well on CI, and since 3.7 support is on
its last days anyway, let's just ignore those tests.
2022-12-13 14:33:56 +08:00
q0w 227fe23b0e Add per-requirement --config-settings 2022-12-05 08:05:26 +03:00
William Woodruff d9502ff501
tests: fix comment
Signed-off-by: William Woodruff <william@trailofbits.com>
2022-12-02 21:38:51 -08:00
William Woodruff 464d16618e
src, tests: use deprecation instead of hard error for egg fragments
This turns invalid egg fragments into a soft error, with a scheduled
deprecation period of two releases.

Signed-off-by: William Woodruff <william@trailofbits.com>
2022-12-02 21:33:22 -08:00
Tzu-ping Chung 8d34a1111d
Merge branch 'main' into feature/base-prefix-config 2022-11-25 09:38:56 +08:00
William Woodruff 227fbee124
tests: add more Link tests
This exercises our expectation that egg fragments don't include version
specifiers and are evaluated eagerly.

Signed-off-by: William Woodruff <william@trailofbits.com>
2022-11-22 17:40:55 -05:00
Tzu-ping Chung 1ab22ee302
Merge pull request #11590 from uranusjr/pathlib-housekeeping 2022-11-21 09:39:21 +08:00
Miro Hrončok f7589d6ec0 Don't maintain 2 copies of change_root
The change_root function was added twice:

In ae324d1703
and in 36a9b36523
2022-11-16 13:28:17 +01:00
Tzu-ping Chung 4a87ab04c8
Merge branch 'main' into feature/base-prefix-config 2022-11-16 12:50:52 +08:00
Tzu-ping Chung afb0d13220 Fix docstring to match reality
We've moved to pathlib a while ago, the docstring still references
tests.lib.path, which no longer exists.
2022-11-11 07:43:08 +08:00
Judah Rand c04222fe47
Simplify provider interface 2022-11-10 21:25:26 +00:00
Judah Rand 8d9ea8b62f
Add tests for new code paths 2022-11-10 20:05:07 +00:00
Judah Rand 3a15e01091
Get the tests passing again 2022-11-10 19:15:07 +00:00
Paul Moore 6d131137cf
Merge pull request #11547 from uranusjr/entry-point-python-version-replacement-multi-digit
Fix multi-digit version in entry point replacement
2022-11-03 11:50:58 +00:00
Tzu-ping Chung 30b4cff198
Fix typos
Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com>
2022-11-03 15:20:47 +08:00
Tzu-ping Chung d6e333fb63
Add 3.11 to CI (#11550) 2022-10-28 11:37:04 -05:00
Tzu-ping Chung 2c195f9c2c Fix multi-digit version in entry point replacement
Previously, the special case to generate 'pip' and 'easy_install' entry
points with the correct Python version (e.g. 'pip3.9' on Python 3.9)
only accounted for single-digit version segments, and did not work
correctly on Python 3.10 and up. This was missed when Python 3.10 was
released because we (accidentally) generated wheels that did not need
any such replacements, but was exposed in CPython 3.11.0 since it
bundled pip 22.3 generated against Python 3.10.
2022-10-28 01:51:36 +08:00
Tzu-ping Chung 50e194f107 Selectively enable user site
The modern virtual environment structure does not allow us to enable
"fake user site" while disabling the global site, so we need to do more
fine-grained configuration to correctly set up test environments for
each test case.

With this done, we can also properly support the stdlib venv ad the test
environment backend, since it basically works identically with modern
virtualenv. The incompatible_with_test_venv is thus removed.
2022-10-28 01:51:13 +08:00
Tzu-ping Chung 83c85e94b7 Fix legacy virtualenv setup in tests 2022-10-28 01:51:13 +08:00
Tzu-ping Chung 4ab4865063 One more rewrite to avoid distutils 2022-10-28 01:51:13 +08:00
Tzu-ping Chung 4bf1b67964 Build fake wheels for --user tests
The old INITools tests rely on setup.py, which relies on distutils and
generates a ton of issues. Build fake wheels directly to avoid dealing
with them.
2022-10-28 01:51:13 +08:00
Tzu-ping Chung b850d539f9 Keep using old virtualenv for Python < 3.10
pip uses distutils (instead of sysconfig) for Python < 3.10, which has
awkward path issues when faking a user site.
2022-10-28 01:51:13 +08:00
Tzu-ping Chung 4f20a7e3e7 Set include-system-site-packages for user site 2022-10-28 01:51:13 +08:00
Tzu-ping Chung 4d533cc269 Don't enable global site when enabling user site 2022-10-28 01:51:13 +08:00
Tzu-ping Chung 1d05ba8ffd Rewrite virtualenv tool in tests for 20+ support
Co-Authored-By: Lumir Balhar <lbalhar@redhat.com>
2022-10-28 01:51:13 +08:00
Tzu-ping Chung 5ded5474ac Name virtualenv<20 as "legacy"
Well they are. At least not "regular" anymore.
2022-10-28 01:51:13 +08:00
Tzu-ping Chung f96ba08dbc Bump virtualenv to 20+ in tests 2022-10-28 01:51:13 +08:00
Tzu-ping Chung 1e236f4c84 Ignore failing git submodule test for now
Git 2.38.1 patched CVE-2022-39253 by disaling automated fetch against a
file: repository. This breaks git submodule, which is used by a pip
test. Information on how projects relying on automated fetch should
configure git correctly after this change is lacking, so the test is
disabled for now until someone can come up with a better solution.
2022-10-28 00:16:33 +08:00
Felipe Peter fdc262f069 Fix error message and improve help text 2022-10-19 14:47:27 +08:00
Miro Hrončok fe7948a4a2 Avoid distutils imports in tests
The tests still don't run without distutils
because they require virtualenv < 20 (and virtualenv 16 uses distutils),
but at least they don't import distutils directly now.

Fixes https://github.com/pypa/pip/issues/11521
2022-10-17 19:33:03 +02:00
Pradyun Gedam e86f27fe4e
Merge pull request #11493 from pradyunsg/remove-2020-resolver-opt-in 2022-10-15 11:52:39 +01:00
Paul Moore f86f52c1b7 Get rid of the timeout test as it's too flaky to be useful 2022-10-07 20:52:35 +01:00
Pradyun Gedam 6421ab59d5
Remove the opt-in for `2020-resolver`
This has been the default for quite some time now.
2022-10-07 11:57:02 +01:00
Paul Moore fe78726b36
Merge pull request #11492 from ret2libc/raise-file-parse-error-no-valueerr
Raise RequirementsFileParseError when missing closing quotation
2022-10-06 14:31:16 +01:00
Riccardo Schirone 3ca52dc55c Raise RequirementsFileParseError when missing closing quotation
shlex.split, used to split options in requirements.txt files, might
raise a ValueError when the input string is not well formed. Catch the
ValueError and re-raise it as a RequirementsFileParseError instead.
2022-10-06 14:36:46 +02:00
Pradyun Gedam 7311c82476
Merge pull request #11359 from sbidoul/deprecate-install-options
Deprecate --install-options
2022-10-06 10:06:48 +01:00
Phil Elson b777bcda81 Add the "base" config level concept, to allow configuration of all virtual environments sharing the same base.
The new functionality serves a use case which was not previously possible with pip configuration files, namely the situation where you have a base Python installation and want to influence the pip configuration for all derivative virtual environments *without* changing the config for all other environments on a machine (global), or for all other environment run by the same user (user). Concretely, this could be used for a centrally managed network mounted filesystem based Python installation, from which multiple users can build virtual environments and inside which a specific pip configuration is needed (e.g. an index URL).
2022-10-06 09:33:38 +02:00
Felipe Peter e6e7c12b6d
Disallow freeze format with pip list --outdated (#11482)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
2022-10-04 10:11:46 +01:00
Stéphane Bidoul 51c78b4b83
Add tests for --xxx-options warnings and deprecation 2022-09-25 11:21:36 +02:00
Stéphane Bidoul 65641f10ad
Fix test_install_requirements_with_options 2022-09-25 11:21:36 +02:00
Min RK 24773bc4f5
Fix build isolation on system Pythons
use site.getsitepackages() where available
instead of just purelib/platlib,
which is often insufficient on e.g. System Pythons for Debian/macOS

handle virtualenv < 20 overwriting site.py without getsitepackages() by preserving current behavior.
2022-09-23 14:47:41 +02:00
Danny McClanahan bad03ef931
Use data-dist-info-metadata (PEP 658) to decouple resolution from downloading (#11111)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
2022-09-10 11:28:57 +01:00
Tzu-ping Chung 8856b5900e Further attempt to stablize timeout test 2022-09-08 10:24:04 +08:00
Tzu-ping Chung bfbe919fd2
Merge pull request #11277 from vanschelven/respect-no-index-from-requirements-file 2022-08-30 15:47:51 +08:00
Tzu-ping Chung 5ec3f37bc8 Don't retry to 'improve' possibility of failure 2022-08-17 15:38:15 +08:00
Tzu-ping Chung 26b66a830f Decrease timeout to make test less flaky 2022-08-17 06:41:27 +08:00
hauntsaninja edbfeae9fb fix tests 2022-08-12 19:01:26 -07:00
Stéphane Bidoul d8e2d6605a
Rename BinaryAllowedPredicate
It really is a BdistWheelAllowedPredicate and
this will make it easier to reason when --no-binary
does not imply setup.py install anymore.
2022-08-12 13:51:45 +02:00
Stéphane Bidoul be718ff59e
Fix tests that relied on setuptools not supporting PEP 660 2022-08-12 12:57:39 +02:00
Stéphane Bidoul ee7bcae0d9
Merge pull request #11331 from sbidoul/8559-take-2-sbi
Deprecate setup.py install fallback when wheel package is absent
2022-08-10 18:43:25 +02:00
Stéphane Bidoul 496bf56542
Merge pull request #10416 from sbidoul/test-indented-warnings-sbi
Detect indented ERROR and WARNING messages in tests and ignore own deprecation warnings
2022-08-10 18:42:49 +02:00
Stéphane Bidoul afe136c42b
Add test for issue 8559 deprecation 2022-08-06 19:29:31 +02:00
Stéphane Bidoul 0326b33a6d
Add missing with_wheel fixture 2022-08-06 19:29:31 +02:00
Stéphane Bidoul 1800635e4c
Fix tests with indented errors and warning 2022-08-05 09:35:00 +02:00
Stéphane Bidoul 58d8dc28cb
Do not fail tests on our own deprecation warnings 2022-08-05 09:35:00 +02:00
Stéphane Bidoul b423c07ff4
Detected indented ERROR and WARNING messages in tests 2022-08-05 09:35:00 +02:00
Paul Moore ebe491a82a Get rid of the --python python/py shortcuts 2022-08-01 10:54:20 +01:00
Paul Moore 0d6fadac6c Merge branch 'main' into python_option 2022-08-01 09:43:55 +01:00
Paul Moore b5afdd6048 Fix test to cater for packages leaked into venv 2022-07-30 16:37:58 +01:00
Paul Moore 01e122ed41 Add tests 2022-07-30 16:12:42 +01:00
Paul Moore ee6c7caabd Fix test_runner_work_in_environments_with_no_pip to work under --use-zipapp 2022-07-28 11:57:26 +01:00
Paul Moore 662f940c96 Merge branch 'main' into test_zipapp 2022-07-28 10:51:04 +01:00
Klaas van Schelven 2ec5097281 Add a test for 'respect --no-index'
See #11276
2022-07-27 11:49:06 +02:00
Klaas van Schelven 80c3b9615f Textual: "locally built" rather than "built"
As per @sbidoul's remark
2022-07-26 08:16:49 +02:00
Klaas van Schelven d57c5dd1ee Fixed the tests 2022-07-25 15:11:54 +02:00
Stéphane Bidoul 3f5436cf3d
Use installer instead of setuptools in test suite
Instead of using a private setuptools api to
install common wheels in "editable" mode,
use 'installer' together with a .pth.
2022-07-23 16:22:02 +02:00
Klaas van Schelven 5d7a1a68c7 Respect --no-index from the requirements file
See #11276

SearchScope was extended with an extra parameter to be able to pass-on the
value of no_index as we do with the other parameters. This allows us to respect
its value regardless of the order in which options are evaluated.
2022-07-20 15:55:17 +02:00
Tzu-ping Chung b1a01ef762
Merge pull request #11265 from finnagin/main 2022-07-19 15:53:00 +08:00
Finn Womack 48bcb0a4cc
reformat to pass pre-commit check 2022-07-18 12:30:17 -07:00
finnagin a7c1fe3bff Remove utc fixture from tests 2022-07-18 12:20:56 -07:00
Finn Womack 0c574f7290
Remove time import 2022-07-18 11:58:51 -07:00
Finn Womack 246fef1914
Remove utc fixture 2022-07-18 11:44:18 -07:00
Stéphane Bidoul a7a35dc20d
Merge pull request #11245 from sbidoul/pip-inspect-sbi
Add pip inspect command
2022-07-18 08:10:07 +02:00
Stéphane Bidoul 909be0d786
Merge pull request #11259 from sbidoul/drop-html5lib
Drop html5lib
2022-07-16 20:04:49 +02:00
Stéphane Bidoul 6d02fe2410
Merge pull request #11262 from pradyunsg/reuse-environment-runner-sccript
Move `__pip-runner__` script into a module
2022-07-16 19:50:03 +02:00
Stéphane Bidoul bb2a3d7410
Remove the html5lib deprecated feature flag. 2022-07-16 19:37:11 +02:00
Donald Stufft c1b50e1f4d Add a test for parsing links from JSON 2022-07-15 17:55:15 -04:00
Donald Stufft 68836d479f fix number of calls 2022-07-15 17:22:46 -04:00
Donald Stufft 7cb5aae880 fix a stray ' 2022-07-15 17:22:46 -04:00
Donald Stufft 6f9ccfc136 Fix link hashes 2022-07-15 17:22:46 -04:00
Donald Stufft d67cac3c13 formatting 2022-07-15 17:22:46 -04:00
Donald Stufft 799c88f13d Update some tests to work again 2022-07-15 17:22:46 -04:00
Donald Stufft 9c98346df9 Add new accept headers 2022-07-15 17:22:46 -04:00
Donald Stufft 21a99e4b87 Update tests to use new names 2022-07-15 17:22:46 -04:00
Donald Stufft 55192a1674 Fix tests 2022-07-15 17:22:46 -04:00
Finn Womack 61862a3b3c
Update test_logging.py for non-utc windows env 2022-07-15 14:00:57 -07:00
Finn Womack 6c822e6224
Update fixed_time patch for non-utc windows env 2022-07-15 13:59:02 -07:00
Stéphane Bidoul a7df613b78
inspect: add experimental status warning 2022-07-15 14:08:38 +02:00
Stéphane Bidoul 585136494e
Add pip inspect command 2022-07-15 14:08:38 +02:00
Pradyun Gedam 470b217e8c
Add a test that the runner script works in environments without pip
This ensures that the runner script can be used in environments where
pip is not installed.
2022-07-15 12:22:08 +01:00
Stéphane Bidoul d830c96403
Merge pull request #10771 from sbidoul/install-report-sbi
Installation/resolution report (aka pip install --dry-run --report)
2022-07-15 12:29:06 +02:00
Stéphane Bidoul 074c6b5cad
install report: added experimental status warning 2022-07-15 11:08:56 +02:00
Stéphane Bidoul e41b13424e
install report: use array instead of dict for install field 2022-07-15 11:08:56 +02:00
Tzu-ping Chung 534262d1d6
Merge pull request #11241 from pradyunsg/drop-backtrack-on-build-failures 2022-07-15 16:34:10 +08:00
Pradyun Gedam 8bebea801d
Remove `--use-deprecated=backtrack-on-build-failures`
This flag is due for removal, in pip 22.2.
2022-07-15 08:27:23 +01:00
Paul Moore ea2318fbf9 Minor zipapp-related fixes and skips for some tests 2022-07-12 10:12:17 +01:00
Paul Moore c7e7e426cb Apply black 2022-07-12 09:02:11 +01:00
Paul Moore b84e5f3d99 Actually build the zipapp 2022-07-11 23:52:44 +01:00
Paul Moore 9a51fc8e0c Make the zipapp in a fixture 2022-07-11 20:01:26 +01:00
Paul Moore ef999f4c76 Ignore temporary extracted copies of cacert.pem when testing with a zipapp 2022-07-11 17:18:21 +01:00
Paul Moore a57668ef12 Add an option to the test suite to specify a zipapp to test 2022-07-11 16:26:24 +01:00
Stéphane Bidoul f66b3e8d01
Merge pull request #11195 from pradyunsg/distutils-replace-fancygetopt-with-getopt
Replace `distutils.fancy_getopt` with `getopt`
2022-07-10 13:18:33 +02:00
Stéphane Bidoul 99818e1e9a
Merge pull request #10692 from t20100/fix-install-pre
Fix `pip install --pre` for packages with dependencies defined in `pyproject.toml` and `setup.py`
2022-07-10 13:17:57 +02:00
Pradyun Gedam 8cbb89b6cc
Replace `distutils.fancy_getopt` with `getopt`
This eliminates one location where distutils may be imported on
Python 3.12+, by replacing the logic with mostly equivalent logic.
2022-07-08 17:14:01 +01:00
Stéphane Bidoul 7fdff17543
install report: add suport for stdout output 2022-07-05 10:05:57 +02:00
Stéphane Bidoul d32a62b3df
Use canonical names as keys in installation report 2022-07-05 10:05:57 +02:00
Stéphane Bidoul 2c84a1c16d
Add requested_extras to installation report 2022-07-05 10:05:57 +02:00
Stéphane Bidoul d6685d09cf
Test that the install report has requires_dist
This is important for legacy setuptools distributions that do not
have Requires-Dist in PKG-INFO.
2022-07-05 10:05:57 +02:00
Stéphane Bidoul e37178775b
Add --report option to pip install 2022-07-05 10:05:57 +02:00
Tzu-ping Chung 6eaa8e9135 Don't consider dist-info in a wheel as "installed"
This applies to the new importlib.metadata backend. The legacy
pkg_resources backend already does this (albeit accidentally).

A package inside a wheel is not guaranteed to "work" when directly
imported, so we should not treat it as an installed distribution.
2022-06-30 21:49:39 +08:00
Stéphane Bidoul f1a5cfce16
Merge pull request #11186 from venthur/fix_spelling
fixed some spelling mistakes
2022-06-26 12:34:26 +02:00
Stéphane Bidoul 340054a6bd
Merge pull request #11052 from SpecLad/fix-script-record-hash
Update the RECORD entry when rewriting the shebang line in a script
2022-06-26 12:20:13 +02:00
Stéphane Bidoul 65680b4bb1
Merge pull request #11096 from sbidoul/install-dry-run-sbi
Add --dry-run option to pip install
2022-06-26 11:41:48 +02:00
Роман Донченко e4cd6da6e5 Update the RECORD entry when rewriting the shebang line in a script
The code to do this already exists in `get_csv_rows_for_installed`, but it's
broken due to inconsistent usage of the `_fs_to_record_path` function. When
we build the dictionary of installed files, we call it with a base
directory, while when build the set of modified files, we call it without a
base directory. As a result, the values of `installed` do not match the
elements of `changed`, and `get_csv_rows_for_installed` fails to identify
the rows that should be updated.

Fix this by ensuring that `_fs_to_record_path` is always called with a base
directory. `_record_to_fs_path` also needs a a base directory parameter to
be able to transform the path back into an absolute path, so add one.
2022-06-25 01:27:08 +03:00
Stéphane Bidoul 25dd00571a
Merge pull request #11022 from SpecLad/download-propagate-pep517
pip download: make sure that --use-pep517 is propagated to the dependencies
2022-06-24 19:42:58 +02:00
Stéphane Bidoul ae67371450
Rename json_metadata to metadata_dict 2022-06-23 19:35:45 +02:00
Stéphane Bidoul aac65f0b86
Add json_metadata 2022-06-23 19:35:45 +02:00
Stéphane Bidoul 3726f71720
Add a --dry-run option to pip install 2022-06-23 19:33:18 +02:00
Stéphane Bidoul 422719863a
Merge pull request #11163 from sbidoul/ref-metadata-sbi
Refactor `BaseDistribution.metadata` property to make sure it has `Requires-Dist` and `Provides-Extra`
2022-06-23 19:31:27 +02:00
q0w c8c88ce520 Adapt tests 2022-06-23 19:20:18 +03:00
q0w 3662f5e0df Disallow use of script fixture in unit tests 2022-06-23 17:42:50 +03:00
q0w 49657d8c94 Use os.fspath 2022-06-21 19:35:22 +03:00
q0w 3181063f94 Convert to str shutil.move src arg for py<=39
https://github.com/python/cpython/issues/76870
2022-06-15 22:07:15 +03:00
Роман Донченко 28d7730087 test_download_use_pep517_propagation: use a different approach
The approach it uses now doesn't work anymore due to 452d7da8.
The installation of `fake_dep` now succeeds whether or not `setuptools`
is installed in the test environment.

Use a different approach instead: try to import `pip` in the `setup.py`
script. If it succeeds, then we are not running in an isolated environment,
and therefore PEP 517 isn't being used.

To add this custom logic to `setup.py`, add a new argument to
`create_basic_sdist_for_package`. Note that to make this work, I had to
switch from f-strings to `str.format`, since the `dedent` has to happen
before formatting.
2022-06-15 18:11:07 +03:00
Роман Донченко 698784796b pip download: make sure that --use-pep517 is propagated to the dependencies 2022-06-15 18:10:22 +03:00
Bastian Venthur 5da767c946 fixed some spelling mistakes
that's all :)
2022-06-14 21:24:58 +02:00
Stéphane Bidoul a814290ff4 Make sure metadata has Requires-Dist and Provides-Extra
egg-info distributions may not have the Requires-Dist and Provides-Extra
fields in their metadata. For consistency and to provide an
unsurprising metadata property, we emulate it by reading requires.txt.
2022-06-12 19:40:42 +02:00
Tzu-ping Chung ad1b2d31d0 Use samefile instead == to compare to SRC_DIR
This resolves a behavioral different between Python 3.7 and 3.8+, where
a == comparison would incorrectly compare Path against str and cause
incorrect results.
2022-06-12 12:19:14 +08:00
Tzu-ping Chung 42359a9605 Migrate tests to use pathlib.Path
The pip-specific Path implementation has been removed, and all its
usages replaced by pathlib.Path. The tmpdir and tmpdir_factory fixtures
are also removed, and all usages are replaced by tmp_path and
tmp_path_factory, which use pathlib.Path.

The pip() function now also accepts pathlib.Path so we don't need to put
str() everywhere. Path arguments are coerced with os.fspath() into str.
2022-06-08 19:58:46 +08:00
Stéphane Bidoul e58a8a591b
Merge pull request #11137 from sbidoul/download-info-sbi
Add download_info: DirectUrl to InstallRequirement
2022-06-01 08:21:12 +02:00
Stéphane Bidoul 05d2b85d4a Add unit tests for cache origin.json... and fix a bug 2022-05-30 18:36:48 +02:00
Tzu-ping Chung b91dbde21f
Merge pull request #11082 from uranusjr/truststore 2022-05-30 02:32:49 -04:00
Pradyun Gedam 90096394c3
Merge pull request #11134 from q0w/revert-10998-handle-netrc
Revert "Prioritize url credentials over netrc"
2022-05-25 12:38:57 +05:30
Stéphane Bidoul e7449498d3
Record origin url in wheel cache 2022-05-22 22:46:35 +02:00
Stéphane Bidoul c6baa7514a
Add download_info to InstallRequirement 2022-05-22 22:46:35 +02:00
Pradyun Gedam f20ab575b9
Merge pull request #11124 from uranusjr/use-contain-for-checking
Allow pre-release to satisfy build requirements
2022-05-16 15:05:40 +01:00
Tzu-ping Chung f7c05a5124 Allow pre-release to satisfy build requirements 2022-05-16 07:40:00 -04:00
Pradyun Gedam 30af8074bf
Merge pull request #11117 from q0w/opt-check
Opt to check build dependencies
2022-05-14 21:55:18 +01:00
q0w e20aab9901 Revert "Merge pull request #10998 from q0w/handle-netrc"
This reverts commit eacc739320, reversing
changes made to d5e1eeecc8.
2022-05-14 20:48:29 +03:00
Pradyun Gedam d673aa1428
Move `RequirementSet.add_requirement` into `LegacyResolver`
This was the only call-site for this method and, realistically, it is
highly coupled with the legacy resolver's dependency resolution
strategy/approach; so it makes sense for this code to live as part of
the resolver, rather than the container object the various resolvers.
2022-05-13 18:59:53 +01:00
q0w 3166157e40 Opt to check build dependencies 2022-05-13 03:05:55 +03:00
Pradyun Gedam 611e9253ff
Filter out build requirements that require an extra to be used
There is no mechanism provided for build requirements to have extras.

It should be acceptable to enforce that any "optional" packages
that are supposed to be conditionally installed based on the presence of
an extra should not be installed in a build environment.
2022-05-12 01:04:11 +01:00
Pradyun Gedam cb24fb4052
Merge pull request #11085 from pypa/revert-10962-fix-hashes 2022-05-09 08:38:51 +01:00
Pradyun Gedam cf3696a81b
Merge pull request #11080 from sbidoul/requested-with-constraints
Fix REQUESTED in presence of URL constraints
2022-05-06 18:15:35 +01:00
Tzu-ping Chung a020e8c35c Add very simple tests to ensure feature is enabled 2022-05-03 11:04:05 -06:00
Pradyun Gedam 2d028e140e Revert "Filter available distributions using hash declarations from constraints files (#10962)"
This reverts commit 0c284520c6.
2022-05-03 17:50:21 +01:00
Stéphane Bidoul 3c62d1cbce
Add failing test for REQUESTED and URL constraints 2022-05-01 19:39:17 +02:00
wim glenn 32f642d123 provide a better error message for "pip config get index-url" 2022-04-29 22:51:16 -05:00
wim glenn af20d93d71 placate pre-commit 2022-04-29 22:38:38 -05:00
wim glenn 4b35763d5f ``pip config`` normalizes names, converting underscores into dashes. closes #9330 2022-04-29 22:38:38 -05:00
Paul Moore cdeb8f9e63
Merge pull request #11059 from pfmoore/config_settings
Add a UI to set config settings for PEP 517 backends
2022-04-29 12:58:32 +01:00
Pradyun Gedam 7eb75413e8
Merge pull request #10959 from pradyunsg/better-upgrade-warning
Improve the presentation style of the pip upgrade prompt
2022-04-28 18:26:43 +01:00
Pradyun Gedam 7164b1af50
Merge pull request #10827 from q0w/project-urls
Include Project-URLs in `pip show -v` output
2022-04-23 21:39:51 +01:00
Paul Moore 437bb67900 Rename test file pep517 -> pyproject 2022-04-23 14:45:59 +01:00
Paul Moore 4db45851b6 Explicitly test installs (and fix a bug found by those tests!) 2022-04-23 13:14:22 +01:00
Pradyun Gedam 26d8441100
Pacify linters by passing `logging.DEBUG` instead of `"DEBUG"` 2022-04-23 12:30:42 +01:00
Pradyun Gedam ca84a83633
Rework the tests for `self_check_outdated` to do less mocking
This makes the tests more reliable and easier to reason about. This also
adds a few more cases under the test conditions.
2022-04-23 12:30:42 +01:00
Pradyun Gedam 4f35572ae7 Refactor the logic in self_outdated_check
- Move the lookup within `selfcheck/*.json` files into a method on
  `SelfCheckState`.
- Factor out `PackageFinder` interaction into a separate function.
- Rename variables to more clearly reflect what they're for.

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>
2022-04-22 16:36:29 +01:00
Pradyun Gedam c4470ba3bd Rename `[present-diagnostic]` to `[present-rich]`
This makes it more reasonable to use a rich renderable for regular
logging messages, instead of only using it for the diagnostic error
messages.
2022-04-22 16:36:29 +01:00
Pradyun Gedam b68de249d1 Remove a no-longer-needed `type: ignore` comment 2022-04-22 16:13:35 +01:00
Paul Moore 1401dbae56 Add an end-to-end test for config settings 2022-04-21 18:30:48 +01:00
Paul Moore d9c4ebf7be Add tests for basic --config-settings parsing 2022-04-21 18:30:48 +01:00
Tzu-ping Chung 8133d83929
Merge pull request #11030 from uranusjr/build-env-req-check-evaluate-marker 2022-04-16 19:46:23 +08:00
Tzu-ping Chung 233db7c31b Skip conditional build req without matching marker 2022-04-16 16:02:15 +08:00
Pradyun Gedam c6e274e7fd
Merge pull request #10709 from uranusjr/metadata-importlib-backend 2022-04-15 12:49:32 +01:00
Frost Ming 6a1ed5c0f4
Add completion script for powershell (#9025) 2022-04-15 09:32:42 +01:00
Tzu-ping Chung 8073f65c14 Properly normalize and handle linked dist 2022-04-12 03:33:18 +08:00
Tzu-ping Chung 17355f8d47 Unnormalized metadata version works now! 2022-04-12 03:33:18 +08:00
Tzu-ping Chung 675de98f42 Better test setup and teardown with fixture 2022-04-12 03:31:50 +08:00
Tzu-ping Chung e3952f8357 Fix unit test to check against the correct backend 2022-04-12 03:26:12 +08:00
Pradyun Gedam e679df4051
Merge pull request #11001 from pradyunsg/remove-out-of-tree
Drop out-of-tree/in-tree build transition flags
2022-04-09 16:02:40 +01:00
Pradyun Gedam eacc739320
Merge pull request #10998 from q0w/handle-netrc 2022-04-08 13:09:36 +01:00
Pradyun Gedam 428e886ad6
Drop out-of-tree/in-tree build transition flags
These were intended to help users transition when the default behaviour
changed to no longer perform out-of-tree builds. The transition is now
considered complete.
2022-04-08 12:20:36 +01:00
q0w b953f9aaa7 Use explicit wrong credentials 2022-04-07 11:15:48 +03:00
Henrich Hartzer 2cfe36dc9e Update pre-commit hooks
Co-Authored-By: q0w <43147888+q0w@users.noreply.github.com>
2022-04-04 16:02:02 +03:00
q0w ee67cf714b Prioritize url credentials over netrc 2022-03-29 20:27:24 +03:00
Pradyun Gedam de1c798243
Rename all {req -> build}_tracker arguments/variables 2022-03-26 12:09:32 +00:00
Pradyun Gedam e5542dc024
Move `BuildTracker` to `operations.build.build_tracker` 2022-03-26 12:09:32 +00:00
Pradyun Gedam 62516b8ad3
Rename PIP_{REQ -> BUILD}_TRACKER 2022-03-26 12:09:32 +00:00
Pradyun Gedam cbfcbd2d94
Rename get_{requirement -> build}_tracker 2022-03-26 12:09:32 +00:00
q0w db71def50f replace git scheme with https 2022-03-19 14:17:05 +03:00
Pradyun Gedam 25861e564d
Merge pull request #10560 from pradyunsg/fix-protect-pip-on-windows
Fix the protect-pip-on-windows logic
2022-03-18 12:32:18 +00:00
q0w 0c284520c6
Filter available distributions using hash declarations from constraints files (#10962) 2022-03-16 07:43:06 +00:00
Thiago fffd5ac422
Pass the session's proxies property to request (#10680) 2022-03-11 15:04:21 +00:00
Tzu-ping Chung d61b539353 More structured link evaluation result
A new enum class is implemented for the link evaluator to use instead
of a simple boolean to better distinguish between various evaluation
errors. This allows the caller to better distinguish error sources with
a structured check instead of fragile error string comparison.
2022-03-10 20:41:26 +08:00
Tzu-ping Chung 2e5e9e54bc
Merge branch 'main' into requires-python 2022-03-10 15:41:05 +08:00
q0w a4f7508592
Drop the doctype check (#10906)
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2022-02-27 12:39:06 +00:00
Pradyun Gedam afda75625c
Present the result, when the script passes unexpectedly 2022-02-26 12:32:53 +00:00
Pradyun Gedam ce30e6c532
Fix the protect-pip-on-windows logic
The names for the executables does not contain a `.exe` suffix anymore.
2022-02-26 12:32:52 +00:00
Pradyun Gedam 201135fd2e Normalise name to match newer flit behaviour 2022-02-25 12:08:44 +00:00
q0w 0c6d20f8c7
Validate build deps when `--no-build-isolation` is passed (#10886)
This can help catch issues in setting up the build environment, helping
ensure that packages get built according to their declared metadata.
2022-02-18 14:58:40 +00:00
Shivansh-007 5086e57997
Add test for failed parse log with invalid `git version` 2022-02-18 18:32:24 +05:30
Yusuke Hayashi d854b1e20d
fix: spelling mistakes and typos 2022-02-17 18:05:59 +09:00
Tzu-ping Chung ec8edbf5df
Merge pull request #10819 from q0w/file404 2022-02-03 20:37:38 +08:00
q0w 7f6a9cad22 Add test 2022-02-03 14:57:21 +03:00
Pradyun Gedam ff8dbb458a
Merge pull request #10867 from mauritsvanrees/maurits-topoligical-weights-requirements-only-issue-10851 2022-02-03 08:20:28 +00:00
q0w 8749d0baad Add docstring 2022-02-02 21:11:23 +03:00
Pradyun Gedam 4f0ce011fe
Switch to using `html.parser` even when the doctype isn't proper
This ensures that we handle html5lib parsing as non-default deprecated
behaviour.
2022-02-01 17:58:34 +00:00
Maurits van Rees b830de6596
test_resolver: extra tests for cycles plus restricted keys. 2022-02-01 18:02:35 +01:00
Pradyun Gedam ef7e0c34de
Avoid setuptools 60.6.0
It has a bug that breaks our test suite, and the relevant bug is being
investigated at the moment.
2022-02-01 09:04:00 +00:00
Maurits van Rees 63b19afac2
Fix assertion error when determining installation order.
Fixes https://github.com/pypa/pip/issues/10851
2022-01-31 20:18:37 +01:00
Pradyun Gedam a78845ab33
Pacify functional tests that don't start with `<!doctype html>` 2022-01-30 21:57:22 +00:00
Pradyun Gedam c01b0b2729
Gracefully fallback to html5lib for parsing non-compliant index pages
This reworks the HTML parsing logic, to gracefully use `html5lib` on
non-compliant HTML 5 documents. This warning softens the failure mode
for users who are using commercial package index solutions that do not
follow the requisite standards and serve malformed HTML documents.
2022-01-30 21:21:11 +00:00
Pradyun Gedam 9a9c1def6e
Merge pull request #10846 from pradyunsg/fix-html5lib-fallback 2022-01-30 18:22:14 +00:00
Pradyun Gedam 80609e8c20
Properly yield results from `html5lib` parsing
The earlier variant _returned_ an iterable object from a generator. This
did not properly handle the fallback, resulting in the html5lib code
path not being executed.
2022-01-30 16:54:45 +00:00
Pradyun Gedam f13104abb2
Accept lowercase doctype declarations 2022-01-30 13:11:13 +00:00
Jon Dufresne bf5f4008e7
Replace vendored html5lib with stdlib
The html5lib library isn't strictly required as the same functionality
can be achieved through the stdlib html.parser module.

The html5lib is one of the largest uses of the six library. By dropping
this unnecessary dependency, the pip project is closer to dropping the
six library.

Additionally, html5lib maintenance has slowed down and the project has
rejected pull requests to drop Python 2 support.

For now, the html5lib code remains, but is gated behind a command
line option: `--use-deprecated=html5lib`. After a sufficient amount of
time has passed without any reported bugs, the vendored library and this
flag can be removed completely.
2022-01-28 06:45:57 +00:00
Pradyun Gedam 9d0db8839f
Add `--use-deprecated=backtrack-on-build-failures`
This serves as an opt-out from build failures causing the entire
installation to abort.
2022-01-27 18:11:05 +00:00
Pradyun Gedam ca78aba456
Test that the resolver skips packages, as instructed by constraints 2022-01-27 18:11:05 +00:00
Pradyun Gedam 8eeee22304
Abort immediately on metadata generation failure instead of backtracking
This behaviour is more forgiving when a source distribution cannot be
installed (eg: due to missing build dependencies or platform
incompatibility) and favours early eager failures instead of trying to
ensure that a package is installed regardless of the amount of effort it
takes.
2022-01-27 18:11:02 +00:00
Pradyun Gedam 1cda23bd6b
Merge pull request #10795 from pradyunsg/better-subprocess-errors 2022-01-27 07:09:18 +00:00
Andy Freeland e752b1a26b
Include files/folders in `pip install` autocomplete (#10682) 2022-01-25 18:27:09 +00:00
q0w 24bee84f44 Show Project-URLs 2022-01-25 18:26:06 +03:00
James Gerity 5c24a798b8
Change VCS tooling verbosity along with pip's verbosity (#9639)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2022-01-25 08:54:02 +00:00
Pradyun Gedam 723b2df7b4
Double-escape paths on Windows
This helps ensure that they aren't improperly handled due to the newer
string-in-string design for the setuptools invocation script.
2022-01-25 08:24:31 +00:00
Pradyun Gedam 94668c6df6
Pacify unit tests 2022-01-25 01:38:23 +00:00
Pradyun Gedam deb2d754e7
Tweak the chattymodule to not leak potentially information
I'd like to use this in screenshots, but the os.environ makes it a bit
tricky to do.
2022-01-25 01:38:23 +00:00
Pradyun Gedam a835e0a277
Prettify messages for discarding candidates due to issues
These are more pleasing colours and, more importantly, a clearer
presentation style of the package vs the error.
2022-01-25 01:38:23 +00:00
Pradyun Gedam 68e0bd46c8
Add an example setuptools-based package that always fails 2022-01-25 01:38:23 +00:00
Pradyun Gedam 1ee370637f
Add diagnostics to `InstallationSubprocessError`
This more clearly states where the error came from, presents it in a
more approachable format with context provided for what this error is
related to.
2022-01-25 01:38:22 +00:00
Pradyun Gedam 57198c6688
Use `logger.warning` instead of `warnings.warn`
This is more in line with the rest of our output presentation logic.
2022-01-25 01:38:22 +00:00
Pradyun Gedam 7a13f7c213
Improve our setuptools shim
Modernise the shim, to account for the Python 3.2+ support matrix.

This also presents clearer error messages on failures, the included
comment helps inform users about why this shim exists and the traceback
now explicitly mentions `<pip-setuptools-shim>` to make it clearer to
users that this shim exists.
2022-01-25 01:38:22 +00:00
Pradyun Gedam 531c991ef9
Require every `call_subprocess` call-site to pass `command_desc`
This serves as additional context that can be presented in error
messages.
2022-01-25 01:38:22 +00:00
Pradyun Gedam 42075efa61
Annotate an unannotated test 2022-01-25 01:32:34 +00:00
Pradyun Gedam 997c5a742b
Merge pull request #10625 from albertosottile/ignore_yanked 2022-01-24 23:47:54 +00:00
Pradyun Gedam ff8b9a167e
Mark `TestPipResult` as not having tests
This makes pytest stop warning about it.
2022-01-21 14:10:40 +00:00
Pradyun Gedam b82dfd1745
Restore colors in regular logging messages
Also, reflects that `--no-color` does not mean no-ansi-escapes but only
affects colour rules.
2021-12-12 13:11:36 +00:00
Pradyun Gedam e857d0f532
Properly handle newlines in diagnostic error tests
This is necessary to ensure that the output can be compared directly.
2021-12-12 13:11:36 +00:00