This implements the PEP 668 logic to 'pip install' and 'pip uninstall'.
Are there any other commands that may need it?
This implementation disables the check is any of --prefix, --home, or
--target is provided, since those can indicate the command does not
actually install into the environment. Note that it is still possible
the command is still modifying the environment, but we don't have a
way to stop the user *that* determined to break the environment anyway
(they can always just use those flags in a virtual environment).
Also not sure how best this can be tested.
Use the com2ann tool to convert remaining comments to annotations. Now,
no type comments remain.
https://github.com/ilevkivskyi/com2ann
Some types are not available at runtime (e.g. Literal) or require a
forward reference and so were quoted.
A Python project root is now defined as containing a pyproject.toml, or
a setup.py (pre-PEP-517 legacy layout). After this patch, this logic
applies to all checks except parse_editable, where we check for setup.py
and setup.cfg instead since non-setuptools PEP 517 projects cannot be
installed as editable right now.
The typing module has been available since Python 3.5. Guarding the
import has been unnecessary since dropping Python 2.
Some guards remain to either:
- Avoid circular imports
- Importing objects that are also guarded by typing.TYPE_CHECKING
- Avoid mypy_extensions dependency
Per the function's type signature, this accepted either a str or None.
In both cases, the value was returned unaltered. Since dropping Python
2, it has been unnecessary.
All usages of it now use Environment.get_distribution() instead.
InstallRequirement.installed_version is also removed since it is no
longer used anywhere in the code base.
The stdlib module has been available since Python 3.5 and the
TYPE_CHECKING constant has been available since 3.5.2.
By using stdlib, this removes the need for pip to maintain its own
Python 2 typing compatibility shim.
pkg_resources performs annoying caching that needs to be worked around
in some parts of pip. This makes it easier to represent the difference
between environments backend by WorkingSet() and working_set.