Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendor in pip==22.2, rename notpip -> pip and exclusively use vendored pip #5196

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Bug Fixes
---------

- Fix a bug that ``pipenv run`` doesn't set environment variables correctly. `#4831 <https://github.com/pypa/pipenv/issues/4831>`_
- Fix a bug that certifi can't be loaded within ``notpip``'s vendor library. This makes several objects of ``pip`` fail to be imported. `#4833 <https://github.com/pypa/pipenv/issues/4833>`_
- Fix a bug that certifi can't be loaded within ``pip``'s vendor library. This makes several objects of ``pip`` fail to be imported. `#4833 <https://github.com/pypa/pipenv/issues/4833>`_
- Fix a bug that ``3.10.0`` can be found be python finder. `#4837 <https://github.com/pypa/pipenv/issues/4837>`_

Vendored Libraries
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ recursive-include pipenv/vendor vendor.txt
recursive-include pipenv *.json
recursive-include pipenv *.rst

include pipenv/patched/notpip/_vendor/vendor.txt
include pipenv/patched/pip/_vendor/vendor.txt
include pipenv/patched/patched.txt
include pipenv/vendor/Makefile
include pipenv/pipenv.1
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CLEAN_TARGETS := $(addprefix clean-py,$(PY_VERSIONS))
DATE_STRING := $(shell date +%Y.%m.%d)
THIS_MONTH_DATE := $(shell date +%Y.%m.01)
NEXT_MONTH_DATE := $(shell date -d "+1 month" +%Y.%m.01)
PATCHED_PIP_VERSION := $(shell awk '/__version__/{gsub(/"/,"",$$3); print $$3}' pipenv/patched/notpip/__init__.py)
PATCHED_PIP_VERSION := $(shell awk '/__version__/{gsub(/"/,"",$$3); print $$3}' pipenv/patched/pip/__init__.py)
GITDIR_STAMPFILE := $(CURDIR)/.git-checkout-dir
create_git_tmpdir = $(shell mktemp -dt pipenv-vendor-XXXXXXXX 2>/dev/null || mktemp -d 2>/dev/null)
write_git_tmpdir = $(file > $(GITDIR_STAMPFILE),$(create_git_tmpdir))
Expand Down
5 changes: 5 additions & 0 deletions news/5196.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Rename patched ``notpip`` to ``pip`` in order to be clear that its a patched version of pip.
* Remove the part of _post_pip_import.patch that overrode the standalone pip to be the user installed pip,
now we fully rely on our vendored and patched ``pip``, even for all types of installs.
* Vendor in the next newest version of ``pip==22.2``
* Modify patch for ``pipdeptree`` to not use ``pip-shims``
2 changes: 1 addition & 1 deletion pipenv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
warnings.filterwarnings("ignore", category=UserWarning)

# Load patched pip instead of system pip
os.environ["PIP_SHIMS_BASE_MODULE"] = "pipenv.patched.notpip"
os.environ["PIP_SHIMS_BASE_MODULE"] = "pipenv.patched.pip"
os.environ["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"

# Hack to make things work better.
Expand Down
18 changes: 9 additions & 9 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@


def do_clear(project):
from pipenv.patched.notpip._internal import locations
from pipenv.patched.pip._internal import locations

click.secho(fix_utf8("Clearing caches..."), bold=True)
try:
Expand Down Expand Up @@ -160,10 +160,10 @@ def cleanup_virtualenv(project, bare=True):


def import_requirements(project, r=None, dev=False):
from pipenv.patched.notpip._internal.req.constructors import (
from pipenv.patched.pip._internal.req.constructors import (
install_req_from_parsed_requirement,
)
from pipenv.patched.notpip._vendor import requests
from pipenv.patched.pip._vendor import requests
from pipenv.vendor.pip_shims.shims import parse_requirements

# Parse requirements.txt file with Pip's parser.
Expand Down Expand Up @@ -1141,7 +1141,7 @@ def do_lock(

# Support for --keep-outdated...
if keep_outdated:
from pipenv.patched.notpip._vendor.packaging.utils import canonicalize_name
from pipenv.patched.pip._vendor.packaging.utils import canonicalize_name

for section_name, section in (
("default", project.packages),
Expand Down Expand Up @@ -1372,7 +1372,7 @@ def get_pip_args(
selective_upgrade: bool = False,
src_dir: Optional[str] = None,
) -> List[str]:
from pipenv.patched.notpip._vendor.packaging.version import parse as parse_version
from pipenv.patched.pip._vendor.packaging.version import parse as parse_version

arg_map = {
"pre": ["--pre"],
Expand Down Expand Up @@ -1472,7 +1472,7 @@ def pip_install(
trusted_hosts=None,
use_pep517=True,
):
piplogger = logging.getLogger("pipenv.patched.notpip._internal.commands.install")
piplogger = logging.getLogger("pipenv.patched.pip._internal.commands.install")
if not trusted_hosts:
trusted_hosts = []
trusted_hosts.extend(os.environ.get("PIP_TRUSTED_HOSTS", []))
Expand Down Expand Up @@ -1850,7 +1850,7 @@ def do_outdated(project, pypi_mirror=None, pre=False, clear=False):
from collections import namedtuple
from collections.abc import Mapping

from pipenv.patched.notpip._vendor.packaging.utils import canonicalize_name
from pipenv.patched.pip._vendor.packaging.utils import canonicalize_name

from .vendor.requirementslib.models.requirements import Requirement
from .vendor.requirementslib.models.utils import get_version
Expand Down Expand Up @@ -2293,7 +2293,7 @@ def do_uninstall(
pypi_mirror=None,
ctx=None,
):
from pipenv.patched.notpip._vendor.packaging.utils import canonicalize_name
from pipenv.patched.pip._vendor.packaging.utils import canonicalize_name

from .vendor.requirementslib.models.requirements import Requirement

Expand Down Expand Up @@ -3010,7 +3010,7 @@ def do_clean(
system=False,
):
# Ensure that virtualenv is available.
from pipenv.patched.notpip._vendor.packaging.utils import canonicalize_name
from pipenv.patched.pip._vendor.packaging.utils import canonicalize_name

ensure_project(
project, three=three, python=python, validate=False, pypi_mirror=pypi_mirror
Expand Down
8 changes: 3 additions & 5 deletions pipenv/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import pkg_resources

import pipenv
from pipenv.patched.notpip._vendor.packaging.utils import canonicalize_name
from pipenv.patched.pip._vendor.packaging.utils import canonicalize_name
from pipenv.utils.constants import is_type_checking
from pipenv.utils.indexes import prepare_pip_source_args
from pipenv.utils.processes import subprocess_run
Expand All @@ -29,7 +29,7 @@
import pip_shims.shims
import tomlkit

from pipenv.patched.notpip._vendor.packaging.version import Version
from pipenv.patched.pip._vendor.packaging.version import Version
from pipenv.project import Project, TPipfile, TSource

BASE_WORKING_SET = pkg_resources.WorkingSet(sys.path)
Expand Down Expand Up @@ -545,9 +545,7 @@ def pip_version(self) -> Version:
Get the pip version in the environment. Useful for knowing which args we can use
when installing.
"""
from pipenv.patched.notpip._vendor.packaging.version import (
parse as parse_version,
)
from pipenv.patched.pip._vendor.packaging.version import parse as parse_version

pip = next(
iter(pkg for pkg in self.get_installed_packages() if pkg.key == "pip"), None
Expand Down
42 changes: 0 additions & 42 deletions pipenv/patched/notpip/_internal/utils/distutils_args.py

This file was deleted.

21 changes: 0 additions & 21 deletions pipenv/patched/notpip/_vendor/certifi/LICENSE

This file was deleted.

3 changes: 0 additions & 3 deletions pipenv/patched/notpip/_vendor/certifi/__init__.py

This file was deleted.

Loading