1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
Commit graph

48 commits

Author SHA1 Message Date
Shantanu
593b85f4ab
Use strict optional checking in misc.py (#11382) 2023-07-17 10:40:25 +01:00
Pradyun Gedam
78ab4cf071
Bump all linters other than mypy (#11901) 2023-03-27 20:03:11 +01:00
Tzu-ping Chung
360b96305a Upgrade pre-commit hooks
Also fix some Mypy errors newly found with upgrade.
2022-07-18 15:13:12 +08:00
Bastian Venthur
5da767c946 fixed some spelling mistakes
that's all :)
2022-06-14 21:24:58 +02:00
Tzu-ping Chung
f4962cce70 Optional truststore support
This adds a --use-feature=truststore flag that, when specified on Python
3.10+ with truststore installed, switches pip to use truststore to
provide HTTPS certificate validation, instead of certifi. This allows
pip to verify certificates against custom certificates in the system
store.

truststore is deliberately NOT vendored because it is expected the
library to be under active development in the short term, and this
prevents users having to wait for a pip release to get potentially vital
bug fixes needed to be made in truststore.

Supplying the use-feature flag without installing truststore beforehand,
or on Python versions prior to 3.10, results in a command error.
2022-05-03 11:04:05 -06:00
q0w
3820b0e52c
Replace Iterator[T] with Generator[T,None, None] (#11007)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
2022-04-09 16:11:58 +01:00
Thiago
fffd5ac422
Pass the session's proxies property to request (#10680) 2022-03-11 15:04:21 +00:00
Diego Ramirez
02b4f86489
Return a better error message if a file: URL is not found (#10263)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2021-10-08 14:24:54 +01:00
Noah Gorny
50a0624a9a session: Cache http requests to trusted hosts 2021-09-15 17:21:51 +03:00
Jon Dufresne
3064f71161 Upgrade vendored distro to use new typing and API
The most recent version of distro, 1.6.0, include type information. This
allows pip to remove some workarounds. See upstream commit:
20cb68d6b0

The new version also deprecated the top level function
distro.linux_distribution(). Switch to the new preferred API. See
upstream commit:
f947776f5a
2021-08-15 21:54:40 +02:00
Pradyun Gedam
1bc0eef056
Blacken src/pip/_internal/network/
Progresses the black formatting of the codebase further.
2021-07-23 20:51:50 +01:00
Harutaka Kawamura
f8a7439528
Complete type annotations in pip/_internal/network (#10184) 2021-07-23 18:27:28 +08:00
Alex Gaynor
9ab448de63 Added a timeout to invoking rustc 2021-05-20 19:24:54 -04:00
Alex Gaynor
f787788a65 Include rustc version in the user agent, if rustc is available
Rust is becoming more popular for writing Python extension modules in, this information would be valuable for package maintainers to assess the ecosystem, in the same way glibc or openssl version is.
2021-05-16 21:50:58 -04:00
Tzu-ping Chung
56a8f3d8bd Typing fixes 2021-03-10 16:40:58 +08:00
Jon Dufresne
63ea2e8c08 Handle several mypy TODO comments and exceptions
Remove mypy exceptions that are straightforward to remove.
2021-02-22 16:53:54 -08:00
Jon Dufresne
0945809afc Remove typing.TYPE_CHECKING guards
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
2021-02-19 18:34:21 -08:00
Tzu-ping Chung
383934eb83 Incorporate get_installed_version() logic
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.
2021-02-19 13:34:16 +08:00
Jon Dufresne
a6392bd62e Replace pip._internal.utils.typing with stdlib typing
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.
2021-02-18 19:09:13 -08:00
Tzu-ping Chung
5fac450375
Merge pull request #9368 from jdufresne/ensure
Remove unnecessary uses of six.ensure_(binary|str|text)
2021-02-18 20:40:21 +08:00
Jon Dufresne
8683413501 Use keyword-only arguments
https://www.python.org/dev/peps/pep-3102/

Replaces the pattern: self.name = kwargs.pop('name')

Keyword-only arguments offer some advantages:

- In the event of a typo or misuse, a more informative error is
  presented to the programmer.

- More self documenting and makes interfaces more explicit.

- They more easily allow explicit typing.

Adding types to ConfigOptionParser required changing some call sites to
pass arguments without using a dict due to mypy bug:
https://github.com/python/mypy/issues/9676
2021-01-29 21:15:36 -08:00
Jon Dufresne
c115cdc81a Remove unnecessary uses of six.ensure_(binary|str|text)
Now that Python 2 is not supported, the bytes/str boundaries are more
clear and explicit. Using six.ensure_* methods for backwards
compatibility is no longer necessary as the types are known and verified
using mypy.

One exception is tests/lib/wheel.py which allows tests to pass test
setup data as either bytes or str.

The module operations.install.wheel also remains untouched as it is
especially delicate to bytes/str mixups and the current version is
working.
2020-12-27 07:56:18 -08:00
Hugo van Kemenade
a3e246f7d0 Cleanup: replace 'from urllib import xyz as urllib_xyz' with import urllib.xyz 2020-12-27 16:18:44 +02:00
Jon Dufresne
14ebb03997 Use "yield from" syntax
Available since Python 3.3.

https://docs.python.org/3/whatsnew/3.3.html#pep-380
2020-12-26 07:04:58 -08:00
Pradyun Gedam
86afa89043
Merge pull request #9361 from jdufresne/f-strings
Use f-strings for simple string formatting
2020-12-26 10:24:18 +00:00
Pradyun Gedam
7a6b1a5805
Merge pull request #9357 from jdufresne/ipaddress
Replace vendored ipaddress with stdlib
2020-12-26 10:20:18 +00:00
Jon Dufresne
cdcf74fb8e Use f-strings for simple string formatting
Use pyupgrade to convert simple string formatting to use f-string
syntax. pyupgrade is intentionally timid and will not create an f-string
if it would make the expression longer or if the substitution parameters
are anything but simple names or dotted names.
2020-12-25 16:21:20 -08:00
Jon Dufresne
653f12b5e7 Replace vendored ipaddress with stdlib
The vendored copy is unnecessary since dropping Python 2 support. The
module has been available in the stdlib since Python 3.3.
2020-12-25 08:47:38 -08:00
Jon Dufresne
c148bcc1aa Use short Python3 super() syntax 2020-12-24 15:11:51 -08:00
Hugo van Kemenade
817ee23051 Remove redundant Python 2.7 code 2020-12-22 09:06:26 +02:00
Pradyun Gedam
58c594c06b
Prepare isort for black 2020-09-23 21:47:47 +05:30
Pradyun Gedam
25ab172b55
Update linter: isort 2020-09-23 19:52:28 +05:30
Noah Gorny
aae63795b2 reqfile: Update extra-index-url/index-url in session from requirements file
Also update the relevant tests
2020-08-06 19:25:31 +03:00
Noah Gorny
544c307ebf session: Always cache responses from trusted-host source
news: Add news about default behaviour change
2020-03-26 21:29:18 +02:00
Noah Gorny
65a9bec7a4 session: Add InsecureCacheControlAdapter 2020-03-26 21:15:38 +02:00
Noah Gorny
c936ed0165 session: Rename _insecure_adapter to _trusted_host_adapter
Currently it is just the insecure adapter, but this can change in the future
2020-03-26 21:15:38 +02:00
Noah Gorny
f1a8bd4ad6 session: Fix comment about add_insecure_host, rename to add_trusted_host 2020-03-26 21:15:38 +02:00
Stéphane Bidoul (ACSONE)
1ee270a8d4
Check that the cache is writable in _main()
This avoid code duplication (for the wheel and http
cache) and repeated warnings.
2019-12-28 13:04:54 +01:00
Chris Hunt
355c303e12 Lazy evaluate has_tls result
This avoids an unnecessary unconditional import of ssl and urllib3 in
compat.
2019-12-09 20:48:58 +08:00
Chris Hunt
f4e40d7a09 Wrap HAS_TLS in a function
Next we'll refactor the value to be computed lazily.
2019-12-09 20:48:58 +08:00
Chris Hunt
143608bd14 Remove manual decoding in network.session in favor of six method 2019-11-10 17:56:59 -05:00
Chris Hunt
3125c32696 Send client cert when using InsecureHTTPAdapter 2019-11-03 17:05:58 -05:00
Chris Hunt
f315671572 Move urllib3 warning suppression to network.session
This is only relevant for our usage of --trusted-host, so it is enough
to initialize it in network.session.
2019-10-06 22:31:49 -04:00
Maxim Kurnikov
3692097cca add per-file disallow_untyped_defs=False, and set it to True globally 2019-09-29 23:31:15 +02:00
Chris Hunt
c40331e824 Add docstring to network.session 2019-09-27 01:05:24 -04:00
Chris Hunt
3328e811d1 Normalize style 2019-09-27 01:03:47 -04:00
Chris Hunt
cf7ebdbbc2 Move PipSession to network.session 2019-09-27 01:02:52 -04:00
Chris Hunt
6ce7217a53 Move PipSession helper functions to network.session
This new module is a catch-all for PipSession helpers.
2019-09-27 00:55:06 -04:00