pipgrip 0.10.4__py2.py3-none-any.whl → 0.10.6__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pipgrip/_repo_version.py CHANGED
@@ -1 +1 @@
1
- version = "0.10.4"
1
+ version = "0.10.6"
pipgrip/pipper.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import io
2
+ import json
2
3
  import logging
3
4
  import os
4
5
  import re
@@ -10,7 +11,6 @@ import pkg_resources
10
11
  from click import echo as _echo
11
12
  from packaging.markers import default_environment
12
13
  from packaging.utils import canonicalize_name
13
- from pkginfo import get_metadata
14
14
 
15
15
  from pipgrip.compat import PIP_VERSION, urlparse
16
16
 
@@ -254,6 +254,59 @@ def _get_available_versions(package, index_url, extra_index_url, pre):
254
254
  raise RuntimeError("Failed to get available versions for {}".format(package))
255
255
 
256
256
 
257
+ def _get_package_report(package, index_url, extra_index_url, pre, cache_dir):
258
+ """Get metadata (install report) using pip's --dry-run --report functionality."""
259
+ logger.debug(
260
+ "Getting report for {} (with fallback cache_dir {})".format(package, cache_dir)
261
+ )
262
+ args = [
263
+ sys.executable,
264
+ "-m",
265
+ "pip",
266
+ "install",
267
+ "-qq",
268
+ "--no-deps",
269
+ "--ignore-installed",
270
+ "--disable-pip-version-check",
271
+ "--dry-run",
272
+ "--no-deps",
273
+ ]
274
+ if pre:
275
+ args += ["--pre"]
276
+ if cache_dir is not None:
277
+ args += [
278
+ "--cache-dir",
279
+ cache_dir,
280
+ ]
281
+ if index_url is not None:
282
+ args += [
283
+ "--index-url",
284
+ index_url,
285
+ "--trusted-host",
286
+ urlparse(index_url).hostname,
287
+ ]
288
+ if extra_index_url is not None:
289
+ args += [
290
+ "--extra-index-url",
291
+ extra_index_url,
292
+ "--trusted-host",
293
+ urlparse(extra_index_url).hostname,
294
+ ]
295
+ args += ["--report", "-", package]
296
+ try:
297
+ out = stream_bash_command(args)
298
+ except subprocess.CalledProcessError as err:
299
+ output = getattr(err, "output") or ""
300
+ logger.error(
301
+ "Getting report for {} failed with output:\n{}".format(
302
+ package, output.strip()
303
+ )
304
+ )
305
+ raise RuntimeError("Failed to get report for {}".format(package))
306
+ report = json.loads(out)
307
+ return report
308
+
309
+
257
310
  def _download_wheel(package, index_url, extra_index_url, pre, cache_dir):
258
311
  """Download/build wheel for package and return its filename."""
259
312
  logger.debug(
@@ -352,6 +405,8 @@ def _download_wheel(package, index_url, extra_index_url, pre, cache_dir):
352
405
 
353
406
 
354
407
  def _extract_metadata(wheel_fname):
408
+ from pkginfo import get_metadata # not required on python 3.7+
409
+
355
410
  wheel_fname = os.path.abspath(wheel_fname)
356
411
  logger.debug("Searching metadata in %s", wheel_fname)
357
412
  if not os.path.exists(wheel_fname):
@@ -419,10 +474,16 @@ def discover_dependencies_and_versions(
419
474
  extras_requested = sorted(req.extras)
420
475
 
421
476
  logger.info("discovering %s", req)
422
- wheel_fname = _download_wheel(
423
- req.__str__(), index_url, extra_index_url, pre, cache_dir
424
- )
425
- wheel_metadata = _extract_metadata(wheel_fname)
477
+ if PIP_VERSION >= [22, 2]:
478
+ report = _get_package_report(
479
+ req.__str__(), index_url, extra_index_url, pre, cache_dir
480
+ )
481
+ wheel_metadata = report["install"][0]["metadata"]
482
+ else: # old python (<3.7) fallback
483
+ wheel_fname = _download_wheel(
484
+ req.__str__(), index_url, extra_index_url, pre, cache_dir
485
+ )
486
+ wheel_metadata = _extract_metadata(wheel_fname)
426
487
  wheel_requirements = _get_wheel_requirements(wheel_metadata, extras_requested)
427
488
  wheel_version = req.url or wheel_metadata["version"]
428
489
  available_versions = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pipgrip
3
- Version: 0.10.4
3
+ Version: 0.10.6
4
4
  Summary: Lightweight pip dependency resolver with deptree preview functionality based on the PubGrub algorithm
5
5
  Home-page: https://github.com/ddelange/pipgrip
6
6
  Author: ddelange
@@ -31,15 +31,16 @@ Classifier: Topic :: Utilities
31
31
  Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
32
32
  Description-Content-Type: text/markdown
33
33
  License-File: LICENSE
34
- Requires-Dist: anytree (>=2.4.1)
35
- Requires-Dist: click (>=7)
36
- Requires-Dist: packaging (>=17)
37
- Requires-Dist: pkginfo (<1.8,>=1.4.2)
38
- Requires-Dist: setuptools (>=38.3)
34
+ Requires-Dist: anytree >=2.4.1
35
+ Requires-Dist: click >=7
36
+ Requires-Dist: packaging >=17
37
+ Requires-Dist: setuptools >=38.3
39
38
  Requires-Dist: wheel
40
- Requires-Dist: pip (>=7.1.0)
39
+ Requires-Dist: pip >=7.1.0 ; python_version <= "3.6"
40
+ Requires-Dist: pkginfo <1.8,>=1.4.2 ; python_version <= "3.6"
41
41
  Requires-Dist: enum34 ; python_version == "2.7"
42
42
  Requires-Dist: typing ; python_version == "2.7"
43
+ Requires-Dist: pip >=22.2 ; python_version > "3.6"
43
44
 
44
45
  # pipgrip
45
46
 
@@ -52,6 +53,18 @@ Requires-Dist: typing ; python_version == "2.7"
52
53
 
53
54
  [pipgrip](https://github.com/ddelange/pipgrip) is a lightweight pip dependency resolver with deptree preview functionality based on the [PubGrub algorithm](https://medium.com/@nex3/pubgrub-2fb6470504f), which is also used by [poetry](https://github.com/python-poetry/poetry). For one or more [PEP 508](https://www.python.org/dev/peps/pep-0508/) dependency specifications, pipgrip recursively fetches/builds the Python wheels necessary for version solving, and optionally renders the full resulting dependency tree.
54
55
 
56
+ ```
57
+ $ pipgrip --tree fastapi~=0.94
58
+
59
+ fastapi~=0.94 (0.95.1)
60
+ ├── pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2 (1.10.7)
61
+ │ └── typing-extensions>=4.2.0 (4.5.0)
62
+ └── starlette<0.27.0,>=0.26.1 (0.26.1)
63
+ └── anyio<5,>=3.4.0 (3.6.2)
64
+ ├── idna>=2.8 (3.4)
65
+ └── sniffio>=1.1 (1.3.0)
66
+ ```
67
+
55
68
  #### pipgrip vs. poetry
56
69
 
57
70
  [poetry](https://github.com/python-poetry/poetry) offers package management with dependency resolution, essentially replacing pip/setuptools. This means that poetry packages don't contain `setup.py`, and hence are not compatible with `pip install -e`: poetry projects would have to be converted to setuptools-based projects with e.g. [dephell](https://github.com/dephell/dephell). To avoid such hassle, pipgrip only requires the selected package(s) + dependencies to be available to pip in the usual way.
@@ -153,15 +166,14 @@ Exhaustive dependency trees without the need to install any packages ([at most b
153
166
  ```
154
167
  $ pipgrip --tree pipgrip
155
168
 
156
- pipgrip (0.10.0)
157
- ├── anytree>=2.4.1 (2.8.0)
158
- │ └── six>=1.9.0 (1.16.0)
159
- ├── click>=7 (8.1.3)
160
- ├── packaging>=17 (22.0)
161
- ├── pip>=7.1.0 (22.3.1)
162
- ├── pkginfo<1.8,>=1.4.2 (1.7.1)
163
- ├── setuptools>=38.3 (65.6.3)
164
- └── wheel (0.38.4)
169
+ pipgrip (0.10.6)
170
+ ├── anytree>=2.4.1 (2.9.0)
171
+ │ └── six (1.16.0)
172
+ ├── click>=7 (8.1.6)
173
+ ├── packaging>=17 (23.1)
174
+ ├── pip>=22.2 (23.2.1)
175
+ ├── setuptools>=38.3 (68.0.0)
176
+ └── wheel (0.41.1)
165
177
  ```
166
178
 
167
179
  For more details/further processing, combine `--tree` with `--json` for a detailed nested JSON dependency tree. See also `--tree-ascii` (no unicode tree markers), and `--tree-json` & `--tree-json-exact` (simplified JSON dependency trees).
@@ -1,9 +1,9 @@
1
1
  pipgrip/__init__.py,sha256=mLaibXlzSl5M71C0-9eimUNlbB0DzF3nO6YdEZcn5MA,158
2
- pipgrip/_repo_version.py,sha256=Fo28le_VA17IHTnUzUwXRV_1xW1h8maFouDD6c_z9Tc,19
2
+ pipgrip/_repo_version.py,sha256=Ok7_5S8MHF9pymQb5JACvZ6o4pQt5Mj3oHVLRCPiDm8,19
3
3
  pipgrip/cli.py,sha256=3NN6YNDdb4oIAQc7Ol-oaRUrYMIO4RKw0vvlUm6kBBQ,18196
4
4
  pipgrip/compat.py,sha256=e6uOHh84H2pRMNtD5Rp-PLSk-MSbmvHa_12Ov6q7-yo,389
5
5
  pipgrip/package_source.py,sha256=MBC1_ERk-r8sRZpwXPpYn8uwx1ntR7OXjQyT3eQuTXY,8188
6
- pipgrip/pipper.py,sha256=2GUwsVR3mlr3ELQsmQljYbmJLXfOwN6nX9lRN8nBEB0,14411
6
+ pipgrip/pipper.py,sha256=8dQMWVvetbKoQ8SaU8Gd5B63HsRaPmqdPgH9WVAPbe8,16226
7
7
  pipgrip/libs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  pipgrip/libs/mixology/__init__.py,sha256=HfjVOrpTnmZ-xVFCYSVmX50EXaBQeJteUHG-PD6iQs8,22
9
9
  pipgrip/libs/mixology/_compat.py,sha256=hPGj-zSfCbwJTN1NlH_i93m-2Dinq7VIMnr2vycx2Ls,129
@@ -29,9 +29,9 @@ pipgrip/libs/semver/version.py,sha256=-l9btQIkRsYDjpBjjd2OSNxJxCg4WPVybFaigeIJs3
29
29
  pipgrip/libs/semver/version_constraint.py,sha256=r2L4U6mqfjsKYro46duqaeroNcEWrBxpZq5oArzrCmQ,896
30
30
  pipgrip/libs/semver/version_range.py,sha256=w1V54cLQjmAUFXr5MsJCVdo5DjNpwl-TEnmfOvHbaGs,13707
31
31
  pipgrip/libs/semver/version_union.py,sha256=I86jcnXylR5RlqRpAvGxsMeUA5_j3fC3LaOubBavEpI,8158
32
- pipgrip-0.10.4.dist-info/LICENSE,sha256=0VQx-FY5ohi5oryC-9Xm8b5aacF-dDDuv8TRevRsRqc,1516
33
- pipgrip-0.10.4.dist-info/METADATA,sha256=-weaWWzBo2a0vc-BQPKb6TMS76ymq7a4tzkp9kDxA74,16117
34
- pipgrip-0.10.4.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
35
- pipgrip-0.10.4.dist-info/entry_points.txt,sha256=VGqby8sWTjfkK20Vj_FqBZ_UxBlgmAOzq4rcJLYlRq0,45
36
- pipgrip-0.10.4.dist-info/top_level.txt,sha256=upoyu3ujOmKRvBUtTrwzk58e-r6zJahuT_8-RDsd2p0,8
37
- pipgrip-0.10.4.dist-info/RECORD,,
32
+ pipgrip-0.10.6.dist-info/LICENSE,sha256=0VQx-FY5ohi5oryC-9Xm8b5aacF-dDDuv8TRevRsRqc,1516
33
+ pipgrip-0.10.6.dist-info/METADATA,sha256=CQq5BfZ5jwMmIuL31oA_h3FEoLZE9JkO2S0TloKLjnA,16517
34
+ pipgrip-0.10.6.dist-info/WHEEL,sha256=m9WAupmBd2JGDsXWQGJgMGXIWbQY3F5c2xBJbBhq0nY,110
35
+ pipgrip-0.10.6.dist-info/entry_points.txt,sha256=VGqby8sWTjfkK20Vj_FqBZ_UxBlgmAOzq4rcJLYlRq0,45
36
+ pipgrip-0.10.6.dist-info/top_level.txt,sha256=upoyu3ujOmKRvBUtTrwzk58e-r6zJahuT_8-RDsd2p0,8
37
+ pipgrip-0.10.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.38.4)
2
+ Generator: bdist_wheel (0.41.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any