python-inspector 0.10.0__py3-none-any.whl → 0.12.0__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.
python_inspector/api.py CHANGED
@@ -65,7 +65,6 @@ class Resolution(NamedTuple):
65
65
  for file in files:
66
66
  path = file["path"]
67
67
  file["path"] = utils.remove_test_data_dir_variable_prefix(path=path)
68
-
69
68
  return {
70
69
  "files": files,
71
70
  "packages": [package for package in self.packages],
@@ -90,6 +89,7 @@ def resolve_dependencies(
90
89
  prefer_source=False,
91
90
  printer=print,
92
91
  generic_paths=False,
92
+ ignore_errors=False,
93
93
  ):
94
94
  """
95
95
  Resolve the dependencies for the package requirements listed in one or
@@ -154,6 +154,7 @@ def resolve_dependencies(
154
154
  deps = dependencies.get_dependencies_from_requirements(requirements_file=req_file)
155
155
  for extra_data in dependencies.get_extra_data_from_requirements(requirements_file=req_file):
156
156
  index_urls = (*index_urls, *tuple(extra_data.get("extra_index_urls") or []))
157
+ index_urls = (*index_urls, *tuple(extra_data.get("index_url") or []))
157
158
  direct_dependencies.extend(deps)
158
159
  package_data = [
159
160
  pkg_data.to_dict() for pkg_data in PipRequirementsFileHandler.parse(location=req_file)
@@ -284,6 +285,7 @@ def resolve_dependencies(
284
285
  max_rounds=max_rounds,
285
286
  pdt_output=pdt_output,
286
287
  analyze_setup_py_insecurely=analyze_setup_py_insecurely,
288
+ ignore_errors=ignore_errors,
287
289
  )
288
290
 
289
291
  packages = []
@@ -321,6 +323,7 @@ def resolve(
321
323
  max_rounds=200000,
322
324
  pdt_output=False,
323
325
  analyze_setup_py_insecurely=False,
326
+ ignore_errors=False,
324
327
  ):
325
328
  """
326
329
  Resolve dependencies given a ``direct_dependencies`` list of
@@ -346,6 +349,7 @@ def resolve(
346
349
  max_rounds=max_rounds,
347
350
  pdt_output=pdt_output,
348
351
  analyze_setup_py_insecurely=analyze_setup_py_insecurely,
352
+ ignore_errors=ignore_errors,
349
353
  )
350
354
 
351
355
  return resolved_dependencies, packages
@@ -359,6 +363,7 @@ def get_resolved_dependencies(
359
363
  max_rounds: int = 200000,
360
364
  pdt_output: bool = False,
361
365
  analyze_setup_py_insecurely: bool = False,
366
+ ignore_errors: bool = False,
362
367
  ):
363
368
  """
364
369
  Return resolved dependencies of a ``requirements`` list of Requirement for
@@ -373,6 +378,7 @@ def get_resolved_dependencies(
373
378
  environment=environment,
374
379
  repos=repos,
375
380
  analyze_setup_py_insecurely=analyze_setup_py_insecurely,
381
+ ignore_errors=ignore_errors,
376
382
  ),
377
383
  reporter=BaseReporter(),
378
384
  )
@@ -26,7 +26,7 @@ class FileOptionType(click.File):
26
26
  if value in known_opts:
27
27
  self.fail(
28
28
  "Illegal file name conflicting with an option name: "
29
- f"{ os.fsdecode(value)}. "
29
+ f"{os.fsdecode(value)}. "
30
30
  'Use the special "-" file name to print results on screen/stdout.',
31
31
  param,
32
32
  ctx,
@@ -352,7 +352,11 @@ DEFAULT_ENVIRONMENT = utils_pypi.Environment.from_pyver_and_os(
352
352
 
353
353
  class PythonInputProvider(AbstractProvider):
354
354
  def __init__(
355
- self, environment=DEFAULT_ENVIRONMENT, repos=tuple(), analyze_setup_py_insecurely=False
355
+ self,
356
+ environment=DEFAULT_ENVIRONMENT,
357
+ repos=tuple(),
358
+ analyze_setup_py_insecurely=True,
359
+ ignore_errors=False,
356
360
  ):
357
361
  self.environment = environment
358
362
  self.environment_marker = get_environment_marker_from_environment(self.environment)
@@ -361,6 +365,7 @@ class PythonInputProvider(AbstractProvider):
361
365
  self.dependencies_by_purl = {}
362
366
  self.wheel_or_sdist_by_package = {}
363
367
  self.analyze_setup_py_insecurely = analyze_setup_py_insecurely
368
+ self.ignore_errors = ignore_errors
364
369
 
365
370
  def identify(self, requirement_or_candidate: Union[Candidate, Requirement]) -> str:
366
371
  """Given a requirement, return an identifier for it. Overridden."""
@@ -583,8 +588,11 @@ class PythonInputProvider(AbstractProvider):
583
588
  versions.extend(self.get_versions_for_package(name=name, repo=repo))
584
589
 
585
590
  if not versions:
586
- raise NoVersionsFound(f"This package does not exist: {name}")
587
-
591
+ if self.ignore_errors:
592
+ yield from [Candidate("NonExistant", "0.0.0", "")]
593
+ return
594
+ else:
595
+ raise NoVersionsFound(f"This package does not exist: {name}")
588
596
  yield from self.get_candidates(
589
597
  all_versions=versions,
590
598
  requirements=requirements,
@@ -19,7 +19,7 @@ from python_inspector.utils import write_output_in_file
19
19
 
20
20
  TRACE = False
21
21
 
22
- __version__ = "0.10.0"
22
+ __version__ = "0.12.0"
23
23
 
24
24
  DEFAULT_PYTHON_VERSION = "38"
25
25
  PYPI_SIMPLE_URL = "https://pypi.org/simple"
@@ -173,6 +173,9 @@ def print_version(ctx, param, value):
173
173
  callback=print_version,
174
174
  help="Show the version and exit.",
175
175
  )
176
+ @click.option(
177
+ "--ignore-errors", is_flag=True, default=False, help="Ignore errors and continue execution."
178
+ )
176
179
  @click.help_option("-h", "--help")
177
180
  @click.option(
178
181
  "--generic-paths",
@@ -199,6 +202,7 @@ def resolve_dependencies(
199
202
  prefer_source=False,
200
203
  verbose=TRACE,
201
204
  generic_paths=False,
205
+ ignore_errors=False,
202
206
  ):
203
207
  """
204
208
  Resolve the dependencies for the package requirements listed in one or
@@ -266,6 +270,7 @@ def resolve_dependencies(
266
270
  analyze_setup_py_insecurely=analyze_setup_py_insecurely,
267
271
  printer=click.secho,
268
272
  prefer_source=prefer_source,
273
+ ignore_errors=ignore_errors,
269
274
  generic_paths=generic_paths,
270
275
  )
271
276
 
python_inspector/utils.py CHANGED
@@ -79,8 +79,10 @@ def remove_test_data_dir_variable_prefix(path, placeholder="<file>"):
79
79
  Return a clean path, removing variable test path prefix or using a ``placeholder``.
80
80
  Used for testing to ensure that results are stable across runs.
81
81
  """
82
+ path = path.replace("\\", "/")
82
83
  if "tests/data/" in path:
83
84
  _junk, test_dir, cleaned = path.partition("tests/data/")
84
- return f"{test_dir}{cleaned}"
85
+ cleaned = f"{test_dir}{cleaned}"
86
+ return cleaned.replace("\\", "/")
85
87
  else:
86
88
  return placeholder
@@ -102,16 +102,17 @@ TRACE_DEEP = False
102
102
  TRACE_ULTRA_DEEP = False
103
103
 
104
104
  # Supported environments
105
- PYTHON_VERSIONS = "36", "37", "38", "39", "310", "311", "27"
105
+ PYTHON_VERSIONS = "27", "36", "37", "38", "39", "310", "311", "312"
106
106
 
107
107
  PYTHON_DOT_VERSIONS_BY_VER = {
108
+ "27": "2.7",
108
109
  "36": "3.6",
109
110
  "37": "3.7",
110
111
  "38": "3.8",
111
112
  "39": "3.9",
112
113
  "310": "3.10",
113
- "27": "2.7",
114
114
  "311": "3.11",
115
+ "312": "3.12",
115
116
  }
116
117
 
117
118
  valid_python_versions = list(PYTHON_DOT_VERSIONS_BY_VER.keys())
@@ -126,13 +127,14 @@ def get_python_dot_version(version):
126
127
 
127
128
 
128
129
  ABIS_BY_PYTHON_VERSION = {
130
+ "27": ["cp27", "cp27m"],
129
131
  "36": ["cp36", "cp36m", "abi3"],
130
132
  "37": ["cp37", "cp37m", "abi3"],
131
133
  "38": ["cp38", "cp38m", "abi3"],
132
134
  "39": ["cp39", "cp39m", "abi3"],
133
135
  "310": ["cp310", "cp310m", "abi3"],
134
136
  "311": ["cp311", "cp311m", "abi3"],
135
- "27": ["cp27", "cp27m"],
137
+ "312": ["cp312", "cp312m", "abi3"],
136
138
  }
137
139
 
138
140
  PLATFORMS_BY_OS = {
@@ -1,6 +1,19 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v0.12.0
5
+ -----------
6
+
7
+ - Add support for Python3.12
8
+
9
+
10
+ v0.11.0
11
+ -----------
12
+
13
+ - Add ignore error mode.
14
+ - Fix missing index_urls parsing.
15
+
16
+
4
17
  v0.10.0
5
18
  -----------
6
19
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-inspector
3
- Version: 0.10.0
3
+ Version: 0.12.0
4
4
  Summary: python-inspector is is a collection of utilities to collect PyPI package metadata and resolve packages dependencies.
5
5
  Home-page: https://github.com/nexB/python-inspector
6
6
  Author: nexB. Inc. and others
@@ -48,6 +48,7 @@ Requires-Dist: pycodestyle >=2.8.0 ; extra == 'testing'
48
48
  Requires-Dist: twine ; extra == 'testing'
49
49
  Requires-Dist: black ; extra == 'testing'
50
50
  Requires-Dist: isort ; extra == 'testing'
51
+ Requires-Dist: pytest-rerunfailures ; extra == 'testing'
51
52
 
52
53
  python-inspector - inspect Python packages dependencies and metadata
53
54
  =====================================================================
@@ -8,32 +8,32 @@ _packagedcode/pypi_setup_py.py.ABOUT,sha256=7FLC7R73YDfzEu47fij39PxteCqmojKSexCh
8
8
  _packagedcode/pypi_setup_py.py.LICENSE,sha256=EsVAqcPMzlhNkyJ3j6EW_yF02WLs94p0w2igJYrUcxs,1077
9
9
  _packagedcode/utils.py,sha256=ibgl7lQLUFuC09Go9mSY4D455W4AvagaJ_kg1EO9eXo,6949
10
10
  python_inspector/__init__.py,sha256=-WeiNn9hvD3sGqwxrZQr0by1J7oo5QDPDAMe_cT5okQ,389
11
- python_inspector/api.py,sha256=kxhjaLCQjNJRLfiMqsaPXPnU2D12Cefk9H1gKOWt4t0,14212
12
- python_inspector/cli_utils.py,sha256=SDc-L5P_QWcEyRPYe_VMTU_9biirGbvHBX45tj2t5WI,1131
11
+ python_inspector/api.py,sha256=u95X6NvnhcsqWpDkTXY01S38Nh50bQWRL0flyZrqZic,14491
12
+ python_inspector/cli_utils.py,sha256=eBavSBaGpZV8_7kHhSO6zRYEBqaDOkIrdiOk0Jq-A4o,1130
13
13
  python_inspector/dependencies.py,sha256=2MYJZSUGokE3zSrOxUUyMfItyDSZ7YgMHgtVC-bglOU,2817
14
14
  python_inspector/error.py,sha256=WvTR5JTjziD42hxKftedb-pe2LUWWTsagW66gT3rtBo,448
15
15
  python_inspector/package_data.py,sha256=kCKHlc8yX25jdNBMvtn4fiw99YTs57DMQow8uwFW3jU,5849
16
- python_inspector/resolution.py,sha256=YMXw6m7T5hpHsXRDxWzJDRhBxjLcjC5_j4iIi5MBi7U,29114
16
+ python_inspector/resolution.py,sha256=Q-UoLg7gDT-YJw2zvVWOas5iS5kuNXyhH-I71jhiCss,29356
17
17
  python_inspector/resolution.py.ABOUT,sha256=tYLeHLgyo4zZrPlMXlVF59EjC-GGDaQeFKogf7M7rXg,705
18
18
  python_inspector/resolution.py.LICENSE,sha256=84j9OMrRMRLB3A9mm76A5_hFQe26-3LzAw0sp2QsPJ0,751
19
- python_inspector/resolve_cli.py,sha256=2bv8Xtsdi-hrLj-6VLqNHbhCMUXjyI85XssS2tWlSiI,11859
19
+ python_inspector/resolve_cli.py,sha256=MnbkdS6UF_dDTu_Jq3E3oDqSKntumDx0GtTf8LxMhjM,12039
20
20
  python_inspector/setup_py_live_eval.py,sha256=6iFI1u1fusqa_zF2w1V8buZgmLl2dUSZASclwuI551E,7607
21
21
  python_inspector/setup_py_live_eval.py.ABOUT,sha256=ecRsdi0Z--mX8gnSwQzE2OqucpmD0AsmPlojp70uPxI,396
22
22
  python_inspector/setup_py_live_eval.py.LICENSE,sha256=5wfEqJLf5ANizw20WUURuTgoZOzMRK_4iGA39BApyRk,1643
23
- python_inspector/utils.py,sha256=NHhj_DAfaoCi7EFi0fEHaffJa7KCysmFpeGTampsHUo,2342
23
+ python_inspector/utils.py,sha256=czDA_6lmXrX3PzY222xUTrUDYmfN_uWmNPMjTRc8OuE,2422
24
24
  python_inspector/utils_pip_compatibility_tags.py,sha256=oD6elof52LxPF9HOtPXPAi2mZkbqAXjDd1dCeRHI3Q4,6825
25
25
  python_inspector/utils_pip_compatibility_tags.py.ABOUT,sha256=v9PEBLLQGH1cJuJU7SeHd7q4b2li3_HOTlvgsQoMuRw,494
26
- python_inspector/utils_pypi.py,sha256=PQc0iBANiH6ayVOjSt6CQ9w1K8hpCFhPb5TgYW5DBjQ,57396
26
+ python_inspector/utils_pypi.py,sha256=9PDpKtJygBwI7n7_oLfHUF9weoogN9y2kMoX56kJMoI,57462
27
27
  python_inspector/utils_pypi.py.ABOUT,sha256=7s9WCNmS-qJJgHC979fI4whrM5Y41-Ar-LZoIfZXPVU,635
28
28
  python_inspector/utils_pypi_supported_tags.py,sha256=SdbIlKoCgyqBZIesEdrFhVMnYikBirvSDvPUPIomTSo,2850
29
29
  python_inspector/utils_pypi_supported_tags.py.ABOUT,sha256=ndJ1kQS6u7caYmLc6XVnNIdKfpnvGjKepxpmhQJWJyA,741
30
- python_inspector-0.10.0.dist-info/AUTHORS.rst,sha256=rRa-_IwbfBl84NqT5QZWFTXHsJnvRz8SP9dymwrEDAE,87
31
- python_inspector-0.10.0.dist-info/CHANGELOG.rst,sha256=EPtpVWijaJZRM3Xhv3uDQ9pUJILZ7o9svjGZ6PUtdDE,3495
32
- python_inspector-0.10.0.dist-info/CODE_OF_CONDUCT.rst,sha256=xXDTFpYY3Y7JoxrWADihieUvhGlwJc_oxsbmLJaBvE4,3422
33
- python_inspector-0.10.0.dist-info/METADATA,sha256=owdn9yNz0l1yQL2K4mKLhCG04C2suz3WZaTVPiwhNkc,4207
34
- python_inspector-0.10.0.dist-info/NOTICE,sha256=uEf5AAY7zIAS_ILkcEjEJ0Wt6wYWyU9d6FGPiAlpig4,770
35
- python_inspector-0.10.0.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
36
- python_inspector-0.10.0.dist-info/apache-2.0.LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
37
- python_inspector-0.10.0.dist-info/entry_points.txt,sha256=2s9F95rPWbgz3cOnKN3Z7PwzglPt2EsX2qf7W0Xubpk,87
38
- python_inspector-0.10.0.dist-info/top_level.txt,sha256=C-KAHTL8C6jd7QULvFk83YjOBVxDrnyefG3RikRHRlw,31
39
- python_inspector-0.10.0.dist-info/RECORD,,
30
+ python_inspector-0.12.0.dist-info/AUTHORS.rst,sha256=rRa-_IwbfBl84NqT5QZWFTXHsJnvRz8SP9dymwrEDAE,87
31
+ python_inspector-0.12.0.dist-info/CHANGELOG.rst,sha256=-EQB4SBAha94Z1KNWI98gvzbioOwgNbzgzafw0663RI,3629
32
+ python_inspector-0.12.0.dist-info/CODE_OF_CONDUCT.rst,sha256=xXDTFpYY3Y7JoxrWADihieUvhGlwJc_oxsbmLJaBvE4,3422
33
+ python_inspector-0.12.0.dist-info/METADATA,sha256=e7mbUy9dGRX0KApkaqRHDKe1rWLQLXsQeAnAZF8r6Kk,4264
34
+ python_inspector-0.12.0.dist-info/NOTICE,sha256=uEf5AAY7zIAS_ILkcEjEJ0Wt6wYWyU9d6FGPiAlpig4,770
35
+ python_inspector-0.12.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
36
+ python_inspector-0.12.0.dist-info/apache-2.0.LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
37
+ python_inspector-0.12.0.dist-info/entry_points.txt,sha256=2s9F95rPWbgz3cOnKN3Z7PwzglPt2EsX2qf7W0Xubpk,87
38
+ python_inspector-0.12.0.dist-info/top_level.txt,sha256=C-KAHTL8C6jd7QULvFk83YjOBVxDrnyefG3RikRHRlw,31
39
+ python_inspector-0.12.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.3)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5