├── tests ├── __init__.py ├── unit │ ├── __init__.py │ ├── test_packaging.py │ ├── test_check.py │ ├── test_cmdoptions.py │ ├── test_vcs_mercurial.py │ └── test_network_utils.py ├── functional │ ├── __init__.py │ ├── test_requests.py │ ├── test_vcs_mercurial.py │ ├── test_vcs_bazaar.py │ ├── test_vcs_subversion.py │ ├── test_cli.py │ └── test_hash.py ├── data │ ├── packages │ │ ├── invalid.whl │ │ ├── gmpy-1.15.tar.gz │ │ ├── gmpy2-2.0.tar.gz │ │ ├── symlinks │ │ │ ├── doc │ │ │ │ └── intro │ │ │ ├── docs │ │ │ ├── symlinks │ │ │ │ └── __init__.py │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── duplicate-1.0.tar.gz │ │ ├── pkgwithmpkg-1.0.tar.gz │ │ ├── priority-1.0.tar.gz │ │ ├── BrokenEmitsUTF8 │ │ │ ├── broken.py │ │ │ └── setup.py │ │ ├── FSPkg │ │ │ ├── fspkg │ │ │ │ └── __init__.py │ │ │ └── setup.py │ │ ├── priority-1.0-py2.py3-none-any.whl │ │ ├── LocalExtras │ │ │ ├── localextras │ │ │ │ └── __init__.py │ │ │ ├── .gitignore │ │ │ └── setup.py │ │ ├── LocalExtras-0.0.2 │ │ │ ├── localextras │ │ │ │ └── __init__.py │ │ │ ├── .gitignore │ │ │ └── setup.py │ │ ├── pkgwithmpkg-1.0-py2.7-macosx10.7.mpkg.zip │ │ ├── LocalEnvironMarker │ │ │ ├── localenvironmarker │ │ │ │ └── __init__.py │ │ │ ├── .gitignore │ │ │ └── setup.py │ │ ├── requires_wheelbroken_upper │ │ │ ├── requires_wheelbroken_upper │ │ │ │ └── __init__.py │ │ │ └── setup.py │ │ ├── LineEndings │ │ │ └── setup.py │ │ ├── pep517_wrapper_buildsys │ │ │ ├── setup.py │ │ │ ├── setup.cfg │ │ │ ├── pyproject.toml │ │ │ └── mybuildsys.py │ │ ├── pep517_setup_and_pyproject │ │ │ ├── setup.py │ │ │ ├── setup.cfg │ │ │ └── pyproject.toml │ │ ├── test_tar.tgz │ │ ├── test_zip.zip │ │ ├── Upper-1.0.tar.gz │ │ ├── Upper-2.0.tar.gz │ │ ├── child-0.1.tar.gz │ │ ├── broken-0.1.tar.gz │ │ ├── parent-0.1.tar.gz │ │ ├── pep518-3.0.tar.gz │ │ ├── simple-1.0.tar.gz │ │ ├── simple-2.0.tar.gz │ │ ├── simple-3.0.tar.gz │ │ ├── simple2-1.0.tar.gz │ │ ├── simple2-2.0.tar.gz │ │ ├── simple2-3.0.tar.gz │ │ ├── source-1.0.tar.gz │ │ ├── INITools-0.2.tar.gz │ │ ├── argparse-1.2.1.tar.gz │ │ ├── distribute-0.7.3.zip │ │ ├── SetupPyLatin1 │ │ │ └── setup.py │ │ ├── broken-0.2broken.tar.gz │ │ ├── setuptools-0.9.6.tar.gz │ │ ├── virtualenv-1.10.tar.gz │ │ ├── virtualenv-1.9.1.tar.gz │ │ ├── wheelbroken-0.1.tar.gz │ │ ├── TopoRequires-0.0.1.tar.gz │ │ ├── TopoRequires2-0.0.1.tar.gz │ │ ├── TopoRequires3-0.0.1.tar.gz │ │ ├── TopoRequires4-0.0.1.tar.gz │ │ ├── brokenegginfo-0.1.tar.gz │ │ ├── pep518_forkbomb-235.tar.gz │ │ ├── require_simple-1.0.tar.gz │ │ ├── requiresupper-1.0.tar.gz │ │ ├── singlemodule-0.0.0.tar.gz │ │ ├── singlemodule-0.0.1.tar.gz │ │ ├── singlemodule-0.0.1.tar.xz │ │ ├── mypy-0.782-py3-none-any.whl │ │ ├── pip-test-package-0.1.tar.gz │ │ ├── singlemodule-0.0.1.tar.lzma │ │ ├── translationstring-1.1.tar.gz │ │ ├── wheelbrokenafter-0.1.tar.gz │ │ ├── meta-1.0-py2.py3-none-any.whl │ │ ├── pip-test-package-0.1.1.tar.gz │ │ ├── brokenwheel-1.0-py2.py3-none-any.whl │ │ ├── colander-0.9.9-py2.py3-none-any.whl │ │ ├── has.script-1.0-py2.py3-none-any.whl │ │ ├── requiresPaste │ │ │ ├── requiresPaste.py │ │ │ └── pyproject.toml │ │ ├── simple.dist-0.1-py1-none-invalid.whl │ │ ├── simple.dist-0.1-py2.py3-none-any.whl │ │ ├── simplewheel-1.0-py2.py3-none-any.whl │ │ ├── simplewheel-2.0-py2.py3-none-any.whl │ │ ├── compilewheel-1.0-py2.py3-none-any.whl │ │ ├── complex_dist-0.1-py2.py3-none-any.whl │ │ ├── pep518_twin_forkbombs_first-234.tar.gz │ │ ├── script.wheel1-0.1-py2.py3-none-any.whl │ │ ├── script.wheel2-0.1-py2.py3-none-any.whl │ │ ├── script.wheel3-0.1-py2.py3-none-any.whl │ │ ├── setuptools-0.9.8-py2.py3-none-any.whl │ │ ├── simplewheel-2.0-1-py2.py3-none-any.whl │ │ ├── SetupPyUTF8 │ │ │ └── setup.py │ │ ├── pep518_twin_forkbombs_second-238.tar.gz │ │ ├── pep518_with_extra_and_markers-1.0.tar.gz │ │ ├── prjwithdatafile-1.0-py2.py3-none-any.whl │ │ ├── requires_source-1.0-py2.py3-none-any.whl │ │ ├── script.wheel1a-0.1-py2.py3-none-any.whl │ │ ├── script.wheel2a-0.1-py2.py3-none-any.whl │ │ ├── simple_namespace-1.0-py2.py3-none-any.whl │ │ ├── simplewheel-2.0-py3-fakeabi-fakeplat.whl │ │ ├── requires_simple_extra-0.1-py2.py3-none-any.whl │ │ ├── console_scripts_uppercase-1.0-py2.py3-none-any.whl │ │ └── HackedEggInfo │ │ │ └── setup.py │ ├── completion_paths │ │ ├── README.txt │ │ ├── REPLAY │ │ │ └── video.mpeg │ │ ├── requirements.txt │ │ └── resources │ │ │ └── images │ │ │ └── icon.png │ ├── src │ │ ├── extension │ │ │ ├── extension.c │ │ │ └── setup.py │ │ ├── pep518-3.0 │ │ │ ├── setup.cfg │ │ │ ├── pep518.py │ │ │ ├── MANIFEST.in │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── simplewheel-1.0 │ │ │ ├── setup.cfg │ │ │ ├── simplewheel │ │ │ │ └── __init__.py │ │ │ └── setup.py │ │ ├── simplewheel-2.0 │ │ │ ├── setup.cfg │ │ │ ├── simplewheel │ │ │ │ └── __init__.py │ │ │ └── setup.py │ │ ├── pep518_forkbomb-235 │ │ │ ├── setup.cfg │ │ │ ├── pep518_forkbomb.py │ │ │ ├── MANIFEST.in │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── TopoRequires │ │ │ ├── toporequires │ │ │ │ └── __init__.py │ │ │ └── setup.py │ │ ├── pep518_missing_requires │ │ │ ├── pyproject.toml │ │ │ ├── pep518.py │ │ │ ├── MANIFEST.in │ │ │ └── setup.py │ │ ├── TopoRequires2 │ │ │ ├── toporequires2 │ │ │ │ └── __init__.py │ │ │ ├── setup.cfg.pending │ │ │ └── setup.py │ │ ├── TopoRequires3 │ │ │ ├── toporequires3 │ │ │ │ └── __init__.py │ │ │ ├── setup.cfg.pending │ │ │ └── setup.py │ │ ├── TopoRequires4 │ │ │ ├── toporequires4 │ │ │ │ └── __init__.py │ │ │ ├── setup.cfg.pending │ │ │ └── setup.py │ │ ├── pep518_twin_forkbombs_first-234 │ │ │ ├── setup.cfg │ │ │ ├── pep518_twin_forkbombs_first.py │ │ │ ├── MANIFEST.in │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── pep518_twin_forkbombs_second-238 │ │ │ ├── setup.cfg │ │ │ ├── pep518_twin_forkbombs_second.py │ │ │ ├── MANIFEST.in │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── pep518_with_extra_and_markers-1.0 │ │ │ ├── setup.cfg │ │ │ ├── MANIFEST.in │ │ │ ├── pep518_with_extra_and_markers.py │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── pep518_conflicting_requires │ │ │ ├── pep518.py │ │ │ ├── MANIFEST.in │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── pep518_invalid_build_system │ │ │ ├── pep518.py │ │ │ ├── MANIFEST.in │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── pep518_invalid_requires │ │ │ ├── pep518.py │ │ │ ├── MANIFEST.in │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── prjwithdatafile │ │ │ ├── prjwithdatafile │ │ │ │ ├── somemodule.py │ │ │ │ └── README.txt │ │ │ └── setup.py │ │ ├── requires_simple_extra │ │ │ ├── requires_simple_extra.py │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── simple_namespace │ │ │ ├── simple_namespace │ │ │ │ ├── __init__.py │ │ │ │ └── module │ │ │ │ │ └── __init__.py │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── requires_simple │ │ │ ├── requires_simple │ │ │ │ └── __init__.py │ │ │ └── setup.py │ │ ├── pep518_with_namespace_package-1.0 │ │ │ ├── pep518_with_namespace_package.py │ │ │ ├── setup.cfg │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── compilewheel │ │ │ ├── simple │ │ │ │ └── __init__.py │ │ │ ├── setup.py │ │ │ └── setup.cfg │ │ ├── pep517_setup_only │ │ │ └── setup.py │ │ ├── pep517_pyproject_only │ │ │ └── pyproject.toml │ │ ├── pep517_setup_and_pyproject │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── withpyproject │ │ │ ├── setup.py │ │ │ └── pyproject.toml │ │ ├── chattymodule │ │ │ ├── chattymodule.py │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── singlemodule │ │ │ ├── singlemodule.py │ │ │ ├── setup.py │ │ │ └── setup.cfg │ │ ├── requires_capitalized │ │ │ └── setup.py │ │ └── requires_requires_capitalized │ │ │ └── setup.py │ ├── packages2 │ │ └── duplicate-1.0.tar.gz │ ├── indexes │ │ ├── empty_with_pkg │ │ │ ├── index.html │ │ │ └── simple-1.0.tar.gz │ │ ├── in dex │ │ │ ├── README.txt │ │ │ └── simple │ │ │ │ └── index.html │ │ ├── dev │ │ │ └── bar │ │ │ │ └── index.html │ │ ├── simple │ │ │ └── simple │ │ │ │ └── index.html │ │ ├── pre │ │ │ └── bar │ │ │ │ └── index.html │ │ ├── README.txt │ │ ├── yanked │ │ │ └── simple │ │ │ │ └── index.html │ │ └── datarequire │ │ │ └── fakepackage │ │ │ └── index.html │ ├── backends │ │ ├── test_backend-0.1.tar.gz │ │ ├── dummy_backend-0.1-py2.py3-none-any.whl │ │ └── test_backend-0.1-py2.py3-none-any.whl │ ├── packages3 │ │ ├── dinner │ │ │ ├── Dinner-1.0.tar.gz │ │ │ ├── Dinner-2.0.tar.gz │ │ │ └── index.html │ │ ├── requiredinner │ │ │ ├── requiredinner-1.0.tar.gz │ │ │ └── index.html │ │ └── index.html │ └── reqfiles │ │ ├── supported_options2.txt │ │ └── README.txt └── lib │ ├── index.py │ ├── direct_url.py │ ├── compat.py │ └── options_helpers.py ├── news ├── 10064.trivial.rst ├── .gitignore ├── packaging.vendor.rst ├── resolvelib.vendor.rst ├── 10126.trivial.rst ├── 10034.feature.rst ├── 10043.bugfix.rst ├── 10004.trivial.rst ├── 10065.trivial.rst ├── 8931.bugfix.rst ├── 0d757310-0e1d-4887-9076-a1eb3c55d9fa.trivial.rst ├── 10018.trivial.rst ├── 7667.bugfix.rst ├── 8EB21BAE-9CD0-424E-AF3B-651960B50C93.trivial.rst ├── 9069.removal.rst ├── 9686.feature.rst ├── 9931.feature.rst ├── 10074.trivial.rst ├── 10094.trivial.rst ├── 10047.trivial.rst ├── 10071.feature.rst ├── 10138.trivial.rst ├── 10111.trivial.rst ├── 10124.trivial.rst ├── 10127.trivial.rst ├── 10125.trivial.rst ├── 9915.feature.rst ├── 9987.feature.rst ├── 10045.feature.rst ├── 10080.bugfix.rst ├── 9844.bugfix.rst ├── 9845.bugfix.rst ├── 10117.removal.rst ├── 9455.feature.rst ├── 7975.feature.rst ├── 10151.removal.rst ├── 9825.process.rst ├── 9204.bugfix.rst ├── 9925.feature.rst ├── 3931.bugfix.rst ├── 9822.bugfix.rst ├── 9450.feature.rst └── 8954.feature.rst ├── src └── pip │ ├── _vendor │ ├── tenacity │ │ ├── py.typed │ │ ├── compat.py │ │ └── before.py │ ├── packaging │ │ ├── py.typed │ │ ├── LICENSE │ │ ├── __init__.py │ │ └── __about__.py │ ├── resolvelib │ │ ├── py.typed │ │ ├── compat │ │ │ ├── __init__.py │ │ │ └── collections_abc.py │ │ ├── reporters.pyi │ │ ├── __init__.pyi │ │ ├── __init__.py │ │ ├── LICENSE │ │ └── structs.pyi │ ├── idna.pyi │ ├── urllib3 │ │ ├── contrib │ │ │ ├── __init__.py │ │ │ ├── _securetransport │ │ │ │ └── __init__.py │ │ │ └── _appengine_environ.py │ │ ├── packages │ │ │ ├── backports │ │ │ │ └── __init__.py │ │ │ ├── __init__.py │ │ │ └── ssl_match_hostname │ │ │ │ └── __init__.py │ │ ├── _version.py │ │ ├── util │ │ │ └── queue.py │ │ └── LICENSE.txt │ ├── certifi.pyi │ ├── chardet.pyi │ ├── chardet │ │ ├── cli │ │ │ └── __init__.py │ │ ├── metadata │ │ │ └── __init__.py │ │ └── version.py │ ├── distlib.pyi │ ├── distro.pyi │ ├── html5lib │ │ ├── filters │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ └── alphabeticalattributes.py │ │ ├── _trie │ │ │ ├── __init__.py │ │ │ └── _base.py │ │ ├── treeadapters │ │ │ └── __init__.py │ │ ├── LICENSE │ │ └── __init__.py │ ├── msgpack.pyi │ ├── pep517.pyi │ ├── tomli.pyi │ ├── urllib3.pyi │ ├── colorama.pyi │ ├── html5lib.pyi │ ├── packaging.pyi │ ├── progress.pyi │ ├── pyparsing.pyi │ ├── requests.pyi │ ├── six │ │ ├── __init__.pyi │ │ └── moves │ │ │ ├── __init__.pyi │ │ │ └── configparser.pyi │ ├── tenacity.pyi │ ├── cachecontrol.pyi │ ├── resolvelib.pyi │ ├── webencodings.pyi │ ├── msgpack │ │ ├── _version.py │ │ ├── COPYING │ │ └── exceptions.py │ ├── pkg_resources.pyi │ ├── tomli │ │ ├── py.typed │ │ ├── __init__.py │ │ └── LICENSE │ ├── idna │ │ ├── package_data.py │ │ ├── __init__.py │ │ └── compat.py │ ├── distlib │ │ ├── t32.exe │ │ ├── t64.exe │ │ ├── w32.exe │ │ ├── w64.exe │ │ ├── _backport │ │ │ ├── __init__.py │ │ │ └── misc.py │ │ └── __init__.py │ ├── certifi │ │ ├── __init__.py │ │ ├── __main__.py │ │ └── LICENSE │ ├── cachecontrol │ │ ├── caches │ │ │ ├── __init__.py │ │ │ └── redis_cache.py │ │ ├── __init__.py │ │ ├── LICENSE.txt │ │ ├── wrapper.py │ │ ├── compat.py │ │ └── cache.py │ ├── pep517 │ │ ├── __init__.py │ │ ├── in_process │ │ │ └── __init__.py │ │ ├── compat.py │ │ ├── LICENSE │ │ └── dirtools.py │ ├── colorama │ │ └── __init__.py │ ├── vendor.txt │ ├── requests │ │ ├── __version__.py │ │ ├── certs.py │ │ ├── packages.py │ │ ├── hooks.py │ │ └── _internal_utils.py │ ├── pkg_resources │ │ ├── py31compat.py │ │ └── LICENSE │ ├── progress │ │ └── LICENSE │ ├── pyparsing.LICENSE │ ├── six.LICENSE │ └── appdirs.LICENSE.txt │ ├── _internal │ ├── utils │ │ ├── __init__.py │ │ ├── datetime.py │ │ ├── filetypes.py │ │ ├── inject_securetransport.py │ │ ├── _log.py │ │ ├── entrypoints.py │ │ └── pkg_resources.py │ ├── operations │ │ ├── __init__.py │ │ ├── build │ │ │ ├── __init__.py │ │ │ ├── wheel.py │ │ │ └── metadata.py │ │ └── install │ │ │ └── __init__.py │ ├── resolution │ │ ├── __init__.py │ │ ├── legacy │ │ │ └── __init__.py │ │ ├── resolvelib │ │ │ └── __init__.py │ │ └── base.py │ ├── index │ │ └── __init__.py │ ├── network │ │ └── __init__.py │ ├── models │ │ ├── __init__.py │ │ ├── scheme.py │ │ ├── candidate.py │ │ └── index.py │ ├── cli │ │ ├── status_codes.py │ │ ├── __init__.py │ │ └── command_context.py │ ├── main.py │ ├── __init__.py │ ├── vcs │ │ └── __init__.py │ ├── distributions │ │ ├── installed.py │ │ ├── __init__.py │ │ └── wheel.py │ └── commands │ │ └── help.py │ ├── py.typed │ ├── __init__.py │ └── __main__.py ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE.md ├── lock.yml ├── triage-new-issues.yml ├── CONTRIBUTING.md ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature-request.md │ └── ~good-first-issue.md ├── no-response.yml └── FUNDING.yml ├── docs ├── html │ ├── development │ │ ├── vendoring-policy.rst │ │ ├── configuration.rst │ │ ├── architecture │ │ │ └── index.rst │ │ └── index.rst │ ├── copyright.rst │ ├── reference │ │ ├── index.rst │ │ ├── pip.rst │ │ ├── pip_hash.rst │ │ ├── pip_list.rst │ │ ├── pip_show.rst │ │ ├── pip_cache.rst │ │ ├── pip_check.rst │ │ ├── pip_debug.rst │ │ ├── pip_wheel.rst │ │ ├── pip_config.rst │ │ ├── pip_freeze.rst │ │ ├── pip_install.rst │ │ ├── pip_search.rst │ │ ├── pip_download.rst │ │ └── pip_uninstall.rst │ ├── installing.rst │ ├── quickstart.rst │ ├── news.rst │ ├── topics │ │ └── index.md │ └── cli │ │ ├── pip_cache.rst │ │ ├── pip_config.rst │ │ ├── pip_debug.rst │ │ ├── index.md │ │ └── pip_search.rst └── man │ ├── commands │ ├── hash.rst │ ├── help.rst │ ├── list.rst │ ├── show.rst │ ├── cache.rst │ ├── check.rst │ ├── wheel.rst │ ├── config.rst │ ├── freeze.rst │ ├── search.rst │ ├── install.rst │ ├── download.rst │ ├── uninstall.rst │ └── debug.rst │ └── index.rst ├── .readthedocs.yml ├── .gitattributes ├── tools ├── requirements │ ├── tests.txt │ ├── docs.txt │ └── tests-common_wheels.txt ├── vendoring │ └── patches │ │ └── tenacity.patch ├── tox_pip.py ├── news │ └── template.rst └── release │ └── check_version.py ├── .gitignore ├── MANIFEST.in └── LICENSE.txt /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /news/10064.trivial.rst: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/functional/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /news/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore 2 | -------------------------------------------------------------------------------- /src/pip/_vendor/tenacity/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/invalid.whl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_internal/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_vendor/packaging/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_vendor/resolvelib/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/completion_paths/README.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/gmpy-1.15.tar.gz: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/gmpy2-2.0.tar.gz: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/symlinks/doc/intro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/extension/extension.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/pep518-3.0/setup.cfg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @replit/devex 2 | 3 | -------------------------------------------------------------------------------- /src/pip/_internal/operations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_internal/resolution/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_vendor/idna.pyi: -------------------------------------------------------------------------------- 1 | from idna import * -------------------------------------------------------------------------------- /src/pip/_vendor/urllib3/contrib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/duplicate-1.0.tar.gz: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/pkgwithmpkg-1.0.tar.gz: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/priority-1.0.tar.gz: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages2/duplicate-1.0.tar.gz: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/simplewheel-1.0/setup.cfg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/simplewheel-2.0/setup.cfg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_internal/operations/build/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_internal/resolution/legacy/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_vendor/certifi.pyi: -------------------------------------------------------------------------------- 1 | from certifi import * -------------------------------------------------------------------------------- /src/pip/_vendor/chardet.pyi: -------------------------------------------------------------------------------- 1 | from chardet import * -------------------------------------------------------------------------------- /src/pip/_vendor/chardet/cli/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/pip/_vendor/chardet/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_vendor/distlib.pyi: -------------------------------------------------------------------------------- 1 | from distlib import * -------------------------------------------------------------------------------- /src/pip/_vendor/distro.pyi: -------------------------------------------------------------------------------- 1 | from distro import * -------------------------------------------------------------------------------- /src/pip/_vendor/html5lib/filters/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_vendor/msgpack.pyi: -------------------------------------------------------------------------------- 1 | from msgpack import * -------------------------------------------------------------------------------- /src/pip/_vendor/pep517.pyi: -------------------------------------------------------------------------------- 1 | from pep517 import * -------------------------------------------------------------------------------- /src/pip/_vendor/resolvelib/compat/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_vendor/tomli.pyi: -------------------------------------------------------------------------------- 1 | from tomli import * -------------------------------------------------------------------------------- /src/pip/_vendor/urllib3.pyi: -------------------------------------------------------------------------------- 1 | from urllib3 import * -------------------------------------------------------------------------------- /tests/data/completion_paths/REPLAY/video.mpeg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/completion_paths/requirements.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/indexes/empty_with_pkg/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/BrokenEmitsUTF8/broken.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/symlinks/docs: -------------------------------------------------------------------------------- 1 | IntxLNKdoc -------------------------------------------------------------------------------- /tests/data/src/pep518-3.0/pep518.py: -------------------------------------------------------------------------------- 1 | #dummy 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_forkbomb-235/setup.cfg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_internal/resolution/resolvelib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_vendor/colorama.pyi: -------------------------------------------------------------------------------- 1 | from colorama import * -------------------------------------------------------------------------------- /src/pip/_vendor/html5lib.pyi: -------------------------------------------------------------------------------- 1 | from html5lib import * -------------------------------------------------------------------------------- /src/pip/_vendor/packaging.pyi: -------------------------------------------------------------------------------- 1 | from packaging import * -------------------------------------------------------------------------------- /src/pip/_vendor/progress.pyi: -------------------------------------------------------------------------------- 1 | from progress import * -------------------------------------------------------------------------------- /src/pip/_vendor/pyparsing.pyi: -------------------------------------------------------------------------------- 1 | from pyparsing import * -------------------------------------------------------------------------------- /src/pip/_vendor/requests.pyi: -------------------------------------------------------------------------------- 1 | from requests import * -------------------------------------------------------------------------------- /src/pip/_vendor/six/__init__.pyi: -------------------------------------------------------------------------------- 1 | from six import * -------------------------------------------------------------------------------- /src/pip/_vendor/tenacity.pyi: -------------------------------------------------------------------------------- 1 | from tenacity import * -------------------------------------------------------------------------------- /tests/data/completion_paths/resources/images/icon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/FSPkg/fspkg/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /tests/data/packages/priority-1.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/TopoRequires/toporequires/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/pep518_forkbomb-235/pep518_forkbomb.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/pep518_missing_requires/pyproject.toml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /news/packaging.vendor.rst: -------------------------------------------------------------------------------- 1 | Upgrade packaging to 21.0 2 | -------------------------------------------------------------------------------- /src/pip/_vendor/cachecontrol.pyi: -------------------------------------------------------------------------------- 1 | from cachecontrol import * -------------------------------------------------------------------------------- /src/pip/_vendor/resolvelib.pyi: -------------------------------------------------------------------------------- 1 | from resolvelib import * -------------------------------------------------------------------------------- /src/pip/_vendor/urllib3/packages/backports/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_vendor/webencodings.pyi: -------------------------------------------------------------------------------- 1 | from webencodings import * -------------------------------------------------------------------------------- /tests/data/packages/LocalExtras/localextras/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/symlinks/symlinks/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /tests/data/src/TopoRequires2/toporequires2/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/TopoRequires3/toporequires3/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/TopoRequires4/toporequires4/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/pep518_twin_forkbombs_first-234/setup.cfg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/pep518_twin_forkbombs_second-238/setup.cfg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/pep518_with_extra_and_markers-1.0/setup.cfg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /news/resolvelib.vendor.rst: -------------------------------------------------------------------------------- 1 | Upgrade resolvelib to 0.7.1. 2 | -------------------------------------------------------------------------------- /src/pip/_vendor/msgpack/_version.py: -------------------------------------------------------------------------------- 1 | version = (1, 0, 2) 2 | -------------------------------------------------------------------------------- /src/pip/_vendor/pkg_resources.pyi: -------------------------------------------------------------------------------- 1 | from pkg_resources import * -------------------------------------------------------------------------------- /src/pip/_vendor/six/moves/__init__.pyi: -------------------------------------------------------------------------------- 1 | from six.moves import * -------------------------------------------------------------------------------- /src/pip/_vendor/tomli/py.typed: -------------------------------------------------------------------------------- 1 | # Marker file for PEP 561 2 | -------------------------------------------------------------------------------- /src/pip/_vendor/urllib3/contrib/_securetransport/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/LocalExtras-0.0.2/localextras/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/pkgwithmpkg-1.0-py2.7-macosx10.7.mpkg.zip: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/pep518_conflicting_requires/pep518.py: -------------------------------------------------------------------------------- 1 | #dummy 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_invalid_build_system/pep518.py: -------------------------------------------------------------------------------- 1 | #dummy 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_invalid_requires/pep518.py: -------------------------------------------------------------------------------- 1 | #dummy 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_missing_requires/pep518.py: -------------------------------------------------------------------------------- 1 | #dummy 2 | -------------------------------------------------------------------------------- /tests/data/src/prjwithdatafile/prjwithdatafile/somemodule.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/requires_simple_extra/requires_simple_extra.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/simple_namespace/simple_namespace/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pip/_vendor/idna/package_data.py: -------------------------------------------------------------------------------- 1 | __version__ = '3.1' 2 | 3 | -------------------------------------------------------------------------------- /tests/data/packages/LocalExtras/.gitignore: -------------------------------------------------------------------------------- 1 | /LocalExtras.egg-info 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518-3.0/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pyproject.toml 2 | -------------------------------------------------------------------------------- /tests/data/src/requires_simple/requires_simple/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /tests/data/src/simple_namespace/simple_namespace/module/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /news/10126.trivial.rst: -------------------------------------------------------------------------------- 1 | Use ``--color=yes`` to color pytest outputs. 2 | -------------------------------------------------------------------------------- /src/pip/_internal/index/__init__.py: -------------------------------------------------------------------------------- 1 | """Index interaction code 2 | """ 3 | -------------------------------------------------------------------------------- /tests/data/packages/LocalEnvironMarker/localenvironmarker/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/packages/symlinks/setup.cfg: -------------------------------------------------------------------------------- 1 | [egg_info] 2 | tag_build = dev 3 | -------------------------------------------------------------------------------- /tests/data/src/pep518_forkbomb-235/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pyproject.toml 2 | -------------------------------------------------------------------------------- /news/10034.feature.rst: -------------------------------------------------------------------------------- 1 | Support TOML v1.0.0 syntax in ``pyproject.toml``. 2 | -------------------------------------------------------------------------------- /news/10043.bugfix.rst: -------------------------------------------------------------------------------- 1 | Update vendored six to 1.16.0 and urllib3 to 1.26.5 2 | -------------------------------------------------------------------------------- /src/pip/_vendor/six/moves/configparser.pyi: -------------------------------------------------------------------------------- 1 | from six.moves.configparser import * -------------------------------------------------------------------------------- /tests/data/src/pep518_invalid_requires/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pyproject.toml 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_missing_requires/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pyproject.toml 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_twin_forkbombs_first-234/pep518_twin_forkbombs_first.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/requires_simple_extra/setup.cfg: -------------------------------------------------------------------------------- 1 | [wheel] 2 | universal=1 3 | -------------------------------------------------------------------------------- /tests/data/src/simple_namespace/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | -------------------------------------------------------------------------------- /tests/data/src/simplewheel-1.0/simplewheel/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = '1.0' 2 | -------------------------------------------------------------------------------- /tests/data/src/simplewheel-2.0/simplewheel/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = '2.0' 2 | -------------------------------------------------------------------------------- /news/10004.trivial.rst: -------------------------------------------------------------------------------- 1 | Annotate ``typing.List`` into ``tools.tox_pip.pip()`` 2 | -------------------------------------------------------------------------------- /news/10065.trivial.rst: -------------------------------------------------------------------------------- 1 | Fixed all the annotations from ``pip/_internal/cli``. 2 | -------------------------------------------------------------------------------- /news/8931.bugfix.rst: -------------------------------------------------------------------------------- 1 | Skip distutils configuration parsing on encoding errors. 2 | -------------------------------------------------------------------------------- /tests/data/packages/LocalEnvironMarker/.gitignore: -------------------------------------------------------------------------------- 1 | /LocalEnvironMarker.egg-info 2 | -------------------------------------------------------------------------------- /tests/data/packages/LocalExtras-0.0.2/.gitignore: -------------------------------------------------------------------------------- 1 | /LocalExtras-0.0.2.egg-info 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_conflicting_requires/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pyproject.toml 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_invalid_build_system/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pyproject.toml 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_twin_forkbombs_second-238/pep518_twin_forkbombs_second.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/pep518_with_namespace_package-1.0/pep518_with_namespace_package.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /news/0d757310-0e1d-4887-9076-a1eb3c55d9fa.trivial.rst: -------------------------------------------------------------------------------- 1 | Fix typos in several files. 2 | -------------------------------------------------------------------------------- /news/10018.trivial.rst: -------------------------------------------------------------------------------- 1 | Use annotations from the ``typing`` module on some functions. 2 | -------------------------------------------------------------------------------- /news/7667.bugfix.rst: -------------------------------------------------------------------------------- 1 | Fix extraction of files with utf-8 encoded paths from tars. 2 | -------------------------------------------------------------------------------- /news/8EB21BAE-9CD0-424E-AF3B-651960B50C93.trivial.rst: -------------------------------------------------------------------------------- 1 | mailmap: Clean up Git entries 2 | -------------------------------------------------------------------------------- /news/9069.removal.rst: -------------------------------------------------------------------------------- 1 | Remove deprecated ``--find-links`` option in ``pip freeze`` 2 | -------------------------------------------------------------------------------- /news/9686.feature.rst: -------------------------------------------------------------------------------- 1 | Make "yes" the default choice in ``pip uninstall``'s prompt. 2 | -------------------------------------------------------------------------------- /news/9931.feature.rst: -------------------------------------------------------------------------------- 1 | Suppress "not on PATH" warning when ``--prefix`` is given. 2 | -------------------------------------------------------------------------------- /tests/data/packages/requires_wheelbroken_upper/requires_wheelbroken_upper/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/src/compilewheel/simple/__init__.py: -------------------------------------------------------------------------------- 1 | def spam(gen): 2 | yield from gen 3 | -------------------------------------------------------------------------------- /tests/data/src/pep518_twin_forkbombs_first-234/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pyproject.toml 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_twin_forkbombs_second-238/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pyproject.toml 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_with_extra_and_markers-1.0/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pyproject.toml 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | * pip version: 2 | * Python version: 3 | * Operating system: 4 | -------------------------------------------------------------------------------- /news/10074.trivial.rst: -------------------------------------------------------------------------------- 1 | Fixed all the annotations from ``pip/_internal/distributions``. 2 | -------------------------------------------------------------------------------- /news/10094.trivial.rst: -------------------------------------------------------------------------------- 1 | Convert type hint commentaries into annotations on ``setup.py``. 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_with_extra_and_markers-1.0/pep518_with_extra_and_markers.py: -------------------------------------------------------------------------------- 1 | #dummy 2 | -------------------------------------------------------------------------------- /tests/data/src/pep518_with_namespace_package-1.0/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | -------------------------------------------------------------------------------- /docs/html/development/vendoring-policy.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../../src/pip/_vendor/README.rst 2 | -------------------------------------------------------------------------------- /news/10047.trivial.rst: -------------------------------------------------------------------------------- 1 | Convert type annotations into proper annotations in ``noxfile.py``. 2 | -------------------------------------------------------------------------------- /news/10071.feature.rst: -------------------------------------------------------------------------------- 1 | Change the encoding of log file from default text encoding to UTF-8. 2 | -------------------------------------------------------------------------------- /news/10138.trivial.rst: -------------------------------------------------------------------------------- 1 | Convert type commentaries to annotations on ``pip/_internal/models``. 2 | -------------------------------------------------------------------------------- /src/pip/_internal/network/__init__.py: -------------------------------------------------------------------------------- 1 | """Contains purely network-related utilities. 2 | """ 3 | -------------------------------------------------------------------------------- /src/pip/_vendor/idna/__init__.py: -------------------------------------------------------------------------------- 1 | from .package_data import __version__ 2 | from .core import * 3 | -------------------------------------------------------------------------------- /tests/data/packages/LineEndings/setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | 3 | setup() 4 | -------------------------------------------------------------------------------- /news/10111.trivial.rst: -------------------------------------------------------------------------------- 1 | Converted type commentaries into annotations in ``pip/_internal/index``. 2 | -------------------------------------------------------------------------------- /news/10124.trivial.rst: -------------------------------------------------------------------------------- 1 | Converted type commentaries into annotations in ``pip/_internal/metadata``. 2 | -------------------------------------------------------------------------------- /news/10127.trivial.rst: -------------------------------------------------------------------------------- 1 | Converted type commentaries into annotations in ``pip/_internal/locations``. 2 | -------------------------------------------------------------------------------- /tests/data/packages/pep517_wrapper_buildsys/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup() 4 | -------------------------------------------------------------------------------- /news/10125.trivial.rst: -------------------------------------------------------------------------------- 1 | Converted type commentaries into annotations in ``pip/_internal/resolution``. 2 | -------------------------------------------------------------------------------- /news/9915.feature.rst: -------------------------------------------------------------------------------- 1 | Add a special error message when users forget the ``-r`` flag when installing. 2 | -------------------------------------------------------------------------------- /news/9987.feature.rst: -------------------------------------------------------------------------------- 1 | Include ``rustc`` version in pip's ``User-Agent``, when the system has ``rustc``. 2 | -------------------------------------------------------------------------------- /src/pip/_internal/models/__init__.py: -------------------------------------------------------------------------------- 1 | """A package that contains models that represent entities. 2 | """ 3 | -------------------------------------------------------------------------------- /src/pip/_internal/operations/install/__init__.py: -------------------------------------------------------------------------------- 1 | """For modules related to installing packages. 2 | """ 3 | -------------------------------------------------------------------------------- /src/pip/_vendor/distlib/t32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/src/pip/_vendor/distlib/t32.exe -------------------------------------------------------------------------------- /src/pip/_vendor/distlib/t64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/src/pip/_vendor/distlib/t64.exe -------------------------------------------------------------------------------- /src/pip/_vendor/distlib/w32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/src/pip/_vendor/distlib/w32.exe -------------------------------------------------------------------------------- /src/pip/_vendor/distlib/w64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/src/pip/_vendor/distlib/w64.exe -------------------------------------------------------------------------------- /src/pip/_vendor/urllib3/_version.py: -------------------------------------------------------------------------------- 1 | # This file is protected via CODEOWNERS 2 | __version__ = "1.26.5" 3 | -------------------------------------------------------------------------------- /tests/data/packages/pep517_setup_and_pyproject/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup() 4 | -------------------------------------------------------------------------------- /news/10045.feature.rst: -------------------------------------------------------------------------------- 1 | Added a warning message for errors caused due to Long Paths being disabled on Windows. 2 | -------------------------------------------------------------------------------- /news/10080.bugfix.rst: -------------------------------------------------------------------------------- 1 | Correctly allow PEP 517 projects to be detected without warnings in ``pip freeze``. 2 | -------------------------------------------------------------------------------- /src/pip/_vendor/certifi/__init__.py: -------------------------------------------------------------------------------- 1 | from .core import contents, where 2 | 3 | __version__ = "2020.12.05" 4 | -------------------------------------------------------------------------------- /tests/data/packages/test_tar.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/test_tar.tgz -------------------------------------------------------------------------------- /tests/data/packages/test_zip.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/test_zip.zip -------------------------------------------------------------------------------- /tests/data/src/prjwithdatafile/prjwithdatafile/README.txt: -------------------------------------------------------------------------------- 1 | README 2 | ====== 3 | 4 | Test project file 5 | -------------------------------------------------------------------------------- /tests/data/packages/Upper-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/Upper-1.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/Upper-2.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/Upper-2.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/child-0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/child-0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/src/pep517_setup_only/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name="dummy", version="0.1") 4 | -------------------------------------------------------------------------------- /tests/data/src/pep518-3.0/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires=["simplewheel==2.0", "setuptools", "wheel"] 3 | -------------------------------------------------------------------------------- /tests/data/src/pep518_invalid_build_system/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | # This table is intentionally empty. 3 | -------------------------------------------------------------------------------- /tests/data/packages/broken-0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/broken-0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/parent-0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/parent-0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/pep517_wrapper_buildsys/setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = pep517-wrapper-buildsys 3 | version = 1.0 4 | -------------------------------------------------------------------------------- /tests/data/packages/pep518-3.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/pep518-3.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/simple-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simple-1.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/simple-2.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simple-2.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/simple-3.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simple-3.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/simple2-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simple2-1.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/simple2-2.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simple2-2.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/simple2-3.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simple2-3.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/source-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/source-1.0.tar.gz -------------------------------------------------------------------------------- /tests/data/src/pep517_pyproject_only/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["foo"] 3 | build-backend = "foo" 4 | -------------------------------------------------------------------------------- /tests/data/src/pep518_conflicting_requires/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools==1.0", "wheel"] 3 | -------------------------------------------------------------------------------- /tests/data/src/pep518_invalid_requires/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [1, 2, 3] # not a list of strings 3 | -------------------------------------------------------------------------------- /tests/data/packages/INITools-0.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/INITools-0.2.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/argparse-1.2.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/argparse-1.2.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/distribute-0.7.3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/distribute-0.7.3.zip -------------------------------------------------------------------------------- /tests/data/packages/pep517_setup_and_pyproject/setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = pep517-setup-and-pyproject 3 | version = 1.0 4 | -------------------------------------------------------------------------------- /tests/data/src/TopoRequires2/setup.cfg.pending: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = TopoRequires2 3 | install-requires = 4 | TopoRequires 5 | -------------------------------------------------------------------------------- /tests/data/src/TopoRequires3/setup.cfg.pending: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = TopoRequires3 3 | install-requires = 4 | TopoRequires 5 | -------------------------------------------------------------------------------- /tests/data/src/pep517_setup_and_pyproject/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["foo"] 3 | build-backend = "foo" 4 | -------------------------------------------------------------------------------- /tests/data/src/pep517_setup_and_pyproject/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name="dummy", version="0.1") 4 | -------------------------------------------------------------------------------- /tests/data/src/pep518_forkbomb-235/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel", "pep518_forkbomb"] 3 | -------------------------------------------------------------------------------- /tests/data/src/withpyproject/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name='withpyproject', version='0.0.1') 4 | -------------------------------------------------------------------------------- /tests/data/backends/test_backend-0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/backends/test_backend-0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/SetupPyLatin1/setup.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/SetupPyLatin1/setup.py -------------------------------------------------------------------------------- /tests/data/packages/broken-0.2broken.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/broken-0.2broken.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/setuptools-0.9.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/setuptools-0.9.6.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/virtualenv-1.10.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/virtualenv-1.10.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/virtualenv-1.9.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/virtualenv-1.9.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/wheelbroken-0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/wheelbroken-0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/TopoRequires-0.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/TopoRequires-0.0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/TopoRequires2-0.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/TopoRequires2-0.0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/TopoRequires3-0.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/TopoRequires3-0.0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/TopoRequires4-0.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/TopoRequires4-0.0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/brokenegginfo-0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/brokenegginfo-0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/pep518_forkbomb-235.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/pep518_forkbomb-235.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/require_simple-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/require_simple-1.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/requiresupper-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/requiresupper-1.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/singlemodule-0.0.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/singlemodule-0.0.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/singlemodule-0.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/singlemodule-0.0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/singlemodule-0.0.1.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/singlemodule-0.0.1.tar.xz -------------------------------------------------------------------------------- /tests/data/packages3/dinner/Dinner-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages3/dinner/Dinner-1.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages3/dinner/Dinner-2.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages3/dinner/Dinner-2.0.tar.gz -------------------------------------------------------------------------------- /news/9844.bugfix.rst: -------------------------------------------------------------------------------- 1 | Fix warnings about install scheme selection for Python framework builds 2 | distributed by Apple's Command Line Tools. 3 | -------------------------------------------------------------------------------- /src/pip/_vendor/cachecontrol/caches/__init__.py: -------------------------------------------------------------------------------- 1 | from .file_cache import FileCache # noqa 2 | from .redis_cache import RedisCache # noqa 3 | -------------------------------------------------------------------------------- /tests/data/packages/mypy-0.782-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/mypy-0.782-py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/pip-test-package-0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/pip-test-package-0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/singlemodule-0.0.1.tar.lzma: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/singlemodule-0.0.1.tar.lzma -------------------------------------------------------------------------------- /tests/data/packages/translationstring-1.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/translationstring-1.1.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/wheelbrokenafter-0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/wheelbrokenafter-0.1.tar.gz -------------------------------------------------------------------------------- /tests/data/indexes/empty_with_pkg/simple-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/indexes/empty_with_pkg/simple-1.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/meta-1.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/meta-1.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/pip-test-package-0.1.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/pip-test-package-0.1.1.tar.gz -------------------------------------------------------------------------------- /tests/data/src/pep518_twin_forkbombs_first-234/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel", "pep518_twin_forkbombs_second"] 3 | -------------------------------------------------------------------------------- /tests/data/src/pep518_twin_forkbombs_second-238/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel", "pep518_twin_forkbombs_first"] 3 | -------------------------------------------------------------------------------- /tests/data/src/withpyproject/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel"] 3 | 4 | # Note: pyproject.toml is always UTF-8 🤡 5 | -------------------------------------------------------------------------------- /news/9845.bugfix.rst: -------------------------------------------------------------------------------- 1 | Relax interpreter detection to quelch a location mismatch warning where PyPy 2 | is deliberately breaking backwards compatibility. 3 | -------------------------------------------------------------------------------- /tests/data/packages/brokenwheel-1.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/brokenwheel-1.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/colander-0.9.9-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/colander-0.9.9-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/has.script-1.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/has.script-1.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/pep517_setup_and_pyproject/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ "setuptools" ] 3 | build-backend = "setuptools.build_meta" 4 | -------------------------------------------------------------------------------- /tests/data/packages/requiresPaste/requiresPaste.py: -------------------------------------------------------------------------------- 1 | """Module requiring Paste to test dependencies download of pip wheel.""" 2 | 3 | __version__ = '3.1.4' 4 | -------------------------------------------------------------------------------- /tests/data/packages/simple.dist-0.1-py1-none-invalid.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simple.dist-0.1-py1-none-invalid.whl -------------------------------------------------------------------------------- /tests/data/packages/simple.dist-0.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simple.dist-0.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/simplewheel-1.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simplewheel-1.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/simplewheel-2.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simplewheel-2.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/backends/dummy_backend-0.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/backends/dummy_backend-0.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/backends/test_backend-0.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/backends/test_backend-0.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/indexes/in dex/README.txt: -------------------------------------------------------------------------------- 1 | This directory has the odd space in its name in order to test urlquoting and 2 | dequoting of file:// scheme index URLs. 3 | -------------------------------------------------------------------------------- /tests/data/packages/compilewheel-1.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/compilewheel-1.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/complex_dist-0.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/complex_dist-0.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/pep518_twin_forkbombs_first-234.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/pep518_twin_forkbombs_first-234.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/script.wheel1-0.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/script.wheel1-0.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/script.wheel2-0.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/script.wheel2-0.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/script.wheel3-0.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/script.wheel3-0.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/setuptools-0.9.8-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/setuptools-0.9.8-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/simplewheel-2.0-1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simplewheel-2.0-1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /news/10117.removal.rst: -------------------------------------------------------------------------------- 1 | Git version parsing is now done with regular expression to prepare for the 2 | pending upstream removal of non-PEP-440 version parsing logic. 3 | -------------------------------------------------------------------------------- /news/9455.feature.rst: -------------------------------------------------------------------------------- 1 | New resolver: The order of dependencies resolution has been tweaked to traverse 2 | the dependency graph in a more breadth-first approach. 3 | -------------------------------------------------------------------------------- /tests/data/packages/SetupPyUTF8/setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | 3 | setup(name="SetupPyUTF8", 4 | author="Saúl Ibarra Corretgé", 5 | ) 6 | -------------------------------------------------------------------------------- /tests/data/packages/pep518_twin_forkbombs_second-238.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/pep518_twin_forkbombs_second-238.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/pep518_with_extra_and_markers-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/pep518_with_extra_and_markers-1.0.tar.gz -------------------------------------------------------------------------------- /tests/data/packages/prjwithdatafile-1.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/prjwithdatafile-1.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/requires_source-1.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/requires_source-1.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/script.wheel1a-0.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/script.wheel1a-0.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/script.wheel2a-0.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/script.wheel2a-0.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/simple_namespace-1.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simple_namespace-1.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/simplewheel-2.0-py3-fakeabi-fakeplat.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/simplewheel-2.0-py3-fakeabi-fakeplat.whl -------------------------------------------------------------------------------- /tests/data/packages3/requiredinner/requiredinner-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages3/requiredinner/requiredinner-1.0.tar.gz -------------------------------------------------------------------------------- /tests/data/src/TopoRequires4/setup.cfg.pending: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = TopoRequires4 3 | install-requires = 4 | TopoRequires2 5 | TopoRequires 6 | TopoRequires3 7 | -------------------------------------------------------------------------------- /tests/data/src/chattymodule/chattymodule.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | """Entry point for the application script""" 3 | print("Call your main application code here") 4 | -------------------------------------------------------------------------------- /tests/data/src/singlemodule/singlemodule.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | """Entry point for the application script""" 3 | print("Call your main application code here") 4 | -------------------------------------------------------------------------------- /news/7975.feature.rst: -------------------------------------------------------------------------------- 1 | Add new subcommand ``pip index`` used to interact with indexes, and implement 2 | ``pip index version`` to list available versions of a package. 3 | -------------------------------------------------------------------------------- /src/pip/_vendor/html5lib/_trie/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from .py import Trie 4 | 5 | __all__ = ["Trie"] 6 | -------------------------------------------------------------------------------- /src/pip/_vendor/urllib3/packages/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import ssl_match_hostname 4 | 5 | __all__ = ("ssl_match_hostname",) 6 | -------------------------------------------------------------------------------- /tests/data/src/pep518_with_namespace_package-1.0/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools", 4 | "wheel", 5 | "simple_namespace", 6 | ] 7 | -------------------------------------------------------------------------------- /news/10151.removal.rst: -------------------------------------------------------------------------------- 1 | Re-enable the "Value for ... does not match" location warnings to field a new 2 | round of feedback for the ``distutils``-``sysconfig`` transition. 3 | -------------------------------------------------------------------------------- /src/pip/_internal/cli/status_codes.py: -------------------------------------------------------------------------------- 1 | SUCCESS = 0 2 | ERROR = 1 3 | UNKNOWN_ERROR = 2 4 | VIRTUALENV_NOT_FOUND = 3 5 | PREVIOUS_BUILD_DIR_ERROR = 4 6 | NO_MATCHES_FOUND = 23 7 | -------------------------------------------------------------------------------- /tests/data/packages/requires_simple_extra-0.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/requires_simple_extra-0.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /news/9825.process.rst: -------------------------------------------------------------------------------- 1 | ``pip list`` now normalized the distribution names. This is done as a part of 2 | the refactoring to prepare for the migration to ``importlib.metadata``. 3 | -------------------------------------------------------------------------------- /src/pip/_internal/cli/__init__.py: -------------------------------------------------------------------------------- 1 | """Subpackage containing all of pip's command line interface related code 2 | """ 3 | 4 | # This file intentionally does not import submodules 5 | -------------------------------------------------------------------------------- /tests/data/src/TopoRequires/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='TopoRequires', 5 | version='0.0.1', 6 | packages=['toporequires'], 7 | ) 8 | -------------------------------------------------------------------------------- /tests/data/src/pep518_forkbomb-235/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name='pep518_forkbomb', 4 | version='235', 5 | py_modules=['pep518_forkbomb']) 6 | -------------------------------------------------------------------------------- /news/9204.bugfix.rst: -------------------------------------------------------------------------------- 1 | New resolver: Detect an unnamed requirement is user-specified (by building its 2 | metadata for the project name) so it can be correctly ordered in the resolver. 3 | -------------------------------------------------------------------------------- /src/pip/_vendor/pep517/__init__.py: -------------------------------------------------------------------------------- 1 | """Wrappers to build Python packages using PEP 517 hooks 2 | """ 3 | 4 | __version__ = '0.10.0' 5 | 6 | from .wrappers import * # noqa: F401, F403 7 | -------------------------------------------------------------------------------- /tests/data/packages/console_scripts_uppercase-1.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/replit/pip/main/tests/data/packages/console_scripts_uppercase-1.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /tests/data/packages/pep517_wrapper_buildsys/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ "setuptools" ] 3 | build-backend = "mybuildsys" # setuptools.build_meta 4 | backend-path = ["."] 5 | -------------------------------------------------------------------------------- /tests/data/indexes/dev/bar/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | bar-1.0.tar.gz 4 | bar-2.0.dev1.tar.gz 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/data/packages/symlinks/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | version = '0.1' 4 | 5 | setup(name='symlinks', 6 | version=version, 7 | packages=["symlinks"], 8 | ) 9 | -------------------------------------------------------------------------------- /tests/data/src/requires_capitalized/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name='Requires_Capitalized', 4 | version='0.1', 5 | install_requires=['simple==1.0'] 6 | ) 7 | -------------------------------------------------------------------------------- /tests/data/indexes/in dex/simple/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | simple-1.0.tar.gz 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/data/indexes/simple/simple/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | simple-1.0.tar.gz 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/data/src/requires_simple/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import find_packages, setup 2 | 3 | setup(name='requires_simple', 4 | version='0.1', 5 | install_requires=['simple==1.0'] 6 | ) 7 | -------------------------------------------------------------------------------- /tests/data/src/extension/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import Extension, setup 2 | 3 | module = Extension('extension', sources=['extension.c']) 4 | setup(name='extension', version='0.0.1', ext_modules = [module]) 5 | -------------------------------------------------------------------------------- /tests/data/reqfiles/supported_options2.txt: -------------------------------------------------------------------------------- 1 | # default is no constraints 2 | # We're not testing the format control logic here, just that the options are 3 | # accepted 4 | --no-binary fred 5 | --only-binary wilma 6 | -------------------------------------------------------------------------------- /tests/data/src/compilewheel/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import find_packages, setup 3 | 4 | setup(name='compilewheel', 5 | version='1.0', 6 | packages=find_packages() 7 | ) 8 | -------------------------------------------------------------------------------- /tests/data/src/pep518_twin_forkbombs_first-234/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name='pep518_twin_forkbombs_first', 4 | version='234', 5 | py_modules=['pep518_twin_forkbombs_first']) 6 | -------------------------------------------------------------------------------- /news/9925.feature.rst: -------------------------------------------------------------------------------- 1 | New resolver: A distribution's ``Requires-Python`` metadata is now checked 2 | before its Python dependencies. This makes the resolver fail quicker when 3 | there's an interpreter version conflict. 4 | -------------------------------------------------------------------------------- /tests/data/packages/requires_wheelbroken_upper/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | name="requires_wheelbroken_upper", 5 | version="0", 6 | install_requires=['wheelbroken', 'upper']) 7 | -------------------------------------------------------------------------------- /tests/data/src/pep518_twin_forkbombs_second-238/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name='pep518_twin_forkbombs_second', 4 | version='238', 5 | py_modules=['pep518_twin_forkbombs_second']) 6 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | sphinx: 4 | builder: htmldir 5 | configuration: docs/html/conf.py 6 | 7 | python: 8 | version: 3.8 9 | install: 10 | - requirements: tools/requirements/docs.txt 11 | -------------------------------------------------------------------------------- /docs/html/development/configuration.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ============= 4 | Configuration 5 | ============= 6 | 7 | This content is now covered in the :ref:`Configuration` section of the :doc:`User Guide `. 8 | -------------------------------------------------------------------------------- /tests/data/src/TopoRequires2/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='TopoRequires2', 5 | version='0.0.1', 6 | packages=['toporequires2'], 7 | install_requires=['TopoRequires'], 8 | ) 9 | -------------------------------------------------------------------------------- /tests/data/src/TopoRequires3/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='TopoRequires3', 5 | version='0.0.1', 6 | packages=['toporequires3'], 7 | install_requires=['TopoRequires'], 8 | ) 9 | -------------------------------------------------------------------------------- /tests/data/src/pep518_invalid_requires/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import setup 3 | 4 | setup( 5 | name='pep518_invalid_requires', 6 | version='1.0.0', 7 | py_modules=['pep518'], 8 | ) 9 | -------------------------------------------------------------------------------- /tests/data/src/pep518_missing_requires/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import setup 3 | 4 | setup( 5 | name='pep518_missing_requires', 6 | version='1.0.0', 7 | py_modules=['pep518'], 8 | ) 9 | -------------------------------------------------------------------------------- /src/pip/_vendor/resolvelib/compat/collections_abc.py: -------------------------------------------------------------------------------- 1 | __all__ = ["Mapping", "Sequence"] 2 | 3 | try: 4 | from collections.abc import Mapping, Sequence 5 | except ImportError: 6 | from collections import Mapping, Sequence 7 | -------------------------------------------------------------------------------- /tests/data/src/pep518_conflicting_requires/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import setup 3 | 4 | setup( 5 | name='pep518_conflicting_requires', 6 | version='1.0.0', 7 | py_modules=['pep518'], 8 | ) 9 | -------------------------------------------------------------------------------- /tests/data/src/pep518_invalid_build_system/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import setup 3 | 4 | setup( 5 | name='pep518_invalid_build_system', 6 | version='1.0.0', 7 | py_modules=['pep518'], 8 | ) 9 | -------------------------------------------------------------------------------- /tests/data/src/requires_requires_capitalized/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name='requires_requires_capitalized', 4 | version='1.0', 5 | install_requires=['requires_Capitalized==0.1'] 6 | ) 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Patches must have Unix-style line endings, even on Windows 2 | tools/vendoring/patches/* eol=lf 3 | # The CA Bundle should always use Unix-style line endings, even on Windows 4 | src/pip/_vendor/certifi/*.pem eol=lf 5 | -------------------------------------------------------------------------------- /tools/requirements/tests.txt: -------------------------------------------------------------------------------- 1 | cryptography 2 | freezegun 3 | pretend 4 | pytest 5 | pytest-cov 6 | pytest-rerunfailures 7 | pytest-xdist 8 | scripttest 9 | setuptools 10 | virtualenv < 20.0 11 | werkzeug 12 | wheel 13 | toml 14 | -------------------------------------------------------------------------------- /src/pip/_vendor/packaging/LICENSE: -------------------------------------------------------------------------------- 1 | This software is made available under the terms of *either* of the licenses 2 | found in LICENSE.APACHE or LICENSE.BSD. Contributions to this software is made 3 | under the terms of *both* these licenses. 4 | -------------------------------------------------------------------------------- /tests/data/reqfiles/README.txt: -------------------------------------------------------------------------------- 1 | supported_options.txt 2 | --------------------- 3 | 4 | Contains --no-use-wheel. 5 | 6 | supported_options2.txt 7 | ---------------------- 8 | 9 | Contains --no-binary and --only-binary options. 10 | -------------------------------------------------------------------------------- /news/3931.bugfix.rst: -------------------------------------------------------------------------------- 1 | Prefer credentials from the URL over the previously-obtained credentials from URLs of the same domain, so it is possible to use different credentials on the same index server for different ``--extra-index-url`` options. 2 | -------------------------------------------------------------------------------- /tests/data/src/simple_namespace/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='simple_namespace', 5 | version='1.0', 6 | namespace_packages=['simple_namespace'], 7 | packages=['simple_namespace.module'], 8 | ) 9 | -------------------------------------------------------------------------------- /tests/data/src/singlemodule/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name="singlemodule", 5 | version='0.0.1', 6 | description="A sample Python project with a single module", 7 | py_modules=['singlemodule'], 8 | ) 9 | -------------------------------------------------------------------------------- /tests/data/indexes/pre/bar/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | bar-1.0.tar.gz 4 | bar-1.0b1.tar.gz 5 | bar-2.0.dev1.tar.gz 6 | 7 | 8 | -------------------------------------------------------------------------------- /news/9822.bugfix.rst: -------------------------------------------------------------------------------- 1 | Fix :ref:`pip freeze` to output packages :ref:`installed from git ` 2 | in the correct ``git+protocol://git.example.com/MyProject#egg=MyProject`` format 3 | rather than the old and no longer supported ``git+git@`` format. 4 | -------------------------------------------------------------------------------- /tests/data/src/TopoRequires4/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='TopoRequires4', 5 | version='0.0.1', 6 | packages=['toporequires4'], 7 | install_requires=['TopoRequires2', 'TopoRequires', 'TopoRequires3'], 8 | ) 9 | -------------------------------------------------------------------------------- /tests/data/src/simplewheel-1.0/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import setup 3 | 4 | import simplewheel 5 | 6 | setup(name='simplewheel', 7 | version=simplewheel.__version__, 8 | packages=['simplewheel'], 9 | ) 10 | -------------------------------------------------------------------------------- /tests/data/src/simplewheel-2.0/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import setup 3 | 4 | import simplewheel 5 | 6 | setup(name='simplewheel', 7 | version=simplewheel.__version__, 8 | packages=['simplewheel'], 9 | ) 10 | -------------------------------------------------------------------------------- /news/9450.feature.rst: -------------------------------------------------------------------------------- 1 | Add an additional level of verbosity. ``--verbose`` (and the shorthand ``-v``) now 2 | contains significantly less output, and users that need complete full debug-level output 3 | should pass it twice (``--verbose --verbose`` or ``-vv``). 4 | -------------------------------------------------------------------------------- /tests/data/src/pep518-3.0/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import setup 3 | 4 | import simplewheel # ensure dependency is installed 5 | 6 | setup(name='pep518', 7 | version='3.0', 8 | py_modules=['pep518'], 9 | ) 10 | -------------------------------------------------------------------------------- /docs/html/copyright.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ========= 4 | Copyright 5 | ========= 6 | 7 | pip and this documentation is: 8 | 9 | Copyright © 2008-2020 The pip developers (see `AUTHORS.txt `_ file). All rights reserved. 10 | -------------------------------------------------------------------------------- /src/pip/_vendor/tomli/__init__.py: -------------------------------------------------------------------------------- 1 | """A lil' TOML parser.""" 2 | 3 | __all__ = ("loads", "load", "TOMLDecodeError") 4 | __version__ = "1.0.3" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT 5 | 6 | from pip._vendor.tomli._parser import TOMLDecodeError, load, loads 7 | -------------------------------------------------------------------------------- /tests/data/src/pep518_with_extra_and_markers-1.0/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "requires_simple_extra[extra]", 4 | "simplewheel==1.0; python_version < '3'", 5 | "simplewheel==2.0; python_version >= '3'", 6 | "setuptools", 7 | "wheel", 8 | ] 9 | -------------------------------------------------------------------------------- /tests/data/src/pep518_with_namespace_package-1.0/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | import simple_namespace.module 4 | 5 | setup( 6 | name='pep518_with_namespace_package', 7 | version='1.0', 8 | py_modules=['pep518_with_namespace_package'], 9 | ) 10 | -------------------------------------------------------------------------------- /tests/data/src/requires_simple_extra/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name='requires_simple_extra', 4 | version='0.1', 5 | py_modules=['requires_simple_extra'], 6 | extras_require={ 7 | 'extra': ['simple==1.0'] 8 | } 9 | ) 10 | -------------------------------------------------------------------------------- /docs/html/reference/index.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../cli/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/index` 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip` 12 | -------------------------------------------------------------------------------- /docs/html/installing.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../installation/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`installation` 12 | -------------------------------------------------------------------------------- /src/pip/_vendor/colorama/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | from .initialise import init, deinit, reinit, colorama_text 3 | from .ansi import Fore, Back, Style, Cursor 4 | from .ansitowin32 import AnsiToWin32 5 | 6 | __version__ = '0.4.4' 7 | -------------------------------------------------------------------------------- /docs/html/quickstart.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../getting-started/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`getting-started` 12 | -------------------------------------------------------------------------------- /tests/data/packages3/requiredinner/index.html: -------------------------------------------------------------------------------- 1 | PyPI Mirror 2 | 3 |

PyPI Mirror

4 |

For testing --index-url with a file:// url for the index

5 | requiredinner=1.0.tar.gz
6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/html/reference/pip_hash.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_hash/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_hash` 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip_list.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_list/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_list` 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip_show.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_show/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_show` 12 | -------------------------------------------------------------------------------- /tests/data/packages3/index.html: -------------------------------------------------------------------------------- 1 | PyPI Mirror 2 | 3 |

PyPI Mirror

4 |

For testing --index-url with a file:// url for the index

5 | requiredinner
6 | Dinner
7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/data/src/chattymodule/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | # This flag says that the code is written to work on both Python 2 and Python 3 | # 3. If at all possible, it is good practice to do this. If you cannot, you 4 | # will need to generate wheels for each Python version that you support. 5 | universal=1 6 | -------------------------------------------------------------------------------- /tests/data/src/compilewheel/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | # This flag says that the code is written to work on both Python 2 and Python 3 | # 3. If at all possible, it is good practice to do this. If you cannot, you 4 | # will need to generate wheels for each Python version that you support. 5 | universal=1 6 | -------------------------------------------------------------------------------- /tests/data/src/singlemodule/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | # This flag says that the code is written to work on both Python 2 and Python 3 | # 3. If at all possible, it is good practice to do this. If you cannot, you 4 | # will need to generate wheels for each Python version that you support. 5 | universal=1 6 | -------------------------------------------------------------------------------- /docs/html/news.rst: -------------------------------------------------------------------------------- 1 | ========= 2 | Changelog 3 | ========= 4 | 5 | .. attention:: 6 | 7 | Major and minor releases of pip also include changes listed within 8 | prior beta releases. 9 | 10 | .. towncrier-draft-entries:: |release|, unreleased as on 11 | 12 | .. pip-news-include:: ../../NEWS.rst 13 | -------------------------------------------------------------------------------- /docs/html/reference/pip_cache.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_cache/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_cache` 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip_check.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_check/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_check` 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip_debug.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_debug/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_debug` 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip_wheel.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_wheel/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_wheel` 12 | -------------------------------------------------------------------------------- /docs/man/commands/hash.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ======== 4 | pip-hash 5 | ======== 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: hash 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: hash 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: hash 21 | -------------------------------------------------------------------------------- /docs/man/commands/help.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ======== 4 | pip-help 5 | ======== 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: help 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: help 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: help 21 | -------------------------------------------------------------------------------- /docs/man/commands/list.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ======== 4 | pip-list 5 | ======== 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: list 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: list 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: list 21 | -------------------------------------------------------------------------------- /docs/man/commands/show.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ======== 4 | pip-show 5 | ======== 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: show 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: show 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: show 21 | -------------------------------------------------------------------------------- /src/pip/py.typed: -------------------------------------------------------------------------------- 1 | pip is a command line program. While it is implemented in Python, and so is 2 | available for import, you must not use pip's internal APIs in this way. Typing 3 | information is provided as a convenience only and is not a guarantee. Expect 4 | unannounced changes to the API and types in releases. 5 | -------------------------------------------------------------------------------- /docs/html/reference/pip_config.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_config/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_config` 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip_freeze.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_freeze/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_freeze` 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip_install.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_install/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_install` 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip_search.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_search/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_search` 12 | -------------------------------------------------------------------------------- /docs/man/commands/cache.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ========= 4 | pip-cache 5 | ========= 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: cache 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: cache 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: cache 21 | -------------------------------------------------------------------------------- /docs/man/commands/check.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ========= 4 | pip-check 5 | ========= 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: check 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: check 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: check 21 | -------------------------------------------------------------------------------- /docs/man/commands/wheel.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ========= 4 | pip-wheel 5 | ========= 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: wheel 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: wheel 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: wheel 21 | -------------------------------------------------------------------------------- /src/pip/_vendor/chardet/version.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module exists only to simplify retrieving the version number of chardet 3 | from within setup.py and from chardet subpackages. 4 | 5 | :author: Dan Blanchard (dan.blanchard@gmail.com) 6 | """ 7 | 8 | __version__ = "4.0.0" 9 | VERSION = __version__.split('.') 10 | -------------------------------------------------------------------------------- /src/pip/_vendor/idna/compat.py: -------------------------------------------------------------------------------- 1 | from .core import * 2 | from .codec import * 3 | 4 | def ToASCII(label): 5 | return encode(label) 6 | 7 | def ToUnicode(label): 8 | return decode(label) 9 | 10 | def nameprep(s): 11 | raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol') 12 | 13 | -------------------------------------------------------------------------------- /tests/data/packages/requiresPaste/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ['flit_core >=2,<4'] 3 | build-backend = 'flit_core.buildapi' 4 | 5 | [tool.flit.metadata] 6 | module = 'requiresPaste' 7 | author = 'A. Random Developer' 8 | author-email = 'author@example.com' 9 | requires = ['Paste==3.4.2'] 10 | -------------------------------------------------------------------------------- /tools/requirements/docs.txt: -------------------------------------------------------------------------------- 1 | sphinx == 3.2.1 2 | towncrier 3 | furo 4 | myst_parser 5 | sphinx-copybutton 6 | sphinx-inline-tabs 7 | sphinxcontrib-towncrier >= 0.2.0a0 8 | 9 | # `docs.pipext` uses pip's internals to generate documentation. So, we install 10 | # the current directory to make it work. 11 | . 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip_download.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_download/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_download` 12 | -------------------------------------------------------------------------------- /docs/html/reference/pip_uninstall.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. meta:: 4 | 5 | :http-equiv=refresh: 3; url=../../cli/pip_uninstall/ 6 | 7 | This page has moved 8 | =================== 9 | 10 | You should be redirected automatically in 3 seconds. If that didn't 11 | work, here's a link: :doc:`../cli/pip_uninstall` 12 | -------------------------------------------------------------------------------- /docs/man/commands/config.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ========== 4 | pip-config 5 | ========== 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: config 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: config 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: config 21 | -------------------------------------------------------------------------------- /docs/man/commands/freeze.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ========== 4 | pip-freeze 5 | ========== 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: freeze 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: freeze 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: freeze 21 | -------------------------------------------------------------------------------- /docs/man/commands/search.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ========== 4 | pip-search 5 | ========== 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: search 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: search 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: search 21 | -------------------------------------------------------------------------------- /docs/man/commands/install.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | =========== 4 | pip-install 5 | =========== 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: install 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: install 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: install 21 | -------------------------------------------------------------------------------- /tests/data/indexes/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Details on Test Indexes 3 | ======================= 4 | 5 | empty_with_pkg 6 | -------------- 7 | empty index, but there's a package in the dir 8 | 9 | in dex 10 | ------ 11 | for testing url quoting with indexes 12 | 13 | simple 14 | ------ 15 | contains index page for "simple" pkg 16 | -------------------------------------------------------------------------------- /docs/man/commands/download.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ============ 4 | pip-download 5 | ============ 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: download 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: download 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: download 21 | -------------------------------------------------------------------------------- /src/pip/_vendor/distlib/_backport/__init__.py: -------------------------------------------------------------------------------- 1 | """Modules copied from Python 3 standard libraries, for internal use only. 2 | 3 | Individual classes and functions are found in d2._backport.misc. Intended 4 | usage is to always import things missing from 3.1 from that module: the 5 | built-in/stdlib objects will be used if found. 6 | """ 7 | -------------------------------------------------------------------------------- /tests/data/packages3/dinner/index.html: -------------------------------------------------------------------------------- 1 | PyPI Mirror 2 | 3 |

PyPI Mirror

4 |

For testing --index-url with a file:// url for the index

5 | Dinner-1.0.tar.gz
6 | Dinner-2.0.tar.gz
7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/man/commands/uninstall.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ============= 4 | pip-uninstall 5 | ============= 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: uninstall 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: uninstall 16 | 17 | Options 18 | ******* 19 | 20 | .. pip-command-options:: uninstall 21 | -------------------------------------------------------------------------------- /src/pip/_internal/utils/datetime.py: -------------------------------------------------------------------------------- 1 | """For when pip wants to check the date or time. 2 | """ 3 | 4 | import datetime 5 | 6 | 7 | def today_is_later_than(year, month, day): 8 | # type: (int, int, int) -> bool 9 | today = datetime.date.today() 10 | given = datetime.date(year, month, day) 11 | 12 | return today > given 13 | -------------------------------------------------------------------------------- /src/pip/_vendor/certifi/__main__.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | from pip._vendor.certifi import contents, where 4 | 5 | parser = argparse.ArgumentParser() 6 | parser.add_argument("-c", "--contents", action="store_true") 7 | args = parser.parse_args() 8 | 9 | if args.contents: 10 | print(contents()) 11 | else: 12 | print(where()) 13 | -------------------------------------------------------------------------------- /tests/data/src/prjwithdatafile/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='prjwithdatafile', 5 | version="1.0", 6 | packages=['prjwithdatafile'], 7 | data_files=[ 8 | (r'packages1', ['prjwithdatafile/README.txt']), 9 | (r'packages2', ['prjwithdatafile/README.txt']) 10 | ] 11 | ) 12 | -------------------------------------------------------------------------------- /tests/data/indexes/yanked/simple/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | simple-1.0.tar.gz 4 | simple-2.0.tar.gz 5 | simple-3.0.tar.gz 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/pip/_vendor/html5lib/filters/base.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | 4 | class Filter(object): 5 | def __init__(self, source): 6 | self.source = source 7 | 8 | def __iter__(self): 9 | return iter(self.source) 10 | 11 | def __getattr__(self, name): 12 | return getattr(self.source, name) 13 | -------------------------------------------------------------------------------- /src/pip/_vendor/cachecontrol/__init__.py: -------------------------------------------------------------------------------- 1 | """CacheControl import Interface. 2 | 3 | Make it easy to import from cachecontrol without long namespaces. 4 | """ 5 | __author__ = "Eric Larson" 6 | __email__ = "eric@ionrock.org" 7 | __version__ = "0.12.6" 8 | 9 | from .wrapper import CacheControl 10 | from .adapter import CacheControlAdapter 11 | from .controller import CacheController 12 | -------------------------------------------------------------------------------- /.github/lock.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before a closed issue or pull request is locked 2 | daysUntilLock: 30 3 | # Issues and pull requests with these labels will not be locked. 4 | exemptLabels: [] 5 | # Label to add before locking, such as `outdated`. Set to `false` to disable 6 | lockLabel: "S: auto-locked" 7 | # Comment to post before locking. Set to `false` to disable 8 | lockComment: false 9 | -------------------------------------------------------------------------------- /tests/data/packages/HackedEggInfo/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | from setuptools.command import egg_info as orig_egg_info 3 | 4 | 5 | class egg_info (orig_egg_info.egg_info): 6 | def run(self): 7 | orig_egg_info.egg_info.run(self) 8 | 9 | 10 | setup( 11 | name="hackedegginfo", 12 | version='0.0.0', 13 | cmdclass={'egg_info':egg_info}, 14 | zip_safe=False, 15 | ) 16 | -------------------------------------------------------------------------------- /.github/triage-new-issues.yml: -------------------------------------------------------------------------------- 1 | # This is based off of reading the actual source code of the bot. :/ 2 | # https://github.com/tunnckoCoreLabs/triage-new-issues/blob/2ff406030ecce4c25f7bdd454125ba54db1301bd/src/index.js#L7 3 | # 4 | # While this file is currently a no-op, it serves the purpose of 5 | # documenting that this bot is indeed being used, since this is a 6 | # non-standard probot bot. 7 | label: "needs triage" 8 | -------------------------------------------------------------------------------- /docs/html/topics/index.md: -------------------------------------------------------------------------------- 1 | # Topic Guides 2 | 3 | These pages provide detailed information on individual topics. 4 | 5 | ```{note} 6 | This section of the documentation is currently being fleshed out. See 7 | {issue}`9475` for more details. 8 | ``` 9 | 10 | ```{toctree} 11 | :maxdepth: 1 12 | 13 | authentication 14 | caching 15 | configuration 16 | dependency-resolution 17 | repeatable-installs 18 | vcs-support 19 | ``` 20 | -------------------------------------------------------------------------------- /src/pip/_internal/main.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | 3 | 4 | def main(args=None): 5 | # type: (Optional[List[str]]) -> int 6 | """This is preserved for old console scripts that may still be referencing 7 | it. 8 | 9 | For additional details, see https://github.com/pypa/pip/issues/7498. 10 | """ 11 | from pip._internal.utils.entrypoints import _wrapper 12 | 13 | return _wrapper(args) 14 | -------------------------------------------------------------------------------- /src/pip/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | 3 | __version__ = "21.2.dev0" 4 | 5 | 6 | def main(args: Optional[List[str]] = None) -> int: 7 | """This is an internal API only meant for use by pip's own console scripts. 8 | 9 | For additional details, see https://github.com/pypa/pip/issues/7498. 10 | """ 11 | from pip._internal.utils.entrypoints import _wrapper 12 | 13 | return _wrapper(args) 14 | -------------------------------------------------------------------------------- /docs/html/cli/pip_cache.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _`pip cache`: 3 | 4 | pip cache 5 | --------- 6 | 7 | 8 | Usage 9 | ***** 10 | 11 | .. tab:: Unix/macOS 12 | 13 | .. pip-command-usage:: cache "python -m pip" 14 | 15 | .. tab:: Windows 16 | 17 | .. pip-command-usage:: cache "py -m pip" 18 | 19 | Description 20 | *********** 21 | 22 | .. pip-command-description:: cache 23 | 24 | Options 25 | ******* 26 | 27 | .. pip-command-options:: cache 28 | -------------------------------------------------------------------------------- /tests/data/src/pep518_with_extra_and_markers-1.0/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | 4 | from setuptools import setup 5 | 6 | # ensure dependencies are installed 7 | import simple 8 | import simplewheel 9 | 10 | assert simplewheel.__version__ == '1.0' if sys.version_info < (3,) else '2.0' 11 | 12 | setup(name='pep518_with_extra_and_markers', 13 | version='1.0', 14 | py_modules=['pep518_with_extra_and_markers'], 15 | ) 16 | -------------------------------------------------------------------------------- /docs/man/commands/debug.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ========== 4 | pip-debug 5 | ========== 6 | 7 | Description 8 | *********** 9 | 10 | .. pip-command-description:: debug 11 | 12 | Usage 13 | ***** 14 | 15 | .. pip-command-usage:: debug 16 | 17 | 18 | .. warning:: 19 | This command is only meant for debugging. 20 | Its options and outputs are provisional and may change without notice. 21 | 22 | 23 | Options 24 | ******* 25 | 26 | .. pip-command-options:: debug 27 | -------------------------------------------------------------------------------- /docs/html/cli/pip_config.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _`pip config`: 3 | 4 | ========== 5 | pip config 6 | ========== 7 | 8 | 9 | Usage 10 | ===== 11 | 12 | .. tab:: Unix/macOS 13 | 14 | .. pip-command-usage:: config "python -m pip" 15 | 16 | .. tab:: Windows 17 | 18 | .. pip-command-usage:: config "py -m pip" 19 | 20 | 21 | Description 22 | =========== 23 | 24 | .. pip-command-description:: config 25 | 26 | 27 | Options 28 | ======= 29 | 30 | .. pip-command-options:: config 31 | -------------------------------------------------------------------------------- /src/pip/_vendor/vendor.txt: -------------------------------------------------------------------------------- 1 | appdirs==1.4.4 2 | CacheControl==0.12.6 3 | colorama==0.4.4 4 | distlib==0.3.1 5 | distro==1.5.0 6 | html5lib==1.1 7 | msgpack==1.0.2 8 | packaging==21.0 9 | pep517==0.10.0 10 | progress==1.5 11 | pyparsing==2.4.7 12 | requests==2.25.1 13 | certifi==2020.12.05 14 | chardet==4.0.0 15 | idna==3.1 16 | urllib3==1.26.5 17 | resolvelib==0.7.1 18 | setuptools==44.0.0 19 | six==1.16.0 20 | tenacity==7.0.0 21 | tomli==1.0.3 22 | webencodings==0.5.1 23 | -------------------------------------------------------------------------------- /src/pip/_vendor/resolvelib/reporters.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | class BaseReporter: 4 | def starting(self) -> Any: ... 5 | def starting_round(self, index: int) -> Any: ... 6 | def ending_round(self, index: int, state: Any) -> Any: ... 7 | def ending(self, state: Any) -> Any: ... 8 | def adding_requirement(self, requirement: Any, parent: Any) -> Any: ... 9 | def backtracking(self, candidate: Any) -> Any: ... 10 | def pinning(self, candidate: Any) -> Any: ... 11 | -------------------------------------------------------------------------------- /tests/functional/test_requests.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | 4 | @pytest.mark.skipif 5 | def test_timeout(script): 6 | result = script.pip( 7 | "--timeout", "0.01", "install", "-vvv", "INITools", 8 | expect_error=True, 9 | ) 10 | assert ( 11 | "Could not fetch URL https://pypi.org/simple/INITools/: " 12 | "timed out" in result.stdout 13 | ) 14 | assert ( 15 | "Could not fetch URL https://pypi.org/simple/: " 16 | "timed out" in result.stdout 17 | ) 18 | -------------------------------------------------------------------------------- /src/pip/_vendor/requests/__version__.py: -------------------------------------------------------------------------------- 1 | # .-. .-. .-. . . .-. .-. .-. .-. 2 | # |( |- |.| | | |- `-. | `-. 3 | # ' ' `-' `-`.`-' `-' `-' ' `-' 4 | 5 | __title__ = 'requests' 6 | __description__ = 'Python HTTP for Humans.' 7 | __url__ = 'https://requests.readthedocs.io' 8 | __version__ = '2.25.1' 9 | __build__ = 0x022501 10 | __author__ = 'Kenneth Reitz' 11 | __author_email__ = 'me@kennethreitz.org' 12 | __license__ = 'Apache 2.0' 13 | __copyright__ = 'Copyright 2020 Kenneth Reitz' 14 | __cake__ = u'\u2728 \U0001f370 \u2728' 15 | -------------------------------------------------------------------------------- /tests/data/src/chattymodule/setup.py: -------------------------------------------------------------------------------- 1 | # A chatty setup.py for testing pip subprocess output handling 2 | 3 | import os 4 | import sys 5 | 6 | from setuptools import setup 7 | 8 | print(f"HELLO FROM CHATTYMODULE {sys.argv[1]}") 9 | print(os.environ) 10 | print(sys.argv) 11 | if "--fail" in sys.argv: 12 | print("I DIE, I DIE") 13 | sys.exit(1) 14 | 15 | setup( 16 | name="chattymodule", 17 | version='0.0.1', 18 | description="A sample Python project with a single module", 19 | py_modules=['chattymodule'], 20 | ) 21 | -------------------------------------------------------------------------------- /tests/lib/index.py: -------------------------------------------------------------------------------- 1 | from pip._internal.models.candidate import InstallationCandidate 2 | from pip._internal.models.link import Link 3 | 4 | 5 | def make_mock_candidate(version, yanked_reason=None, hex_digest=None): 6 | url = f"https://example.com/pkg-{version}.tar.gz" 7 | if hex_digest is not None: 8 | assert len(hex_digest) == 64 9 | url += f"#sha256={hex_digest}" 10 | 11 | link = Link(url, yanked_reason=yanked_reason) 12 | candidate = InstallationCandidate("mypackage", version, link) 13 | 14 | return candidate 15 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to pip 2 | 3 | Thank you for your interest in contributing to pip! There are many ways to 4 | contribute, and we appreciate all of them. 5 | 6 | As a reminder, all contributors are expected to follow our [Code of Conduct][coc]. 7 | 8 | [coc]: https://www.pypa.io/en/latest/code-of-conduct/ 9 | 10 | ## Development Documentation 11 | 12 | Our [development documentation](https://pip.pypa.io/en/latest/development/) contains details on how to get started with contributing to pip, and details of our development processes. 13 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /tools/requirements/tests-common_wheels.txt: -------------------------------------------------------------------------------- 1 | # Create local setuptools wheel files for testing by: 2 | # 1. Cloning setuptools and checking out the branch of interest 3 | # 2. Running `python3 bootstrap.py` in that directory 4 | # 3. Running `python3 -m pip wheel --no-cache -w /tmp/setuptools_build_meta_legacy/ .` 5 | # 4. Replacing the `setuptools` entry below with a `file:///...` URL 6 | # (Adjust artifact directory used based on preference and operating system) 7 | 8 | setuptools >= 40.8.0 9 | wheel 10 | # As required by pytest-cov. 11 | coverage >= 4.4 12 | -------------------------------------------------------------------------------- /src/pip/_vendor/requests/certs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | requests.certs 6 | ~~~~~~~~~~~~~~ 7 | 8 | This module returns the preferred default CA certificate bundle. There is 9 | only one — the one from the certifi package. 10 | 11 | If you are packaging Requests, e.g., for a Linux distribution or a managed 12 | environment, you can change the definition of where() to return a separately 13 | packaged CA bundle. 14 | """ 15 | from pip._vendor.certifi import where 16 | 17 | if __name__ == '__main__': 18 | print(where()) 19 | -------------------------------------------------------------------------------- /src/pip/_vendor/resolvelib/__init__.pyi: -------------------------------------------------------------------------------- 1 | __version__: str 2 | 3 | from .providers import ( 4 | AbstractResolver as AbstractResolver, 5 | AbstractProvider as AbstractProvider, 6 | ) 7 | from .reporters import BaseReporter as BaseReporter 8 | from .resolvers import ( 9 | InconsistentCandidate as InconsistentCandidate, 10 | RequirementsConflicted as RequirementsConflicted, 11 | Resolver as Resolver, 12 | ResolutionError as ResolutionError, 13 | ResolutionImpossible as ResolutionImpossible, 14 | ResolutionTooDeep as ResolutionTooDeep, 15 | ) 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | # Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser 2 | blank_issues_enabled: true # default 3 | contact_links: 4 | - name: 💬 Discourse 5 | url: https://discuss.python.org/c/packaging 6 | about: | 7 | Please ask typical Q&A here: general ideas for Python packaging, 8 | questions about structuring projects and so on 9 | - name: '💬 IRC: #pypa' 10 | url: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa 11 | about: Chat with devs 12 | -------------------------------------------------------------------------------- /tests/lib/direct_url.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, DirectUrl 4 | 5 | 6 | def get_created_direct_url(result, pkg): 7 | direct_url_metadata_re = re.compile( 8 | pkg + r"-[\d\.]+\.dist-info." + DIRECT_URL_METADATA_NAME + r"$" 9 | ) 10 | for filename in result.files_created: 11 | if direct_url_metadata_re.search(filename): 12 | direct_url_path = result.test_env.base_path / filename 13 | with open(direct_url_path) as f: 14 | return DirectUrl.from_json(f.read()) 15 | return None 16 | -------------------------------------------------------------------------------- /docs/html/cli/pip_debug.rst: -------------------------------------------------------------------------------- 1 | .. _`pip debug`: 2 | 3 | ========= 4 | pip debug 5 | ========= 6 | 7 | 8 | Usage 9 | ===== 10 | 11 | .. tab:: Unix/macOS 12 | 13 | .. pip-command-usage:: debug "python -m pip" 14 | 15 | .. tab:: Windows 16 | 17 | .. pip-command-usage:: debug "py -m pip" 18 | 19 | 20 | .. warning:: 21 | 22 | This command is only meant for debugging. 23 | Its options and outputs are provisional and may change without notice. 24 | 25 | 26 | Description 27 | =========== 28 | 29 | .. pip-command-description:: debug 30 | 31 | 32 | Options 33 | ======= 34 | 35 | .. pip-command-options:: debug 36 | -------------------------------------------------------------------------------- /src/pip/_vendor/urllib3/util/queue.py: -------------------------------------------------------------------------------- 1 | import collections 2 | 3 | from ..packages import six 4 | from ..packages.six.moves import queue 5 | 6 | if six.PY2: 7 | # Queue is imported for side effects on MS Windows. See issue #229. 8 | import Queue as _unused_module_Queue # noqa: F401 9 | 10 | 11 | class LifoQueue(queue.Queue): 12 | def _init(self, _): 13 | self.queue = collections.deque() 14 | 15 | def _qsize(self, len=len): 16 | return len(self.queue) 17 | 18 | def _put(self, item): 19 | self.queue.append(item) 20 | 21 | def _get(self): 22 | return self.queue.pop() 23 | -------------------------------------------------------------------------------- /news/8954.feature.rst: -------------------------------------------------------------------------------- 1 | When pip is asked to uninstall a project without the dist-info/RECORD file 2 | it will no longer traceback with FileNotFoundError, 3 | but it will provide a better error message instead, such as:: 4 | 5 | ERROR: Cannot uninstall foobar 0.1, RECORD file not found. You might be able to recover from this via: 'pip install --force-reinstall --no-deps foobar==0.1'. 6 | 7 | When dist-info/INSTALLER is present and contains some useful information, the info is included in the error message instead:: 8 | 9 | ERROR: Cannot uninstall foobar 0.1, RECORD file not found. Hint: The package was installed by rpm. 10 | -------------------------------------------------------------------------------- /src/pip/_vendor/packaging/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is dual licensed under the terms of the Apache License, Version 2 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository 3 | # for complete details. 4 | 5 | from .__about__ import ( 6 | __author__, 7 | __copyright__, 8 | __email__, 9 | __license__, 10 | __summary__, 11 | __title__, 12 | __uri__, 13 | __version__, 14 | ) 15 | 16 | __all__ = [ 17 | "__title__", 18 | "__summary__", 19 | "__uri__", 20 | "__version__", 21 | "__author__", 22 | "__email__", 23 | "__license__", 24 | "__copyright__", 25 | ] 26 | -------------------------------------------------------------------------------- /src/pip/_vendor/cachecontrol/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2015 Eric Larson 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | implied. 13 | 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | -------------------------------------------------------------------------------- /src/pip/_internal/resolution/base.py: -------------------------------------------------------------------------------- 1 | from typing import Callable, List 2 | 3 | from pip._internal.req.req_install import InstallRequirement 4 | from pip._internal.req.req_set import RequirementSet 5 | 6 | InstallRequirementProvider = Callable[[str, InstallRequirement], InstallRequirement] 7 | 8 | 9 | class BaseResolver: 10 | def resolve( 11 | self, root_reqs: List[InstallRequirement], check_supported_wheels: bool 12 | ) -> RequirementSet: 13 | raise NotImplementedError() 14 | 15 | def get_installation_order( 16 | self, req_set: RequirementSet 17 | ) -> List[InstallRequirement]: 18 | raise NotImplementedError() 19 | -------------------------------------------------------------------------------- /src/pip/_internal/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | 3 | import pip._internal.utils.inject_securetransport # noqa 4 | from pip._internal.utils import _log 5 | 6 | # init_logging() must be called before any call to logging.getLogger() 7 | # which happens at import of most modules. 8 | _log.init_logging() 9 | 10 | 11 | def main(args: (Optional[List[str]]) = None) -> int: 12 | """This is preserved for old console scripts that may still be referencing 13 | it. 14 | 15 | For additional details, see https://github.com/pypa/pip/issues/7498. 16 | """ 17 | from pip._internal.utils.entrypoints import _wrapper 18 | 19 | return _wrapper(args) 20 | -------------------------------------------------------------------------------- /src/pip/_vendor/pep517/in_process/__init__.py: -------------------------------------------------------------------------------- 1 | """This is a subpackage because the directory is on sys.path for _in_process.py 2 | 3 | The subpackage should stay as empty as possible to avoid shadowing modules that 4 | the backend might import. 5 | """ 6 | from os.path import dirname, abspath, join as pjoin 7 | from contextlib import contextmanager 8 | 9 | try: 10 | import importlib.resources as resources 11 | 12 | def _in_proc_script_path(): 13 | return resources.path(__package__, '_in_process.py') 14 | except ImportError: 15 | @contextmanager 16 | def _in_proc_script_path(): 17 | yield pjoin(dirname(abspath(__file__)), '_in_process.py') 18 | -------------------------------------------------------------------------------- /.github/no-response.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before issue is closed for lack of response 2 | daysUntilClose: 15 3 | # Label requiring a response 4 | responseRequiredLabel: "S: awaiting response" 5 | # Comment to post when closing an Issue for lack of response. Set to `false` to disable 6 | closeComment: > 7 | This issue has been automatically closed because there has been no response 8 | to our request for more information from the original author. With only the 9 | information that is currently in the issue, we don't have enough information 10 | to take action. Please reach out if you have or find the answers we need so 11 | that we can investigate further. 12 | -------------------------------------------------------------------------------- /src/pip/_internal/vcs/__init__.py: -------------------------------------------------------------------------------- 1 | # Expose a limited set of classes and functions so callers outside of 2 | # the vcs package don't need to import deeper than `pip._internal.vcs`. 3 | # (The test directory may still need to import from a vcs sub-package.) 4 | # Import all vcs modules to register each VCS in the VcsSupport object. 5 | import pip._internal.vcs.bazaar 6 | import pip._internal.vcs.git 7 | import pip._internal.vcs.mercurial 8 | import pip._internal.vcs.subversion # noqa: F401 9 | from pip._internal.vcs.versioncontrol import ( # noqa: F401 10 | RemoteNotFoundError, 11 | RemoteNotValidError, 12 | is_url, 13 | make_vcs_requirement_url, 14 | vcs, 15 | ) 16 | -------------------------------------------------------------------------------- /src/pip/_vendor/resolvelib/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = [ 2 | "__version__", 3 | "AbstractProvider", 4 | "AbstractResolver", 5 | "BaseReporter", 6 | "InconsistentCandidate", 7 | "Resolver", 8 | "RequirementsConflicted", 9 | "ResolutionError", 10 | "ResolutionImpossible", 11 | "ResolutionTooDeep", 12 | ] 13 | 14 | __version__ = "0.7.1" 15 | 16 | 17 | from .providers import AbstractProvider, AbstractResolver 18 | from .reporters import BaseReporter 19 | from .resolvers import ( 20 | InconsistentCandidate, 21 | RequirementsConflicted, 22 | Resolver, 23 | ResolutionError, 24 | ResolutionImpossible, 25 | ResolutionTooDeep, 26 | ) 27 | -------------------------------------------------------------------------------- /tests/lib/compat.py: -------------------------------------------------------------------------------- 1 | import contextlib 2 | from typing import Iterator 3 | 4 | 5 | @contextlib.contextmanager 6 | def nullcontext(): 7 | # type: () -> Iterator[None] 8 | """ 9 | Context manager that does no additional processing. 10 | 11 | Used as a stand-in for a normal context manager, when a particular block of 12 | code is only sometimes used with a normal context manager: 13 | 14 | cm = optional_cm if condition else nullcontext() 15 | with cm: 16 | # Perform operation, using optional_cm if condition is True 17 | 18 | TODO: Replace with contextlib.nullcontext after dropping Python 3.6 19 | support. 20 | """ 21 | yield 22 | -------------------------------------------------------------------------------- /src/pip/_vendor/msgpack/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) 2008-2011 INADA Naoki 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /src/pip/_vendor/pkg_resources/py31compat.py: -------------------------------------------------------------------------------- 1 | import os 2 | import errno 3 | import sys 4 | 5 | from pip._vendor import six 6 | 7 | 8 | def _makedirs_31(path, exist_ok=False): 9 | try: 10 | os.makedirs(path) 11 | except OSError as exc: 12 | if not exist_ok or exc.errno != errno.EEXIST: 13 | raise 14 | 15 | 16 | # rely on compatibility behavior until mode considerations 17 | # and exists_ok considerations are disentangled. 18 | # See https://github.com/pypa/setuptools/pull/1083#issuecomment-315168663 19 | needs_makedirs = ( 20 | six.PY2 or 21 | (3, 4) <= sys.version_info < (3, 4, 1) 22 | ) 23 | makedirs = _makedirs_31 if needs_makedirs else os.makedirs 24 | -------------------------------------------------------------------------------- /tests/functional/test_vcs_mercurial.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from pip._internal.vcs.mercurial import Mercurial 4 | from tests.lib import _create_test_package, need_mercurial 5 | 6 | 7 | @need_mercurial 8 | def test_get_repository_root(script): 9 | version_pkg_path = _create_test_package(script, vcs="hg") 10 | tests_path = version_pkg_path.joinpath("tests") 11 | tests_path.mkdir() 12 | 13 | root1 = Mercurial.get_repository_root(version_pkg_path) 14 | assert os.path.normcase(root1) == os.path.normcase(version_pkg_path) 15 | 16 | root2 = Mercurial.get_repository_root(version_pkg_path.joinpath("tests")) 17 | assert os.path.normcase(root2) == os.path.normcase(version_pkg_path) 18 | -------------------------------------------------------------------------------- /src/pip/_vendor/distlib/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) 2012-2019 Vinay Sajip. 4 | # Licensed to the Python Software Foundation under a contributor agreement. 5 | # See LICENSE.txt and CONTRIBUTORS.txt. 6 | # 7 | import logging 8 | 9 | __version__ = '0.3.1' 10 | 11 | class DistlibException(Exception): 12 | pass 13 | 14 | try: 15 | from logging import NullHandler 16 | except ImportError: # pragma: no cover 17 | class NullHandler(logging.Handler): 18 | def handle(self, record): pass 19 | def emit(self, record): pass 20 | def createLock(self): self.lock = None 21 | 22 | logger = logging.getLogger(__name__) 23 | logger.addHandler(NullHandler()) 24 | -------------------------------------------------------------------------------- /tests/data/packages/LocalExtras/setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from setuptools import find_packages, setup 4 | 5 | 6 | def path_to_url(path): 7 | """ 8 | Convert a path to URI. The path will be made absolute and 9 | will not have quoted path parts. 10 | """ 11 | path = os.path.normpath(os.path.abspath(path)) 12 | drive, path = os.path.splitdrive(path) 13 | filepath = path.split(os.path.sep) 14 | url = '/'.join(filepath) 15 | if drive: 16 | return 'file:///' + drive + url 17 | return 'file://' + url 18 | 19 | 20 | setup( 21 | name='LocalExtras', 22 | version='0.0.1', 23 | packages=find_packages(), 24 | extras_require={'bar': ['simple'], 'baz': ['singlemodule']} 25 | ) 26 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 2 | patreon: # Replace with a single Patreon username 3 | open_collective: # Replace with a single Open Collective username 4 | ko_fi: # Replace with a single Ko-fi username 5 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 6 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 7 | liberapay: # Replace with a single Liberapay username 8 | issuehunt: # Replace with a single IssueHunt username 9 | otechie: # Replace with a single Otechie username 10 | custom: "https://pypi.org/sponsor/" # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 11 | -------------------------------------------------------------------------------- /tests/data/packages/LocalEnvironMarker/setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from setuptools import find_packages, setup 4 | 5 | 6 | def path_to_url(path): 7 | """ 8 | Convert a path to URI. The path will be made absolute and 9 | will not have quoted path parts. 10 | """ 11 | path = os.path.normpath(os.path.abspath(path)) 12 | drive, path = os.path.splitdrive(path) 13 | filepath = path.split(os.path.sep) 14 | url = '/'.join(filepath) 15 | if drive: 16 | return 'file:///' + drive + url 17 | return 'file://' + url 18 | 19 | 20 | setup( 21 | name='LocalEnvironMarker', 22 | version='0.0.1', 23 | packages=find_packages(), 24 | extras_require={ 25 | ":python_version == '2.7'": ['simple'], 26 | } 27 | ) 28 | -------------------------------------------------------------------------------- /src/pip/_internal/distributions/installed.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | from pip._vendor.pkg_resources import Distribution 4 | 5 | from pip._internal.distributions.base import AbstractDistribution 6 | from pip._internal.index.package_finder import PackageFinder 7 | 8 | 9 | class InstalledDistribution(AbstractDistribution): 10 | """Represents an installed package. 11 | 12 | This does not need any preparation as the required information has already 13 | been computed. 14 | """ 15 | 16 | def get_pkg_resources_distribution(self) -> Optional[Distribution]: 17 | return self.req.satisfied_by 18 | 19 | def prepare_distribution_metadata( 20 | self, finder: PackageFinder, build_isolation: bool 21 | ) -> None: 22 | pass 23 | -------------------------------------------------------------------------------- /tests/data/packages/pep517_wrapper_buildsys/mybuildsys.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from setuptools.build_meta import build_sdist 4 | from setuptools.build_meta import build_wheel as setuptools_build_wheel 5 | from setuptools.build_meta import (get_requires_for_build_sdist, 6 | get_requires_for_build_wheel, 7 | prepare_metadata_for_build_wheel) 8 | 9 | 10 | def build_wheel(*a, **kw): 11 | if os.environ.get("PIP_TEST_FAIL_BUILD_WHEEL"): 12 | raise RuntimeError("Failing build_wheel, as requested.") 13 | 14 | # Create the marker file to record that the hook was called 15 | with open(os.environ['PIP_TEST_MARKER_FILE'], 'wb'): 16 | pass 17 | 18 | return setuptools_build_wheel(*a, **kw) 19 | -------------------------------------------------------------------------------- /tests/data/packages/LocalExtras-0.0.2/setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from setuptools import find_packages, setup 4 | 5 | 6 | def path_to_url(path): 7 | """ 8 | Convert a path to URI. The path will be made absolute and 9 | will not have quoted path parts. 10 | """ 11 | path = os.path.normpath(os.path.abspath(path)) 12 | drive, path = os.path.splitdrive(path) 13 | filepath = path.split(os.path.sep) 14 | url = '/'.join(filepath) 15 | if drive: 16 | return 'file:///' + drive + url 17 | return 'file://' + url 18 | 19 | 20 | setup( 21 | name='LocalExtras', 22 | version='0.0.2', 23 | packages=find_packages(), 24 | install_requires=['simple==1.0'], 25 | extras_require={'bar': ['simple==2.0'], 'baz': ['singlemodule']} 26 | ) 27 | -------------------------------------------------------------------------------- /src/pip/_vendor/requests/packages.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | # This code exists for backwards compatibility reasons. 4 | # I don't like it either. Just look the other way. :) 5 | 6 | for package in ('urllib3', 'idna', 'chardet'): 7 | vendored_package = "pip._vendor." + package 8 | locals()[package] = __import__(vendored_package) 9 | # This traversal is apparently necessary such that the identities are 10 | # preserved (requests.packages.urllib3.* is urllib3.*) 11 | for mod in list(sys.modules): 12 | if mod == vendored_package or mod.startswith(vendored_package + '.'): 13 | unprefixed_mod = mod[len("pip._vendor."):] 14 | sys.modules['pip._vendor.requests.packages.' + unprefixed_mod] = sys.modules[mod] 15 | 16 | # Kinda cool, though, right? 17 | -------------------------------------------------------------------------------- /tests/unit/test_packaging.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from pip._vendor.packaging import specifiers 3 | 4 | from pip._internal.utils.packaging import check_requires_python 5 | 6 | 7 | @pytest.mark.parametrize('version_info, requires_python, expected', [ 8 | ((3, 6, 5), '== 3.6.4', False), 9 | ((3, 6, 5), '== 3.6.5', True), 10 | ((3, 6, 5), None, True), 11 | ]) 12 | def test_check_requires_python(version_info, requires_python, expected): 13 | actual = check_requires_python(requires_python, version_info) 14 | assert actual == expected 15 | 16 | 17 | def test_check_requires_python__invalid(): 18 | """ 19 | Test an invalid Requires-Python value. 20 | """ 21 | with pytest.raises(specifiers.InvalidSpecifier): 22 | check_requires_python('invalid', (3, 6, 5)) 23 | -------------------------------------------------------------------------------- /src/pip/_vendor/packaging/__about__.py: -------------------------------------------------------------------------------- 1 | # This file is dual licensed under the terms of the Apache License, Version 2 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository 3 | # for complete details. 4 | 5 | __all__ = [ 6 | "__title__", 7 | "__summary__", 8 | "__uri__", 9 | "__version__", 10 | "__author__", 11 | "__email__", 12 | "__license__", 13 | "__copyright__", 14 | ] 15 | 16 | __title__ = "packaging" 17 | __summary__ = "Core utilities for Python packages" 18 | __uri__ = "https://github.com/pypa/packaging" 19 | 20 | __version__ = "21.0" 21 | 22 | __author__ = "Donald Stufft and individual contributors" 23 | __email__ = "donald@stufft.io" 24 | 25 | __license__ = "BSD-2-Clause or Apache-2.0" 26 | __copyright__ = "2014-2019 %s" % __author__ 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **What's the problem this feature will solve?** 8 | 9 | 10 | **Describe the solution you'd like** 11 | 12 | 13 | 14 | 15 | **Alternative Solutions** 16 | 17 | 18 | **Additional context** 19 | 20 | -------------------------------------------------------------------------------- /src/pip/_vendor/resolvelib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018, Tzu-ping Chung 2 | 3 | Permission to use, copy, modify, and distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /tools/vendoring/patches/tenacity.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/pip/_vendor/tenacity/__init__.py b/src/pip/_vendor/tenacity/__init__.py 2 | index 5f8cb5058..42e9d8940 100644 3 | --- a/src/pip/_vendor/tenacity/__init__.py 4 | +++ b/src/pip/_vendor/tenacity/__init__.py 5 | @@ -22,10 +22,12 @@ try: 6 | except ImportError: 7 | iscoroutinefunction = None 8 | 9 | -try: 10 | - import tornado 11 | -except ImportError: 12 | - tornado = None 13 | +# Replace a conditional import with a hard-coded None so that pip does 14 | +# not attempt to use tornado even if it is present in the environment. 15 | +# If tornado is non-None, tenacity will attempt to execute some code 16 | +# that is sensitive to the version of tornado, which could break pip 17 | +# if an old version is found. 18 | +tornado = None 19 | 20 | import sys 21 | import threading 22 | -------------------------------------------------------------------------------- /docs/html/cli/index.md: -------------------------------------------------------------------------------- 1 | # Commands 2 | 3 | The general options that apply to all the commands listed below can be 4 | found [under the `pip` page in this section](pip). 5 | 6 | ```{toctree} 7 | :maxdepth: 1 8 | :hidden: 9 | 10 | pip 11 | ``` 12 | 13 | ```{toctree} 14 | :maxdepth: 1 15 | :caption: Environment Management and Introspection 16 | 17 | pip_install 18 | pip_uninstall 19 | pip_list 20 | pip_show 21 | pip_freeze 22 | pip_check 23 | ``` 24 | 25 | ```{toctree} 26 | :maxdepth: 1 27 | :caption: Handling Distribution Files 28 | 29 | pip_download 30 | pip_wheel 31 | pip_hash 32 | ``` 33 | 34 | ```{toctree} 35 | :maxdepth: 1 36 | :caption: Package Index information 37 | 38 | pip_search 39 | ``` 40 | 41 | ```{toctree} 42 | :maxdepth: 1 43 | :caption: Managing pip itself 44 | 45 | pip_cache 46 | pip_config 47 | pip_debug 48 | ``` 49 | -------------------------------------------------------------------------------- /src/pip/_vendor/cachecontrol/wrapper.py: -------------------------------------------------------------------------------- 1 | from .adapter import CacheControlAdapter 2 | from .cache import DictCache 3 | 4 | 5 | def CacheControl( 6 | sess, 7 | cache=None, 8 | cache_etags=True, 9 | serializer=None, 10 | heuristic=None, 11 | controller_class=None, 12 | adapter_class=None, 13 | cacheable_methods=None, 14 | ): 15 | 16 | cache = DictCache() if cache is None else cache 17 | adapter_class = adapter_class or CacheControlAdapter 18 | adapter = adapter_class( 19 | cache, 20 | cache_etags=cache_etags, 21 | serializer=serializer, 22 | heuristic=heuristic, 23 | controller_class=controller_class, 24 | cacheable_methods=cacheable_methods, 25 | ) 26 | sess.mount("http://", adapter) 27 | sess.mount("https://", adapter) 28 | 29 | return sess 30 | -------------------------------------------------------------------------------- /src/pip/_vendor/progress/LICENSE: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 Giorgos Verigakis 2 | # 3 | # Permission to use, copy, modify, and distribute this software for any 4 | # purpose with or without fee is hereby granted, provided that the above 5 | # copyright notice and this permission notice appear in all copies. 6 | # 7 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /src/pip/_vendor/cachecontrol/compat.py: -------------------------------------------------------------------------------- 1 | try: 2 | from urllib.parse import urljoin 3 | except ImportError: 4 | from urlparse import urljoin 5 | 6 | 7 | try: 8 | import cPickle as pickle 9 | except ImportError: 10 | import pickle 11 | 12 | 13 | # Handle the case where the requests module has been patched to not have 14 | # urllib3 bundled as part of its source. 15 | try: 16 | from pip._vendor.requests.packages.urllib3.response import HTTPResponse 17 | except ImportError: 18 | from pip._vendor.urllib3.response import HTTPResponse 19 | 20 | try: 21 | from pip._vendor.requests.packages.urllib3.util import is_fp_closed 22 | except ImportError: 23 | from pip._vendor.urllib3.util import is_fp_closed 24 | 25 | # Replicate some six behaviour 26 | try: 27 | text_type = unicode 28 | except NameError: 29 | text_type = str 30 | -------------------------------------------------------------------------------- /src/pip/_vendor/html5lib/treeadapters/__init__.py: -------------------------------------------------------------------------------- 1 | """Tree adapters let you convert from one tree structure to another 2 | 3 | Example: 4 | 5 | .. code-block:: python 6 | 7 | from pip._vendor import html5lib 8 | from pip._vendor.html5lib.treeadapters import genshi 9 | 10 | doc = 'Hi!' 11 | treebuilder = html5lib.getTreeBuilder('etree') 12 | parser = html5lib.HTMLParser(tree=treebuilder) 13 | tree = parser.parse(doc) 14 | TreeWalker = html5lib.getTreeWalker('etree') 15 | 16 | genshi_tree = genshi.to_genshi(TreeWalker(tree)) 17 | 18 | """ 19 | from __future__ import absolute_import, division, unicode_literals 20 | 21 | from . import sax 22 | 23 | __all__ = ["sax"] 24 | 25 | try: 26 | from . import genshi # noqa 27 | except ImportError: 28 | pass 29 | else: 30 | __all__.append("genshi") 31 | -------------------------------------------------------------------------------- /tests/data/packages/FSPkg/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import find_packages, setup 2 | 3 | version = '0.1dev' 4 | 5 | setup(name='FSPkg', 6 | version=version, 7 | description="File system test package", 8 | long_description="""\ 9 | File system test package""", 10 | classifiers=[], # Get strings from https://pypi.org/pypi?%3Aaction=list_classifiers 11 | keywords='pip tests', 12 | author='pip', 13 | author_email='pip@openplans.org', 14 | url='http://pip.openplans.org', 15 | license='', 16 | packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), 17 | include_package_data=True, 18 | zip_safe=False, 19 | install_requires=[ 20 | # -*- Extra requirements: -*- 21 | ], 22 | entry_points=""" 23 | # -*- Entry points: -*- 24 | """, 25 | ) 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # Distribution / packaging 7 | /build/ 8 | /dist/ 9 | *.egg 10 | *.eggs 11 | *.egg-info/ 12 | MANIFEST 13 | 14 | # Documentation 15 | docs/build/ 16 | 17 | # mypy 18 | .mypy_cache/ 19 | 20 | # Unit test / coverage reports 21 | .[nt]ox/ 22 | htmlcov/ 23 | .coverage 24 | .coverage.* 25 | .*cache 26 | nosetests.xml 27 | coverage.xml 28 | *.cover 29 | tests/data/common_wheels/ 30 | 31 | # Misc 32 | *~ 33 | .*.sw? 34 | .env/ 35 | .venv/ 36 | 37 | # For IntelliJ IDEs (basically PyCharm) 38 | .idea/ 39 | 40 | # For Visual Studio Code 41 | .vscode/ 42 | 43 | # For Sublime Text 44 | *.sublime-workspace 45 | *.sublime-project 46 | 47 | # Scratch Pad for experiments 48 | .scratch/ 49 | 50 | # Mac 51 | .DS_Store 52 | 53 | # Profiling related artifacts 54 | *.prof 55 | -------------------------------------------------------------------------------- /src/pip/_vendor/tenacity/compat.py: -------------------------------------------------------------------------------- 1 | """Utilities for providing backward compatibility.""" 2 | from pip._vendor import six 3 | 4 | 5 | def get_exc_info_from_future(future): 6 | """ 7 | Get an exc_info value from a Future. 8 | 9 | Given a a Future instance, retrieve an exc_info value suitable for passing 10 | in as the exc_info parameter to logging.Logger.log() and related methods. 11 | 12 | On Python 2, this will be a (type, value, traceback) triple. 13 | On Python 3, this will be an exception instance (with embedded traceback). 14 | 15 | If there was no exception, None is returned on both versions of Python. 16 | """ 17 | if six.PY3: 18 | return future.exception() 19 | else: 20 | ex, tb = future.exception_info() 21 | if ex is None: 22 | return None 23 | return type(ex), ex, tb 24 | -------------------------------------------------------------------------------- /tests/lib/options_helpers.py: -------------------------------------------------------------------------------- 1 | """Provides helper classes for testing option handling in pip 2 | """ 3 | 4 | from pip._internal.cli import cmdoptions 5 | from pip._internal.cli.base_command import Command 6 | from pip._internal.commands import CommandInfo, commands_dict 7 | 8 | 9 | class FakeCommand(Command): 10 | def main(self, args): 11 | index_opts = cmdoptions.make_option_group( 12 | cmdoptions.index_group, 13 | self.parser, 14 | ) 15 | self.parser.add_option_group(index_opts) 16 | return self.parse_args(args) 17 | 18 | 19 | class AddFakeCommandMixin: 20 | def setup(self): 21 | commands_dict["fake"] = CommandInfo( 22 | "tests.lib.options_helpers", 23 | "FakeCommand", 24 | "fake summary", 25 | ) 26 | 27 | def teardown(self): 28 | commands_dict.pop("fake") 29 | -------------------------------------------------------------------------------- /src/pip/_internal/models/scheme.py: -------------------------------------------------------------------------------- 1 | """ 2 | For types associated with installation schemes. 3 | 4 | For a general overview of available schemes and their context, see 5 | https://docs.python.org/3/install/index.html#alternate-installation. 6 | """ 7 | 8 | 9 | SCHEME_KEYS = ['platlib', 'purelib', 'headers', 'scripts', 'data'] 10 | 11 | 12 | class Scheme: 13 | """A Scheme holds paths which are used as the base directories for 14 | artifacts associated with a Python package. 15 | """ 16 | 17 | __slots__ = SCHEME_KEYS 18 | 19 | def __init__( 20 | self, 21 | platlib: str, 22 | purelib: str, 23 | headers: str, 24 | scripts: str, 25 | data: str, 26 | ) -> None: 27 | self.platlib = platlib 28 | self.purelib = purelib 29 | self.headers = headers 30 | self.scripts = scripts 31 | self.data = data 32 | -------------------------------------------------------------------------------- /tests/unit/test_check.py: -------------------------------------------------------------------------------- 1 | """Unit Tests for pip's dependency checking logic 2 | """ 3 | 4 | from unittest import mock 5 | 6 | from pip._internal.operations import check 7 | 8 | 9 | class TestInstalledDistributionsCall: 10 | 11 | def test_passes_correct_default_kwargs(self, monkeypatch): 12 | my_mock = mock.MagicMock(return_value=[]) 13 | monkeypatch.setattr(check, "get_installed_distributions", my_mock) 14 | 15 | check.create_package_set_from_installed() 16 | 17 | my_mock.assert_called_with(local_only=False, skip=()) 18 | 19 | def test_passes_any_given_kwargs(self, monkeypatch): 20 | my_mock = mock.MagicMock(return_value=[]) 21 | monkeypatch.setattr(check, "get_installed_distributions", my_mock) 22 | 23 | obj = object() 24 | check.create_package_set_from_installed(hi=obj) 25 | 26 | my_mock.assert_called_with(hi=obj) 27 | -------------------------------------------------------------------------------- /src/pip/_internal/cli/command_context.py: -------------------------------------------------------------------------------- 1 | from contextlib import ExitStack, contextmanager 2 | from typing import ContextManager, Iterator, TypeVar 3 | 4 | _T = TypeVar("_T", covariant=True) 5 | 6 | 7 | class CommandContextMixIn: 8 | def __init__(self) -> None: 9 | super().__init__() 10 | self._in_main_context = False 11 | self._main_context = ExitStack() 12 | 13 | @contextmanager 14 | def main_context(self) -> Iterator[None]: 15 | assert not self._in_main_context 16 | 17 | self._in_main_context = True 18 | try: 19 | with self._main_context: 20 | yield 21 | finally: 22 | self._in_main_context = False 23 | 24 | def enter_context(self, context_provider: ContextManager[_T]) -> _T: 25 | assert self._in_main_context 26 | 27 | return self._main_context.enter_context(context_provider) 28 | -------------------------------------------------------------------------------- /src/pip/_internal/utils/filetypes.py: -------------------------------------------------------------------------------- 1 | """Filetype information. 2 | """ 3 | 4 | from typing import Tuple 5 | 6 | from pip._internal.utils.misc import splitext 7 | 8 | WHEEL_EXTENSION = ".whl" 9 | BZ2_EXTENSIONS = (".tar.bz2", ".tbz") # type: Tuple[str, ...] 10 | XZ_EXTENSIONS = ( 11 | ".tar.xz", 12 | ".txz", 13 | ".tlz", 14 | ".tar.lz", 15 | ".tar.lzma", 16 | ) # type: Tuple[str, ...] 17 | ZIP_EXTENSIONS = (".zip", WHEEL_EXTENSION) # type: Tuple[str, ...] 18 | TAR_EXTENSIONS = (".tar.gz", ".tgz", ".tar") # type: Tuple[str, ...] 19 | ARCHIVE_EXTENSIONS = ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS 20 | 21 | 22 | def is_archive_file(name): 23 | # type: (str) -> bool 24 | """Return True if `name` is a considered as an archive file.""" 25 | ext = splitext(name)[1].lower() 26 | if ext in ARCHIVE_EXTENSIONS: 27 | return True 28 | return False 29 | -------------------------------------------------------------------------------- /tests/functional/test_vcs_bazaar.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains functional tests of the Bazaar class. 3 | """ 4 | 5 | import os 6 | 7 | import pytest 8 | 9 | from pip._internal.vcs.bazaar import Bazaar 10 | from pip._internal.vcs.versioncontrol import RemoteNotFoundError 11 | from tests.lib import is_bzr_installed, need_bzr 12 | 13 | 14 | @pytest.mark.skipif( 15 | 'TRAVIS' not in os.environ, 16 | reason='Bazaar is only required under Travis') 17 | def test_ensure_bzr_available(): 18 | """Make sure that bzr is available when running in Travis.""" 19 | assert is_bzr_installed() 20 | 21 | 22 | @need_bzr 23 | def test_get_remote_url__no_remote(script, tmpdir): 24 | repo_dir = tmpdir / 'temp-repo' 25 | repo_dir.mkdir() 26 | repo_dir = str(repo_dir) 27 | 28 | script.run('bzr', 'init', repo_dir) 29 | 30 | with pytest.raises(RemoteNotFoundError): 31 | Bazaar().get_remote_url(repo_dir) 32 | -------------------------------------------------------------------------------- /src/pip/_vendor/requests/hooks.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | requests.hooks 5 | ~~~~~~~~~~~~~~ 6 | 7 | This module provides the capabilities for the Requests hooks system. 8 | 9 | Available hooks: 10 | 11 | ``response``: 12 | The response generated from a Request. 13 | """ 14 | HOOKS = ['response'] 15 | 16 | 17 | def default_hooks(): 18 | return {event: [] for event in HOOKS} 19 | 20 | # TODO: response is the only one 21 | 22 | 23 | def dispatch_hook(key, hooks, hook_data, **kwargs): 24 | """Dispatches a hook dictionary on a given piece of data.""" 25 | hooks = hooks or {} 26 | hooks = hooks.get(key) 27 | if hooks: 28 | if hasattr(hooks, '__call__'): 29 | hooks = [hooks] 30 | for hook in hooks: 31 | _hook_data = hook(hook_data, **kwargs) 32 | if _hook_data is not None: 33 | hook_data = _hook_data 34 | return hook_data 35 | -------------------------------------------------------------------------------- /src/pip/_vendor/pep517/compat.py: -------------------------------------------------------------------------------- 1 | """Python 2/3 compatibility""" 2 | import json 3 | import sys 4 | 5 | 6 | # Handle reading and writing JSON in UTF-8, on Python 3 and 2. 7 | 8 | if sys.version_info[0] >= 3: 9 | # Python 3 10 | def write_json(obj, path, **kwargs): 11 | with open(path, 'w', encoding='utf-8') as f: 12 | json.dump(obj, f, **kwargs) 13 | 14 | def read_json(path): 15 | with open(path, 'r', encoding='utf-8') as f: 16 | return json.load(f) 17 | 18 | else: 19 | # Python 2 20 | def write_json(obj, path, **kwargs): 21 | with open(path, 'wb') as f: 22 | json.dump(obj, f, encoding='utf-8', **kwargs) 23 | 24 | def read_json(path): 25 | with open(path, 'rb') as f: 26 | return json.load(f) 27 | 28 | 29 | # FileNotFoundError 30 | 31 | try: 32 | FileNotFoundError = FileNotFoundError 33 | except NameError: 34 | FileNotFoundError = IOError 35 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS.txt 2 | include LICENSE.txt 3 | include NEWS.rst 4 | include README.rst 5 | include pyproject.toml 6 | 7 | include src/pip/_vendor/README.rst 8 | include src/pip/_vendor/vendor.txt 9 | recursive-include src/pip/_vendor *LICENSE* 10 | recursive-include src/pip/_vendor *COPYING* 11 | 12 | include docs/docutils.conf 13 | 14 | exclude .coveragerc 15 | exclude .mailmap 16 | exclude .appveyor.yml 17 | exclude .travis.yml 18 | exclude .readthedocs.yml 19 | exclude .pre-commit-config.yaml 20 | exclude tox.ini 21 | exclude noxfile.py 22 | 23 | recursive-include src/pip/_vendor *.pem 24 | recursive-include src/pip/_vendor py.typed 25 | recursive-include docs *.css *.py *.rst *.md 26 | 27 | exclude src/pip/_vendor/six 28 | exclude src/pip/_vendor/six/moves 29 | recursive-exclude src/pip/_vendor *.pyi 30 | 31 | prune .github 32 | prune .azure-pipelines 33 | prune docs/build 34 | prune news 35 | prune tasks 36 | prune tests 37 | prune tools 38 | -------------------------------------------------------------------------------- /tests/functional/test_vcs_subversion.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from pip._internal.vcs.subversion import Subversion 4 | from pip._internal.vcs.versioncontrol import RemoteNotFoundError 5 | from tests.lib import _create_svn_repo, need_svn 6 | 7 | 8 | @need_svn 9 | def test_get_remote_url__no_remote(script, tmpdir): 10 | repo_dir = tmpdir / 'temp-repo' 11 | repo_dir.mkdir() 12 | repo_dir = str(repo_dir) 13 | 14 | _create_svn_repo(script, repo_dir) 15 | 16 | with pytest.raises(RemoteNotFoundError): 17 | Subversion().get_remote_url(repo_dir) 18 | 19 | 20 | @need_svn 21 | def test_get_remote_url__no_remote_with_setup(script, tmpdir): 22 | repo_dir = tmpdir / 'temp-repo' 23 | repo_dir.mkdir() 24 | setup = repo_dir / "setup.py" 25 | setup.touch() 26 | repo_dir = str(repo_dir) 27 | 28 | _create_svn_repo(script, repo_dir) 29 | 30 | with pytest.raises(RemoteNotFoundError): 31 | Subversion().get_remote_url(repo_dir) 32 | -------------------------------------------------------------------------------- /tests/unit/test_cmdoptions.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from pip._internal.cli.cmdoptions import _convert_python_version 4 | 5 | 6 | @pytest.mark.parametrize('value, expected', [ 7 | ('', (None, None)), 8 | ('2', ((2,), None)), 9 | ('3', ((3,), None)), 10 | ('3.7', ((3, 7), None)), 11 | ('3.7.3', ((3, 7, 3), None)), 12 | # Test strings without dots of length bigger than 1. 13 | ('34', ((3, 4), None)), 14 | # Test a 2-digit minor version. 15 | ('310', ((3, 10), None)), 16 | # Test some values that fail to parse. 17 | ('ab', ((), 'each version part must be an integer')), 18 | ('3a', ((), 'each version part must be an integer')), 19 | ('3.7.a', ((), 'each version part must be an integer')), 20 | ('3.7.3.1', ((), 'at most three version parts are allowed')), 21 | ]) 22 | def test_convert_python_version(value, expected): 23 | actual = _convert_python_version(value) 24 | assert actual == expected, f'actual: {actual!r}' 25 | -------------------------------------------------------------------------------- /src/pip/_internal/distributions/__init__.py: -------------------------------------------------------------------------------- 1 | from pip._internal.distributions.base import AbstractDistribution 2 | from pip._internal.distributions.sdist import SourceDistribution 3 | from pip._internal.distributions.wheel import WheelDistribution 4 | from pip._internal.req.req_install import InstallRequirement 5 | 6 | 7 | def make_distribution_for_install_requirement( 8 | install_req: InstallRequirement, 9 | ) -> AbstractDistribution: 10 | """Returns a Distribution for the given InstallRequirement""" 11 | # Editable requirements will always be source distributions. They use the 12 | # legacy logic until we create a modern standard for them. 13 | if install_req.editable: 14 | return SourceDistribution(install_req) 15 | 16 | # If it's a wheel, it's a WheelDistribution 17 | if install_req.is_wheel: 18 | return WheelDistribution(install_req) 19 | 20 | # Otherwise, a SourceDistribution 21 | return SourceDistribution(install_req) 22 | -------------------------------------------------------------------------------- /tests/unit/test_vcs_mercurial.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains functional tests of the Mercurial class. 3 | """ 4 | 5 | import configparser 6 | import os 7 | 8 | from pip._internal.utils.misc import hide_url 9 | from pip._internal.vcs.mercurial import Mercurial 10 | from tests.lib import need_mercurial 11 | 12 | 13 | @need_mercurial 14 | def test_mercurial_switch_updates_config_file_when_found(tmpdir): 15 | hg = Mercurial() 16 | options = hg.make_rev_options() 17 | hg_dir = os.path.join(tmpdir, '.hg') 18 | os.mkdir(hg_dir) 19 | 20 | config = configparser.RawConfigParser() 21 | config.add_section('paths') 22 | config.set('paths', 'default', 'old_url') 23 | 24 | hgrc_path = os.path.join(hg_dir, 'hgrc') 25 | with open(hgrc_path, 'w') as f: 26 | config.write(f) 27 | hg.switch(tmpdir, hide_url('new_url'), options) 28 | 29 | config.read(hgrc_path) 30 | 31 | default_path = config.get('paths', 'default') 32 | assert default_path == 'new_url' 33 | -------------------------------------------------------------------------------- /src/pip/_vendor/cachecontrol/cache.py: -------------------------------------------------------------------------------- 1 | """ 2 | The cache object API for implementing caches. The default is a thread 3 | safe in-memory dictionary. 4 | """ 5 | from threading import Lock 6 | 7 | 8 | class BaseCache(object): 9 | 10 | def get(self, key): 11 | raise NotImplementedError() 12 | 13 | def set(self, key, value): 14 | raise NotImplementedError() 15 | 16 | def delete(self, key): 17 | raise NotImplementedError() 18 | 19 | def close(self): 20 | pass 21 | 22 | 23 | class DictCache(BaseCache): 24 | 25 | def __init__(self, init_dict=None): 26 | self.lock = Lock() 27 | self.data = init_dict or {} 28 | 29 | def get(self, key): 30 | return self.data.get(key, None) 31 | 32 | def set(self, key, value): 33 | with self.lock: 34 | self.data.update({key: value}) 35 | 36 | def delete(self, key): 37 | with self.lock: 38 | if key in self.data: 39 | self.data.pop(key) 40 | -------------------------------------------------------------------------------- /src/pip/_internal/utils/inject_securetransport.py: -------------------------------------------------------------------------------- 1 | """A helper module that injects SecureTransport, on import. 2 | 3 | The import should be done as early as possible, to ensure all requests and 4 | sessions (or whatever) are created after injecting SecureTransport. 5 | 6 | Note that we only do the injection on macOS, when the linked OpenSSL is too 7 | old to handle TLSv1.2. 8 | """ 9 | 10 | import sys 11 | 12 | 13 | def inject_securetransport(): 14 | # type: () -> None 15 | # Only relevant on macOS 16 | if sys.platform != "darwin": 17 | return 18 | 19 | try: 20 | import ssl 21 | except ImportError: 22 | return 23 | 24 | # Checks for OpenSSL 1.0.1 25 | if ssl.OPENSSL_VERSION_NUMBER >= 0x1000100F: 26 | return 27 | 28 | try: 29 | from pip._vendor.urllib3.contrib import securetransport 30 | except (ImportError, OSError): 31 | return 32 | 33 | securetransport.inject_into_urllib3() 34 | 35 | 36 | inject_securetransport() 37 | -------------------------------------------------------------------------------- /docs/html/development/architecture/index.rst: -------------------------------------------------------------------------------- 1 | .. _architecture-pip-internals: 2 | 3 | =============================== 4 | Architecture of pip's internals 5 | =============================== 6 | 7 | .. note:: 8 | 9 | This section of the documentation is currently being written. pip 10 | developers welcome your help to complete this documentation. If 11 | you're interested in helping out, please let us know in the 12 | `tracking issue`_, or just go ahead and submit a pull request and 13 | mention it in that tracking issue. 14 | 15 | .. note:: 16 | 17 | Direct use of pip's internals is *not supported*, and these internals 18 | can change at any time. For more details, see :ref:`Using pip from 19 | your program`. 20 | 21 | 22 | .. toctree:: 23 | :maxdepth: 2 24 | 25 | overview 26 | anatomy 27 | configuration-files 28 | package-finding 29 | command-line-interface 30 | upgrade-options 31 | 32 | 33 | .. _`tracking issue`: https://github.com/pypa/pip/issues/6831 34 | -------------------------------------------------------------------------------- /tests/data/indexes/datarequire/fakepackage/index.html: -------------------------------------------------------------------------------- 1 | Links for fakepackage

Links for fakepackage

2 | fakepackage-1.0.0.tar.gz
3 | fakepackage-2.6.0.tar.gz
4 | fakepackage-2.7.0.tar.gz
5 | fakepackage-3.3.0.tar.gz
6 | fakepackage-9.9.9.tar.gz
7 | 8 | -------------------------------------------------------------------------------- /src/pip/_vendor/cachecontrol/caches/redis_cache.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | 3 | from datetime import datetime 4 | from pip._vendor.cachecontrol.cache import BaseCache 5 | 6 | 7 | class RedisCache(BaseCache): 8 | 9 | def __init__(self, conn): 10 | self.conn = conn 11 | 12 | def get(self, key): 13 | return self.conn.get(key) 14 | 15 | def set(self, key, value, expires=None): 16 | if not expires: 17 | self.conn.set(key, value) 18 | else: 19 | expires = expires - datetime.utcnow() 20 | self.conn.setex(key, int(expires.total_seconds()), value) 21 | 22 | def delete(self, key): 23 | self.conn.delete(key) 24 | 25 | def clear(self): 26 | """Helper for clearing all the keys in a database. Use with 27 | caution!""" 28 | for key in self.conn.keys(): 29 | self.conn.delete(key) 30 | 31 | def close(self): 32 | """Redis uses connection pooling, no need to close the connection.""" 33 | pass 34 | -------------------------------------------------------------------------------- /tests/functional/test_cli.py: -------------------------------------------------------------------------------- 1 | """Basic CLI functionality checks. 2 | """ 3 | from textwrap import dedent 4 | 5 | import pytest 6 | 7 | 8 | @pytest.mark.parametrize("entrypoint", [ 9 | ("fake_pip = pip._internal.main:main",), 10 | ("fake_pip = pip._internal:main",), 11 | ("fake_pip = pip:main",), 12 | ]) 13 | def test_entrypoints_work(entrypoint, script): 14 | fake_pkg = script.temp_path / "fake_pkg" 15 | fake_pkg.mkdir() 16 | fake_pkg.joinpath("setup.py").write_text(dedent(""" 17 | from setuptools import setup 18 | 19 | setup( 20 | name="fake-pip", 21 | version="0.1.0", 22 | entry_points={{ 23 | "console_scripts": [ 24 | {!r} 25 | ] 26 | }} 27 | ) 28 | """.format(entrypoint))) 29 | 30 | script.pip("install", "-vvv", str(fake_pkg)) 31 | result = script.pip("-V") 32 | result2 = script.run("fake_pip", "-V", allow_stderr_warning=True) 33 | assert result.stdout == result2.stdout 34 | assert "old script wrapper" in result2.stderr 35 | -------------------------------------------------------------------------------- /docs/man/index.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ======== 4 | Man Page 5 | ======== 6 | 7 | SYNOPSIS 8 | ******** 9 | 10 | pip [options] 11 | 12 | DESCRIPTION 13 | *********** 14 | 15 | pip is the PyPA recommended package manager for Python packages 16 | 17 | OPTIONS 18 | ******* 19 | 20 | .. pip-general-options:: 21 | 22 | COMMANDS 23 | ******** 24 | 25 | pip-install(1) 26 | Install packages. 27 | 28 | pip-download(1) 29 | Download packages. 30 | 31 | pip-uninstall(1) 32 | Uninstall packages. 33 | 34 | pip-freeze(1) 35 | Output installed packages in requirements format. 36 | 37 | pip-list(1) 38 | List installed packages. 39 | 40 | pip-show(1) 41 | Show information about installed packages. 42 | 43 | pip-check(1) 44 | Verify installed packages have compatible dependencies. 45 | 46 | pip-search(1) 47 | Search PyPI for packages. 48 | 49 | pip-wheel(1) 50 | Build wheels from your requirements. 51 | 52 | pip-hash(1) 53 | Compute hashes of package archives. 54 | 55 | pip-help(1) 56 | Show help for pip commands. 57 | -------------------------------------------------------------------------------- /docs/html/development/index.rst: -------------------------------------------------------------------------------- 1 | =========== 2 | Development 3 | =========== 4 | 5 | pip is a volunteer maintained open source project and we welcome contributions 6 | of all forms. The sections below will help you get started with development, 7 | testing, and documentation. 8 | 9 | You can also join ``#pypa`` (general packaging discussion and user support) and 10 | ``#pypa-dev`` (discussion about development of packaging tools) `on Libera.chat`_, 11 | or the `distutils-sig mailing list`_, to ask questions or get involved. 12 | 13 | .. toctree:: 14 | :maxdepth: 2 15 | 16 | getting-started 17 | contributing 18 | ci 19 | issue-triage 20 | architecture/index 21 | release-process 22 | vendoring-policy 23 | 24 | .. note:: 25 | 26 | pip's development documentation has been rearranged and some older 27 | references might be broken. 28 | 29 | .. _`on Libera.chat`: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev 30 | .. _`distutils-sig mailing list`: https://mail.python.org/mailman3/lists/distutils-sig.python.org/ 31 | -------------------------------------------------------------------------------- /src/pip/_vendor/urllib3/packages/ssl_match_hostname/__init__.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | try: 4 | # Our match_hostname function is the same as 3.10's, so we only want to 5 | # import the match_hostname function if it's at least that good. 6 | # We also fallback on Python 3.10+ because our code doesn't emit 7 | # deprecation warnings and is the same as Python 3.10 otherwise. 8 | if sys.version_info < (3, 5) or sys.version_info >= (3, 10): 9 | raise ImportError("Fallback to vendored code") 10 | 11 | from ssl import CertificateError, match_hostname 12 | except ImportError: 13 | try: 14 | # Backport of the function from a pypi module 15 | from backports.ssl_match_hostname import ( # type: ignore 16 | CertificateError, 17 | match_hostname, 18 | ) 19 | except ImportError: 20 | # Our vendored copy 21 | from ._implementation import CertificateError, match_hostname # type: ignore 22 | 23 | # Not needed, but documenting what we provide. 24 | __all__ = ("CertificateError", "match_hostname") 25 | -------------------------------------------------------------------------------- /src/pip/_vendor/html5lib/filters/alphabeticalattributes.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from . import base 4 | 5 | from collections import OrderedDict 6 | 7 | 8 | def _attr_key(attr): 9 | """Return an appropriate key for an attribute for sorting 10 | 11 | Attributes have a namespace that can be either ``None`` or a string. We 12 | can't compare the two because they're different types, so we convert 13 | ``None`` to an empty string first. 14 | 15 | """ 16 | return (attr[0][0] or ''), attr[0][1] 17 | 18 | 19 | class Filter(base.Filter): 20 | """Alphabetizes attributes for elements""" 21 | def __iter__(self): 22 | for token in base.Filter.__iter__(self): 23 | if token["type"] in ("StartTag", "EmptyTag"): 24 | attrs = OrderedDict() 25 | for name, value in sorted(token["data"].items(), 26 | key=_attr_key): 27 | attrs[name] = value 28 | token["data"] = attrs 29 | yield token 30 | -------------------------------------------------------------------------------- /src/pip/_internal/models/candidate.py: -------------------------------------------------------------------------------- 1 | from pip._vendor.packaging.version import parse as parse_version 2 | 3 | from pip._internal.models.link import Link 4 | from pip._internal.utils.models import KeyBasedCompareMixin 5 | 6 | 7 | class InstallationCandidate(KeyBasedCompareMixin): 8 | """Represents a potential "candidate" for installation. 9 | """ 10 | 11 | __slots__ = ["name", "version", "link"] 12 | 13 | def __init__(self, name: str, version: str, link: Link) -> None: 14 | self.name = name 15 | self.version = parse_version(version) 16 | self.link = link 17 | 18 | super().__init__( 19 | key=(self.name, self.version, self.link), 20 | defining_class=InstallationCandidate 21 | ) 22 | 23 | def __repr__(self) -> str: 24 | return "".format( 25 | self.name, self.version, self.link, 26 | ) 27 | 28 | def __str__(self) -> str: 29 | return '{!r} candidate (version {} at {})'.format( 30 | self.name, self.version, self.link, 31 | ) 32 | -------------------------------------------------------------------------------- /tools/tox_pip.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import subprocess 4 | import sys 5 | from glob import glob 6 | from typing import List 7 | 8 | VIRTUAL_ENV = os.environ['VIRTUAL_ENV'] 9 | TOX_PIP_DIR = os.path.join(VIRTUAL_ENV, 'pip') 10 | 11 | 12 | def pip(args: List[str]) -> None: 13 | # First things first, get a recent (stable) version of pip. 14 | if not os.path.exists(TOX_PIP_DIR): 15 | subprocess.check_call([sys.executable, '-m', 'pip', 16 | '--disable-pip-version-check', 17 | 'install', '-t', TOX_PIP_DIR, 18 | 'pip']) 19 | shutil.rmtree(glob(os.path.join(TOX_PIP_DIR, 'pip-*.dist-info'))[0]) 20 | # And use that version. 21 | pypath_env = os.environ.get('PYTHONPATH') 22 | pypath = pypath_env.split(os.pathsep) if pypath_env is not None else [] 23 | pypath.insert(0, TOX_PIP_DIR) 24 | os.environ['PYTHONPATH'] = os.pathsep.join(pypath) 25 | subprocess.check_call([sys.executable, '-m', 'pip'] + args) 26 | 27 | 28 | if __name__ == '__main__': 29 | pip(sys.argv[1:]) 30 | -------------------------------------------------------------------------------- /src/pip/_vendor/pyparsing.LICENSE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining 2 | a copy of this software and associated documentation files (the 3 | "Software"), to deal in the Software without restriction, including 4 | without limitation the rights to use, copy, modify, merge, publish, 5 | distribute, sublicense, and/or sell copies of the Software, and to 6 | permit persons to whom the Software is furnished to do so, subject to 7 | the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be 10 | included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 13 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 14 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 16 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 17 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 18 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /docs/html/cli/pip_search.rst: -------------------------------------------------------------------------------- 1 | .. _`pip search`: 2 | 3 | ========== 4 | pip search 5 | ========== 6 | 7 | 8 | 9 | Usage 10 | ===== 11 | 12 | .. tab:: Unix/macOS 13 | 14 | .. pip-command-usage:: search "python -m pip" 15 | 16 | .. tab:: Windows 17 | 18 | .. pip-command-usage:: search "py -m pip" 19 | 20 | 21 | Description 22 | =========== 23 | 24 | .. pip-command-description:: search 25 | 26 | 27 | Options 28 | ======= 29 | 30 | .. pip-command-options:: search 31 | 32 | 33 | Examples 34 | ======== 35 | 36 | #. Search for "peppercorn" 37 | 38 | .. tab:: Unix/macOS 39 | 40 | .. code-block:: console 41 | 42 | $ python -m pip search peppercorn 43 | pepperedform - Helpers for using peppercorn with formprocess. 44 | peppercorn - A library for converting a token stream into [...] 45 | 46 | .. tab:: Windows 47 | 48 | .. code-block:: console 49 | 50 | C:\> py -m pip search peppercorn 51 | pepperedform - Helpers for using peppercorn with formprocess. 52 | peppercorn - A library for converting a token stream into [...] 53 | -------------------------------------------------------------------------------- /tests/data/packages/BrokenEmitsUTF8/setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import sys 4 | from distutils.core import setup 5 | 6 | 7 | class FakeError(Exception): 8 | pass 9 | 10 | if sys.argv[1] == 'install': 11 | if hasattr(sys.stdout, 'buffer'): 12 | sys.stdout.buffer.write('\nThis package prints out UTF-8 stuff like:\n'.encode('utf-8')) 13 | sys.stdout.buffer.write('* return type of ‘main’ is not ‘int’\n'.encode('utf-8')) 14 | sys.stdout.buffer.write('* Björk Guðmundsdóttir [ˈpjœr̥k ˈkvʏðmʏntsˌtoʊhtɪr]'.encode('utf-8')) 15 | else: 16 | pass 17 | sys.stdout.write('\nThis package prints out UTF-8 stuff like:\n') 18 | sys.stdout.write('* return type of \xe2\x80\x98main\xe2\x80\x99 is not \xe2\x80\x98int\xe2\x80\x99\n') 19 | sys.stdout.write('* Bj\xc3\xb6rk Gu\xc3\xb0mundsd\xc3\xb3ttir [\xcb\x88pj\xc5\x93r\xcc\xa5k \xcb\x88kv\xca\x8f\xc3\xb0m\xca\x8fnts\xcb\x8cto\xca\x8aht\xc9\xaar]\n') 20 | 21 | raise FakeError('this package designed to fail on install') 22 | 23 | setup(name='broken', 24 | version='0.2', 25 | py_modules=['broken'], 26 | ) 27 | -------------------------------------------------------------------------------- /tools/news/template.rst: -------------------------------------------------------------------------------- 1 | {% set underline = "=" %} 2 | 3 | {{ underline * ((top_line)|length) }} 4 | {% for section in sections %} 5 | {% set underline = "-" %} 6 | {% if section %} 7 | {{ section }} 8 | {{ underline * section|length }}{% set underline = "~" %} 9 | 10 | {% endif %} 11 | {% if sections[section] %} 12 | {% for category, val in definitions.items() if category in sections[section] and category != 'trivial' %} 13 | 14 | {{ definitions[category]['name'] }} 15 | {{ underline * definitions[category]['name']|length }} 16 | 17 | {% if definitions[category]['showcontent'] %} 18 | {% for text, values in sections[section][category]|dictsort(by='value') %} 19 | - {{ text }}{% if category != 'vendor' and category != 'process' %} ({{ values|sort|join(', ') }}){% endif %} 20 | 21 | {% endfor %} 22 | {% else %} 23 | - {{ sections[section][category]['']|sort|join(', ') }} 24 | 25 | 26 | {% endif %} 27 | {% if sections[section][category]|length == 0 %} 28 | 29 | No significant changes. 30 | 31 | 32 | {% else %} 33 | {% endif %} 34 | {% endfor %} 35 | {% else %} 36 | 37 | No significant changes. 38 | 39 | 40 | {% endif %} 41 | {% endfor %} 42 | -------------------------------------------------------------------------------- /src/pip/_vendor/certifi/LICENSE: -------------------------------------------------------------------------------- 1 | This packge contains a modified version of ca-bundle.crt: 2 | 3 | ca-bundle.crt -- Bundle of CA Root Certificates 4 | 5 | Certificate data from Mozilla as of: Thu Nov 3 19:04:19 2011# 6 | This is a bundle of X.509 certificates of public Certificate Authorities 7 | (CA). These were automatically extracted from Mozilla's root certificates 8 | file (certdata.txt). This file can be found in the mozilla source tree: 9 | http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1# 10 | It contains the certificates in PEM format and therefore 11 | can be directly used with curl / libcurl / php_curl, or with 12 | an Apache+mod_ssl webserver for SSL client authentication. 13 | Just configure this file as the SSLCACertificateFile.# 14 | 15 | ***** BEGIN LICENSE BLOCK ***** 16 | This Source Code Form is subject to the terms of the Mozilla Public License, 17 | v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain 18 | one at http://mozilla.org/MPL/2.0/. 19 | 20 | ***** END LICENSE BLOCK ***** 21 | @(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $ 22 | -------------------------------------------------------------------------------- /src/pip/_vendor/six.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2020 Benjamin Peterson 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /src/pip/_vendor/urllib3/contrib/_appengine_environ.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module provides means to detect the App Engine environment. 3 | """ 4 | 5 | import os 6 | 7 | 8 | def is_appengine(): 9 | return is_local_appengine() or is_prod_appengine() 10 | 11 | 12 | def is_appengine_sandbox(): 13 | """Reports if the app is running in the first generation sandbox. 14 | 15 | The second generation runtimes are technically still in a sandbox, but it 16 | is much less restrictive, so generally you shouldn't need to check for it. 17 | see https://cloud.google.com/appengine/docs/standard/runtimes 18 | """ 19 | return is_appengine() and os.environ["APPENGINE_RUNTIME"] == "python27" 20 | 21 | 22 | def is_local_appengine(): 23 | return "APPENGINE_RUNTIME" in os.environ and os.environ.get( 24 | "SERVER_SOFTWARE", "" 25 | ).startswith("Development/") 26 | 27 | 28 | def is_prod_appengine(): 29 | return "APPENGINE_RUNTIME" in os.environ and os.environ.get( 30 | "SERVER_SOFTWARE", "" 31 | ).startswith("Google App Engine/") 32 | 33 | 34 | def is_prod_appengine_mvms(): 35 | """Deprecated.""" 36 | return False 37 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2021 The pip developers (see AUTHORS.txt file) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /src/pip/_vendor/resolvelib/structs.pyi: -------------------------------------------------------------------------------- 1 | from abc import ABCMeta 2 | from typing import ( 3 | Callable, 4 | Container, 5 | Generic, 6 | Iterable, 7 | Iterator, 8 | Tuple, 9 | TypeVar, 10 | Union, 11 | ) 12 | 13 | KT = TypeVar("KT") 14 | RT = TypeVar("RT") 15 | CT = TypeVar("CT") 16 | _T = TypeVar("_T") 17 | Matches = Union[Iterable[CT], Callable[[], Iterator[CT]]] 18 | 19 | class IterableView(Container[CT], Iterable[CT], metaclass=ABCMeta): 20 | pass 21 | 22 | class DirectedGraph(Generic[KT]): 23 | def __iter__(self) -> Iterator[KT]: ... 24 | def __len__(self) -> int: ... 25 | def __contains__(self, key: KT) -> bool: ... 26 | def copy(self) -> "DirectedGraph[KT]": ... 27 | def add(self, key: KT) -> None: ... 28 | def remove(self, key: KT) -> None: ... 29 | def connected(self, f: KT, t: KT) -> bool: ... 30 | def connect(self, f: KT, t: KT) -> None: ... 31 | def iter_edges(self) -> Iterable[Tuple[KT, KT]]: ... 32 | def iter_children(self, key: KT) -> Iterable[KT]: ... 33 | def iter_parents(self, key: KT) -> Iterable[KT]: ... 34 | 35 | def build_iter_view(matches: Matches) -> IterableView[CT]: ... 36 | -------------------------------------------------------------------------------- /src/pip/_vendor/tomli/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Taneli Hukkinen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/pip/_vendor/pkg_resources/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016 Jason R Coombs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/pip/_vendor/distlib/_backport/misc.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) 2012 The Python Software Foundation. 4 | # See LICENSE.txt and CONTRIBUTORS.txt. 5 | # 6 | """Backports for individual classes and functions.""" 7 | 8 | import os 9 | import sys 10 | 11 | __all__ = ['cache_from_source', 'callable', 'fsencode'] 12 | 13 | 14 | try: 15 | from imp import cache_from_source 16 | except ImportError: 17 | def cache_from_source(py_file, debug=__debug__): 18 | ext = debug and 'c' or 'o' 19 | return py_file + ext 20 | 21 | 22 | try: 23 | callable = callable 24 | except NameError: 25 | from collections import Callable 26 | 27 | def callable(obj): 28 | return isinstance(obj, Callable) 29 | 30 | 31 | try: 32 | fsencode = os.fsencode 33 | except AttributeError: 34 | def fsencode(filename): 35 | if isinstance(filename, bytes): 36 | return filename 37 | elif isinstance(filename, str): 38 | return filename.encode(sys.getfilesystemencoding()) 39 | else: 40 | raise TypeError("expect bytes or str, not %s" % 41 | type(filename).__name__) 42 | -------------------------------------------------------------------------------- /src/pip/_vendor/html5lib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006-2013 James Graham and other contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /src/pip/_vendor/pep517/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Thomas Kluyver 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/pip/_internal/utils/_log.py: -------------------------------------------------------------------------------- 1 | """Customize logging 2 | 3 | Defines custom logger class for the `logger.verbose(...)` method. 4 | 5 | init_logging() must be called before any other modules that call logging.getLogger. 6 | """ 7 | 8 | import logging 9 | from typing import Any, cast 10 | 11 | # custom log level for `--verbose` output 12 | # between DEBUG and INFO 13 | VERBOSE = 15 14 | 15 | 16 | class VerboseLogger(logging.Logger): 17 | """Custom Logger, defining a verbose log-level 18 | 19 | VERBOSE is between INFO and DEBUG. 20 | """ 21 | 22 | def verbose(self, msg: str, *args: Any, **kwargs: Any) -> None: 23 | return self.log(VERBOSE, msg, *args, **kwargs) 24 | 25 | 26 | def getLogger(name: str) -> VerboseLogger: 27 | """logging.getLogger, but ensures our VerboseLogger class is returned""" 28 | return cast(VerboseLogger, logging.getLogger(name)) 29 | 30 | 31 | def init_logging() -> None: 32 | """Register our VerboseLogger and VERBOSE log level. 33 | 34 | Should be called before any calls to getLogger(), 35 | i.e. in pip._internal.__init__ 36 | """ 37 | logging.setLoggerClass(VerboseLogger) 38 | logging.addLevelName(VERBOSE, "VERBOSE") 39 | -------------------------------------------------------------------------------- /src/pip/_internal/utils/entrypoints.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from typing import List, Optional 3 | 4 | from pip._internal.cli.main import main 5 | 6 | 7 | def _wrapper(args=None): 8 | # type: (Optional[List[str]]) -> int 9 | """Central wrapper for all old entrypoints. 10 | 11 | Historically pip has had several entrypoints defined. Because of issues 12 | arising from PATH, sys.path, multiple Pythons, their interactions, and most 13 | of them having a pip installed, users suffer every time an entrypoint gets 14 | moved. 15 | 16 | To alleviate this pain, and provide a mechanism for warning users and 17 | directing them to an appropriate place for help, we now define all of 18 | our old entrypoints as wrappers for the current one. 19 | """ 20 | sys.stderr.write( 21 | "WARNING: pip is being invoked by an old script wrapper. This will " 22 | "fail in a future version of pip.\n" 23 | "Please see https://github.com/pypa/pip/issues/5599 for advice on " 24 | "fixing the underlying issue.\n" 25 | "To avoid this problem you can invoke Python with '-m pip' instead of " 26 | "running pip directly.\n" 27 | ) 28 | return main(args) 29 | -------------------------------------------------------------------------------- /src/pip/_vendor/appdirs.LICENSE.txt: -------------------------------------------------------------------------------- 1 | # This is the MIT license 2 | 3 | Copyright (c) 2010 ActiveState Software Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a 6 | copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /src/pip/_internal/models/index.py: -------------------------------------------------------------------------------- 1 | import urllib.parse 2 | 3 | 4 | class PackageIndex: 5 | """Represents a Package Index and provides easier access to endpoints 6 | """ 7 | 8 | __slots__ = ['url', 'netloc', 'simple_url', 'pypi_url', 9 | 'file_storage_domain'] 10 | 11 | def __init__(self, url: str, file_storage_domain: str) -> None: 12 | super().__init__() 13 | self.url = url 14 | self.netloc = urllib.parse.urlsplit(url).netloc 15 | self.simple_url = self._url_for_path('simple') 16 | self.pypi_url = self._url_for_path('pypi') 17 | 18 | # This is part of a temporary hack used to block installs of PyPI 19 | # packages which depend on external urls only necessary until PyPI can 20 | # block such packages themselves 21 | self.file_storage_domain = file_storage_domain 22 | 23 | def _url_for_path(self, path: str) -> str: 24 | return urllib.parse.urljoin(self.url, path) 25 | 26 | 27 | PyPI = PackageIndex( 28 | 'https://pypi.org/', file_storage_domain='files.pythonhosted.org' 29 | ) 30 | TestPyPI = PackageIndex( 31 | 'https://test.pypi.org/', file_storage_domain='test-files.pythonhosted.org' 32 | ) 33 | -------------------------------------------------------------------------------- /src/pip/_vendor/html5lib/_trie/_base.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | try: 4 | from collections.abc import Mapping 5 | except ImportError: # Python 2.7 6 | from collections import Mapping 7 | 8 | 9 | class Trie(Mapping): 10 | """Abstract base class for tries""" 11 | 12 | def keys(self, prefix=None): 13 | # pylint:disable=arguments-differ 14 | keys = super(Trie, self).keys() 15 | 16 | if prefix is None: 17 | return set(keys) 18 | 19 | return {x for x in keys if x.startswith(prefix)} 20 | 21 | def has_keys_with_prefix(self, prefix): 22 | for key in self.keys(): 23 | if key.startswith(prefix): 24 | return True 25 | 26 | return False 27 | 28 | def longest_prefix(self, prefix): 29 | if prefix in self: 30 | return prefix 31 | 32 | for i in range(1, len(prefix) + 1): 33 | if prefix[:-i] in self: 34 | return prefix[:-i] 35 | 36 | raise KeyError(prefix) 37 | 38 | def longest_prefix_item(self, prefix): 39 | lprefix = self.longest_prefix(prefix) 40 | return (lprefix, self[lprefix]) 41 | -------------------------------------------------------------------------------- /src/pip/_vendor/urllib3/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2008-2020 Andrey Petrov and contributors (see CONTRIBUTORS.txt) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tools/release/check_version.py: -------------------------------------------------------------------------------- 1 | """Checks if the version is acceptable, as per this project's release process. 2 | """ 3 | 4 | import sys 5 | from datetime import datetime 6 | from typing import Optional 7 | 8 | from packaging.version import InvalidVersion, Version 9 | 10 | 11 | def is_this_a_good_version_number(string: str) -> Optional[str]: 12 | try: 13 | v = Version(string) 14 | except InvalidVersion as e: 15 | return str(e) 16 | 17 | if v.local: 18 | return "Nope. PyPI refuses local release versions." 19 | 20 | if v.dev: 21 | return "No development releases on PyPI. What are you even thinking?" 22 | 23 | if v.pre and v.pre[0] != "b": 24 | return "Only beta releases are allowed. No alphas." 25 | 26 | release = v.release 27 | expected_major = datetime.now().year % 100 28 | 29 | if len(release) not in [2, 3]: 30 | return "Not of the form: {0}.N or {0}.N.P".format(expected_major) 31 | 32 | return None 33 | 34 | 35 | def main() -> None: 36 | problem = is_this_a_good_version_number(sys.argv[1]) 37 | if problem is not None: 38 | print("ERROR:", problem) 39 | sys.exit(1) 40 | 41 | 42 | if __name__ == "__main__": 43 | main() 44 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/~good-first-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: (Maintainers Only) Good First Issue 3 | about: For maintainers, to create an issue that is good for new contributors 4 | labels: ["good first issue"] 5 | 6 | --- 7 | 8 | 9 | 10 | 11 | 12 | 13 | --- 14 | 15 | **Good First Issue**: This issue is a good starting point for first time contributors -- the process of fixing this should be a good introduction to pip's development workflow. If you've already contributed to pip, work on [another issue without this label](https://github.com/pypa/pip/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+-label%3A%22good+first+issue%22) instead. If there is not a corresponding pull request for this issue, it is up for grabs. For directions for getting set up, see our [Getting Started Guide](https://pip.pypa.io/en/latest/development/getting-started/). If you are working on this issue and have questions, feel free to ask them here, [`#pypa-dev` on Libera.chat](https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev), or the [distutils-sig mailing list](https://mail.python.org/mailman3/lists/distutils-sig.python.org/). 16 | -------------------------------------------------------------------------------- /tests/unit/test_network_utils.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from pip._internal.exceptions import NetworkConnectionError 4 | from pip._internal.network.utils import raise_for_status 5 | from tests.lib.requests_mocks import MockResponse 6 | 7 | 8 | @pytest.mark.parametrize(("status_code", "error_type"), [ 9 | (401, "Client Error"), 10 | (501, "Server Error"), 11 | ]) 12 | def test_raise_for_status_raises_exception(status_code, error_type): 13 | contents = b'downloaded' 14 | resp = MockResponse(contents) 15 | resp.status_code = status_code 16 | resp.url = "http://www.example.com/whatever.tgz" 17 | resp.reason = "Network Error" 18 | with pytest.raises(NetworkConnectionError) as exc: 19 | raise_for_status(resp) 20 | assert str(exc.info) == ( 21 | "{} {}: Network Error for url:" 22 | " http://www.example.com/whatever.tgz".format( 23 | status_code, error_type) 24 | ) 25 | 26 | 27 | def test_raise_for_status_does_not_raises_exception(): 28 | contents = b'downloaded' 29 | resp = MockResponse(contents) 30 | resp.status_code = 201 31 | resp.url = "http://www.example.com/whatever.tgz" 32 | resp.reason = "No error" 33 | return_value = raise_for_status(resp) 34 | assert return_value is None 35 | -------------------------------------------------------------------------------- /src/pip/_internal/operations/build/wheel.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | from typing import Optional 4 | 5 | from pip._vendor.pep517.wrappers import Pep517HookCaller 6 | 7 | from pip._internal.utils.subprocess import runner_with_spinner_message 8 | 9 | logger = logging.getLogger(__name__) 10 | 11 | 12 | def build_wheel_pep517( 13 | name, # type: str 14 | backend, # type: Pep517HookCaller 15 | metadata_directory, # type: str 16 | tempd, # type: str 17 | ): 18 | # type: (...) -> Optional[str] 19 | """Build one InstallRequirement using the PEP 517 build process. 20 | 21 | Returns path to wheel if successfully built. Otherwise, returns None. 22 | """ 23 | assert metadata_directory is not None 24 | try: 25 | logger.debug('Destination directory: %s', tempd) 26 | 27 | runner = runner_with_spinner_message( 28 | f'Building wheel for {name} (PEP 517)' 29 | ) 30 | with backend.subprocess_runner(runner): 31 | wheel_name = backend.build_wheel( 32 | tempd, 33 | metadata_directory=metadata_directory, 34 | ) 35 | except Exception: 36 | logger.error('Failed building wheel for %s', name) 37 | return None 38 | return os.path.join(tempd, wheel_name) 39 | -------------------------------------------------------------------------------- /src/pip/_internal/utils/pkg_resources.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, Iterable, List 2 | 3 | from pip._vendor.pkg_resources import yield_lines 4 | 5 | 6 | class DictMetadata: 7 | """IMetadataProvider that reads metadata files from a dictionary.""" 8 | 9 | def __init__(self, metadata): 10 | # type: (Dict[str, bytes]) -> None 11 | self._metadata = metadata 12 | 13 | def has_metadata(self, name): 14 | # type: (str) -> bool 15 | return name in self._metadata 16 | 17 | def get_metadata(self, name): 18 | # type: (str) -> str 19 | try: 20 | return self._metadata[name].decode() 21 | except UnicodeDecodeError as e: 22 | # Mirrors handling done in pkg_resources.NullProvider. 23 | e.reason += f" in {name} file" 24 | raise 25 | 26 | def get_metadata_lines(self, name): 27 | # type: (str) -> Iterable[str] 28 | return yield_lines(self.get_metadata(name)) 29 | 30 | def metadata_isdir(self, name): 31 | # type: (str) -> bool 32 | return False 33 | 34 | def metadata_listdir(self, name): 35 | # type: (str) -> List[str] 36 | return [] 37 | 38 | def run_script(self, script_name, namespace): 39 | # type: (str, str) -> None 40 | pass 41 | -------------------------------------------------------------------------------- /src/pip/_vendor/requests/_internal_utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | requests._internal_utils 5 | ~~~~~~~~~~~~~~ 6 | 7 | Provides utility functions that are consumed internally by Requests 8 | which depend on extremely few external helpers (such as compat) 9 | """ 10 | 11 | from .compat import is_py2, builtin_str, str 12 | 13 | 14 | def to_native_string(string, encoding='ascii'): 15 | """Given a string object, regardless of type, returns a representation of 16 | that string in the native string type, encoding and decoding where 17 | necessary. This assumes ASCII unless told otherwise. 18 | """ 19 | if isinstance(string, builtin_str): 20 | out = string 21 | else: 22 | if is_py2: 23 | out = string.encode(encoding) 24 | else: 25 | out = string.decode(encoding) 26 | 27 | return out 28 | 29 | 30 | def unicode_is_ascii(u_string): 31 | """Determine if unicode string only contains ASCII characters. 32 | 33 | :param str u_string: unicode string to check. Must be unicode 34 | and not Python 2 `str`. 35 | :rtype: bool 36 | """ 37 | assert isinstance(u_string, str) 38 | try: 39 | u_string.encode('ascii') 40 | return True 41 | except UnicodeEncodeError: 42 | return False 43 | -------------------------------------------------------------------------------- /src/pip/_vendor/msgpack/exceptions.py: -------------------------------------------------------------------------------- 1 | class UnpackException(Exception): 2 | """Base class for some exceptions raised while unpacking. 3 | 4 | NOTE: unpack may raise exception other than subclass of 5 | UnpackException. If you want to catch all error, catch 6 | Exception instead. 7 | """ 8 | 9 | 10 | class BufferFull(UnpackException): 11 | pass 12 | 13 | 14 | class OutOfData(UnpackException): 15 | pass 16 | 17 | 18 | class FormatError(ValueError, UnpackException): 19 | """Invalid msgpack format""" 20 | 21 | 22 | class StackError(ValueError, UnpackException): 23 | """Too nested""" 24 | 25 | 26 | # Deprecated. Use ValueError instead 27 | UnpackValueError = ValueError 28 | 29 | 30 | class ExtraData(UnpackValueError): 31 | """ExtraData is raised when there is trailing data. 32 | 33 | This exception is raised while only one-shot (not streaming) 34 | unpack. 35 | """ 36 | 37 | def __init__(self, unpacked, extra): 38 | self.unpacked = unpacked 39 | self.extra = extra 40 | 41 | def __str__(self): 42 | return "unpack(b) received extra data." 43 | 44 | 45 | # Deprecated. Use Exception instead to catch all exception during packing. 46 | PackException = Exception 47 | PackValueError = ValueError 48 | PackOverflowError = OverflowError 49 | -------------------------------------------------------------------------------- /src/pip/_vendor/tenacity/before.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Julien Danjou 2 | # Copyright 2016 Joshua Harlow 3 | # Copyright 2013-2014 Ray Holder 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | from pip._vendor.tenacity import _utils 18 | 19 | 20 | def before_nothing(retry_state): 21 | """Before call strategy that does nothing.""" 22 | 23 | 24 | def before_log(logger, log_level): 25 | """Before call strategy that logs to some logger the attempt.""" 26 | 27 | def log_it(retry_state): 28 | logger.log( 29 | log_level, 30 | "Starting call to '%s', this is the %s time calling it.", 31 | _utils.get_callback_name(retry_state.fn), 32 | _utils.to_ordinal(retry_state.attempt_number), 33 | ) 34 | 35 | return log_it 36 | -------------------------------------------------------------------------------- /src/pip/__main__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import warnings 4 | 5 | # Remove '' and current working directory from the first entry 6 | # of sys.path, if present to avoid using current directory 7 | # in pip commands check, freeze, install, list and show, 8 | # when invoked as python -m pip 9 | if sys.path[0] in ("", os.getcwd()): 10 | sys.path.pop(0) 11 | 12 | # If we are running from a wheel, add the wheel to sys.path 13 | # This allows the usage python pip-*.whl/pip install pip-*.whl 14 | if __package__ == "": 15 | # __file__ is pip-*.whl/pip/__main__.py 16 | # first dirname call strips of '/__main__.py', second strips off '/pip' 17 | # Resulting path is the name of the wheel itself 18 | # Add that to sys.path so we can import pip 19 | path = os.path.dirname(os.path.dirname(__file__)) 20 | sys.path.insert(0, path) 21 | 22 | if __name__ == "__main__": 23 | # Work around the error reported in #9540, pending a proper fix. 24 | # Note: It is essential the warning filter is set *before* importing 25 | # pip, as the deprecation happens at import time, not runtime. 26 | warnings.filterwarnings( 27 | "ignore", category=DeprecationWarning, module=".*packaging\\.version" 28 | ) 29 | from pip._internal.cli.main import main as _main 30 | 31 | sys.exit(_main()) 32 | -------------------------------------------------------------------------------- /src/pip/_vendor/html5lib/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | HTML parsing library based on the `WHATWG HTML specification 3 | `_. The parser is designed to be compatible with 4 | existing HTML found in the wild and implements well-defined error recovery that 5 | is largely compatible with modern desktop web browsers. 6 | 7 | Example usage:: 8 | 9 | from pip._vendor import html5lib 10 | with open("my_document.html", "rb") as f: 11 | tree = html5lib.parse(f) 12 | 13 | For convenience, this module re-exports the following names: 14 | 15 | * :func:`~.html5parser.parse` 16 | * :func:`~.html5parser.parseFragment` 17 | * :class:`~.html5parser.HTMLParser` 18 | * :func:`~.treebuilders.getTreeBuilder` 19 | * :func:`~.treewalkers.getTreeWalker` 20 | * :func:`~.serializer.serialize` 21 | """ 22 | 23 | from __future__ import absolute_import, division, unicode_literals 24 | 25 | from .html5parser import HTMLParser, parse, parseFragment 26 | from .treebuilders import getTreeBuilder 27 | from .treewalkers import getTreeWalker 28 | from .serializer import serialize 29 | 30 | __all__ = ["HTMLParser", "parse", "parseFragment", "getTreeBuilder", 31 | "getTreeWalker", "serialize"] 32 | 33 | # this has to be at the top level, see how setup.py parses this 34 | #: Distribution version number. 35 | __version__ = "1.1" 36 | -------------------------------------------------------------------------------- /tests/functional/test_hash.py: -------------------------------------------------------------------------------- 1 | """Tests for the ``pip hash`` command""" 2 | 3 | 4 | def test_basic_hash(script, tmpdir): 5 | """Run 'pip hash' through its default behavior.""" 6 | expected = ('--hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425' 7 | 'e73043362938b9824') 8 | result = script.pip('hash', _hello_file(tmpdir)) 9 | assert expected in str(result) 10 | 11 | 12 | def test_good_algo_option(script, tmpdir): 13 | """Make sure the -a option works.""" 14 | expected = ('--hash=sha512:9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caad' 15 | 'ae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e' 16 | '5c3adef46f73bcdec043') 17 | result = script.pip('hash', '-a', 'sha512', _hello_file(tmpdir)) 18 | assert expected in str(result) 19 | 20 | 21 | def test_bad_algo_option(script, tmpdir): 22 | """Make sure the -a option raises an error when given a bad operand.""" 23 | result = script.pip('hash', '-a', 'invalidname', _hello_file(tmpdir), 24 | expect_error=True) 25 | assert "invalid choice: 'invalidname'" in str(result) 26 | 27 | 28 | def _hello_file(tmpdir): 29 | """Return a temp file to hash containing "hello".""" 30 | file = tmpdir / 'hashable' 31 | file.write_text('hello') 32 | return file 33 | -------------------------------------------------------------------------------- /src/pip/_internal/operations/build/metadata.py: -------------------------------------------------------------------------------- 1 | """Metadata generation logic for source distributions. 2 | """ 3 | 4 | import os 5 | 6 | from pip._vendor.pep517.wrappers import Pep517HookCaller 7 | 8 | from pip._internal.build_env import BuildEnvironment 9 | from pip._internal.utils.subprocess import runner_with_spinner_message 10 | from pip._internal.utils.temp_dir import TempDirectory 11 | 12 | 13 | def generate_metadata(build_env, backend): 14 | # type: (BuildEnvironment, Pep517HookCaller) -> str 15 | """Generate metadata using mechanisms described in PEP 517. 16 | 17 | Returns the generated metadata directory. 18 | """ 19 | metadata_tmpdir = TempDirectory( 20 | kind="modern-metadata", globally_managed=True 21 | ) 22 | 23 | metadata_dir = metadata_tmpdir.path 24 | 25 | with build_env: 26 | # Note that Pep517HookCaller implements a fallback for 27 | # prepare_metadata_for_build_wheel, so we don't have to 28 | # consider the possibility that this hook doesn't exist. 29 | runner = runner_with_spinner_message("Preparing wheel metadata") 30 | with backend.subprocess_runner(runner): 31 | distinfo_dir = backend.prepare_metadata_for_build_wheel( 32 | metadata_dir 33 | ) 34 | 35 | return os.path.join(metadata_dir, distinfo_dir) 36 | -------------------------------------------------------------------------------- /src/pip/_vendor/pep517/dirtools.py: -------------------------------------------------------------------------------- 1 | import os 2 | import io 3 | import contextlib 4 | import tempfile 5 | import shutil 6 | import errno 7 | import zipfile 8 | 9 | 10 | @contextlib.contextmanager 11 | def tempdir(): 12 | """Create a temporary directory in a context manager.""" 13 | td = tempfile.mkdtemp() 14 | try: 15 | yield td 16 | finally: 17 | shutil.rmtree(td) 18 | 19 | 20 | def mkdir_p(*args, **kwargs): 21 | """Like `mkdir`, but does not raise an exception if the 22 | directory already exists. 23 | """ 24 | try: 25 | return os.mkdir(*args, **kwargs) 26 | except OSError as exc: 27 | if exc.errno != errno.EEXIST: 28 | raise 29 | 30 | 31 | def dir_to_zipfile(root): 32 | """Construct an in-memory zip file for a directory.""" 33 | buffer = io.BytesIO() 34 | zip_file = zipfile.ZipFile(buffer, 'w') 35 | for root, dirs, files in os.walk(root): 36 | for path in dirs: 37 | fs_path = os.path.join(root, path) 38 | rel_path = os.path.relpath(fs_path, root) 39 | zip_file.writestr(rel_path + '/', '') 40 | for path in files: 41 | fs_path = os.path.join(root, path) 42 | rel_path = os.path.relpath(fs_path, root) 43 | zip_file.write(fs_path, rel_path) 44 | return zip_file 45 | -------------------------------------------------------------------------------- /src/pip/_internal/commands/help.py: -------------------------------------------------------------------------------- 1 | from optparse import Values 2 | from typing import List 3 | 4 | from pip._internal.cli.base_command import Command 5 | from pip._internal.cli.status_codes import SUCCESS 6 | from pip._internal.exceptions import CommandError 7 | 8 | 9 | class HelpCommand(Command): 10 | """Show help for commands""" 11 | 12 | usage = """ 13 | %prog """ 14 | ignore_require_venv = True 15 | 16 | def run(self, options, args): 17 | # type: (Values, List[str]) -> int 18 | from pip._internal.commands import ( 19 | commands_dict, 20 | create_command, 21 | get_similar_commands, 22 | ) 23 | 24 | try: 25 | # 'pip help' with no args is handled by pip.__init__.parseopt() 26 | cmd_name = args[0] # the command we need help for 27 | except IndexError: 28 | return SUCCESS 29 | 30 | if cmd_name not in commands_dict: 31 | guess = get_similar_commands(cmd_name) 32 | 33 | msg = [f'unknown command "{cmd_name}"'] 34 | if guess: 35 | msg.append(f'maybe you meant "{guess}"') 36 | 37 | raise CommandError(' - '.join(msg)) 38 | 39 | command = create_command(cmd_name) 40 | command.parser.print_help() 41 | 42 | return SUCCESS 43 | -------------------------------------------------------------------------------- /src/pip/_internal/distributions/wheel.py: -------------------------------------------------------------------------------- 1 | from zipfile import ZipFile 2 | 3 | from pip._vendor.pkg_resources import Distribution 4 | 5 | from pip._internal.distributions.base import AbstractDistribution 6 | from pip._internal.index.package_finder import PackageFinder 7 | from pip._internal.utils.wheel import pkg_resources_distribution_for_wheel 8 | 9 | 10 | class WheelDistribution(AbstractDistribution): 11 | """Represents a wheel distribution. 12 | 13 | This does not need any preparation as wheels can be directly unpacked. 14 | """ 15 | 16 | def get_pkg_resources_distribution(self) -> Distribution: 17 | """Loads the metadata from the wheel file into memory and returns a 18 | Distribution that uses it, not relying on the wheel file or 19 | requirement. 20 | """ 21 | # Set as part of preparation during download. 22 | assert self.req.local_file_path 23 | # Wheels are never unnamed. 24 | assert self.req.name 25 | 26 | with ZipFile(self.req.local_file_path, allowZip64=True) as z: 27 | return pkg_resources_distribution_for_wheel( 28 | z, self.req.name, self.req.local_file_path 29 | ) 30 | 31 | def prepare_distribution_metadata( 32 | self, finder: PackageFinder, build_isolation: bool 33 | ) -> None: 34 | pass 35 | --------------------------------------------------------------------------------