nmk-python 1.12.0__py3-none-any.whl → 1.12.2__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.
- nmk_python/build.py +23 -15
- nmk_python/build.yml +1 -1
- nmk_python/tests.yml +1 -1
- {nmk_python-1.12.0.dist-info → nmk_python-1.12.2.dist-info}/METADATA +1 -1
- {nmk_python-1.12.0.dist-info → nmk_python-1.12.2.dist-info}/RECORD +9 -9
- {nmk_python-1.12.0.dist-info → nmk_python-1.12.2.dist-info}/WHEEL +1 -1
- {nmk_python-1.12.0.dist-info → nmk_python-1.12.2.dist-info}/entry_points.txt +0 -0
- {nmk_python-1.12.0.dist-info → nmk_python-1.12.2.dist-info}/licenses/LICENSE +0 -0
- {nmk_python-1.12.0.dist-info → nmk_python-1.12.2.dist-info}/top_level.txt +0 -0
nmk_python/build.py
CHANGED
|
@@ -263,6 +263,11 @@ _INTERNAL_DEPS_KEY = "internal"
|
|
|
263
263
|
_EXTERNAL_DEPS_KEY = "external"
|
|
264
264
|
|
|
265
265
|
|
|
266
|
+
# Normalization implementation
|
|
267
|
+
def _normalize(name: str) -> str:
|
|
268
|
+
return name.lower().replace("_", "-")
|
|
269
|
+
|
|
270
|
+
|
|
266
271
|
class DepsMetadataBuilder(NmkTaskBuilder):
|
|
267
272
|
"""
|
|
268
273
|
Generate python dependencies metadata file
|
|
@@ -278,21 +283,20 @@ class DepsMetadataBuilder(NmkTaskBuilder):
|
|
|
278
283
|
:param fail_on_error: if there are mismatches between actual dependencies and constraints, and if true, and the build in error
|
|
279
284
|
"""
|
|
280
285
|
|
|
281
|
-
# Normalization implementation
|
|
282
|
-
def normalize(name: str) -> str:
|
|
283
|
-
return name.lower().replace("_", "-")
|
|
284
|
-
|
|
285
286
|
# Prepare distributions map
|
|
286
|
-
distributions = {
|
|
287
|
-
normalized_root_name =
|
|
287
|
+
distributions = {_normalize(d.name): d for d in importlib.metadata.distributions() if d.name}
|
|
288
|
+
normalized_root_name = _normalize(root_name)
|
|
288
289
|
assert normalized_root_name in distributions, f"Root package '{normalized_root_name}' not found in installed distributions"
|
|
289
290
|
output_data: dict[str, dict[str, str]] = {_INTERNAL_DEPS_KEY: {}, _EXTERNAL_DEPS_KEY: {}}
|
|
291
|
+
visited: set[tuple[str, frozenset[str]]] = set()
|
|
290
292
|
|
|
291
293
|
# Visitor implementation
|
|
292
|
-
def visit(name: str):
|
|
293
|
-
# Already visited or unknown?
|
|
294
|
-
|
|
294
|
+
def visit(name: str, extras: frozenset[str] = frozenset()):
|
|
295
|
+
# Already visited with the same extras or unknown?
|
|
296
|
+
visit_key = (name, extras)
|
|
297
|
+
if visit_key in visited or name not in distributions:
|
|
295
298
|
return
|
|
299
|
+
visited.add(visit_key)
|
|
296
300
|
|
|
297
301
|
# Check for internal/external dependency
|
|
298
302
|
if name != root_name:
|
|
@@ -309,11 +313,15 @@ class DepsMetadataBuilder(NmkTaskBuilder):
|
|
|
309
313
|
req = Requirement(dep)
|
|
310
314
|
|
|
311
315
|
# Check marker, if any (but not for root package dependencies, which are always included)
|
|
312
|
-
if (
|
|
316
|
+
if (
|
|
317
|
+
(name != root_name)
|
|
318
|
+
and (req.marker is not None)
|
|
319
|
+
and (not any(req.marker.evaluate(environment={"extra": extra}) for extra in extras) if extras else not req.marker.evaluate())
|
|
320
|
+
):
|
|
313
321
|
continue
|
|
314
322
|
|
|
315
323
|
# Visit dependency if installed
|
|
316
|
-
visit(
|
|
324
|
+
visit(_normalize(req.name), frozenset(req.extras))
|
|
317
325
|
|
|
318
326
|
# Visit from root
|
|
319
327
|
visit(root_name)
|
|
@@ -342,7 +350,7 @@ class DepsMetadataBuilder(NmkTaskBuilder):
|
|
|
342
350
|
|
|
343
351
|
def _check_constraints(self, constraints: list[str], deps: dict[str, str], fail_on_error: bool):
|
|
344
352
|
# Build all requirements
|
|
345
|
-
all_reqs = {r[0].name: r for r in [(Requirement(line), line) for line in constraints]}
|
|
353
|
+
all_reqs = {_normalize(r[0].name): r for r in [(Requirement(line), line) for line in constraints]}
|
|
346
354
|
|
|
347
355
|
# Count errors
|
|
348
356
|
errors = 0
|
|
@@ -350,13 +358,13 @@ class DepsMetadataBuilder(NmkTaskBuilder):
|
|
|
350
358
|
# Browse dependencies
|
|
351
359
|
for name, version in deps.items():
|
|
352
360
|
# Check missing constraint on actual dependency
|
|
353
|
-
if name not in all_reqs:
|
|
354
|
-
self.logger.warning(f"Found dependency with missing constraint:
|
|
361
|
+
if _normalize(name) not in all_reqs:
|
|
362
|
+
self.logger.warning(f"Found dependency with missing constraint: {name}")
|
|
355
363
|
errors += 1
|
|
356
364
|
continue
|
|
357
365
|
|
|
358
366
|
# Check mismatch version
|
|
359
|
-
req, req_line = all_reqs[name]
|
|
367
|
+
req, req_line = all_reqs[_normalize(name)]
|
|
360
368
|
if Version(version) not in req.specifier:
|
|
361
369
|
self.logger.warning(f"Found dependency with constraint mismatch: {name} ({version}) vs '{req_line}'")
|
|
362
370
|
errors += 1
|
nmk_python/build.yml
CHANGED
nmk_python/tests.yml
CHANGED
|
@@ -28,7 +28,7 @@ config:
|
|
|
28
28
|
# Additional github build step: upload coverage report on codecov
|
|
29
29
|
githubBuildSteps:
|
|
30
30
|
- name: Upload coverage information
|
|
31
|
-
uses: codecov/codecov-action@
|
|
31
|
+
uses: codecov/codecov-action@v7.1.1
|
|
32
32
|
with:
|
|
33
33
|
files: ${r!pythonCoverageXmlReport}
|
|
34
34
|
env:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
nmk_python/__init__.py,sha256=EouCWXbAeObby1vOCx0Vx_WaGC2fEEFDMCen3JZt4TU,446
|
|
2
2
|
nmk_python/badges.yml,sha256=LzElZecCXKxdF-oPkvIwfnbQlOcAM_zUj6MelClmAug,749
|
|
3
|
-
nmk_python/build.py,sha256=
|
|
4
|
-
nmk_python/build.yml,sha256=
|
|
3
|
+
nmk_python/build.py,sha256=lw2lMJoE4pgoSDkMAR68xRBoszzr_c2QvHzoARWoRiI,17163
|
|
4
|
+
nmk_python/build.yml,sha256=nsHgL_2zrWKDV2bkiSMKZTtU_FKVCDXXRThajKylcsw,6527
|
|
5
5
|
nmk_python/doc.yml,sha256=12amAlYylH7JAHaqBIOoEZ_LrXY_bPNKuHrrwUkIj8w,932
|
|
6
6
|
nmk_python/files.py,sha256=K6Y-XKXuf8jh4x333Qgj6G1MyB-BgZ5Kd2-XCZhsfR4,2000
|
|
7
7
|
nmk_python/files.yml,sha256=jlp87gW9rTASUnsy7id7VWanaMUMN_py82bMa2adniM,813
|
|
@@ -10,7 +10,7 @@ nmk_python/project.yml,sha256=wBnB6KOglRvIpw1UHuXTYmuE_2BYGBzGWwIEbA5NDv8,985
|
|
|
10
10
|
nmk_python/ruff.py,sha256=TBmn5nFflcFRvjj36JtJGJ-GYHOK6XfhK9Jp-2dO5_E,1557
|
|
11
11
|
nmk_python/ruff.yml,sha256=L3vSTLGI3ZP46D64VxenhF9Gz3lo5-J9cRwgKBrVl48,2732
|
|
12
12
|
nmk_python/tests.py,sha256=p2dl41eZW8cpUMOa2DXi3CN3iVQEnElC88Ke89PRyy8,1597
|
|
13
|
-
nmk_python/tests.yml,sha256=
|
|
13
|
+
nmk_python/tests.yml,sha256=WwQPgVKztrWAn-JXdMdhYuu0DrnQSXgkwWNn8Nn7X0o,1636
|
|
14
14
|
nmk_python/version.py,sha256=ivSff_1l-u-rSACF91s58zX_EUzl0ate_JcX_l7dSQk,2739
|
|
15
15
|
nmk_python/version.yml,sha256=D_rUnEzjEtCmCgUhfaDPSsANaRkcDW7aZgPX6GZOUIk,1159
|
|
16
16
|
nmk_python/_buildenv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -30,9 +30,9 @@ nmk_python/templates/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
30
30
|
nmk_python/templates/src/__init__.py.jinja,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
31
|
nmk_python/templates/src/sample.py.jinja,sha256=OOTps7EjviwYFCIb5GpMHcidxhBY5NLQVlcFLqxuxNU,227
|
|
32
32
|
nmk_python/templates/src/test_sample.py.jinja,sha256=u-ShBoKDF3se9KvgQ1SzO4NwymjqNowwURF4Q1oR3wo,221
|
|
33
|
-
nmk_python-1.12.
|
|
34
|
-
nmk_python-1.12.
|
|
35
|
-
nmk_python-1.12.
|
|
36
|
-
nmk_python-1.12.
|
|
37
|
-
nmk_python-1.12.
|
|
38
|
-
nmk_python-1.12.
|
|
33
|
+
nmk_python-1.12.2.dist-info/licenses/LICENSE,sha256=PROo9EW7wP6jmSr_90OluItAsIB411b_CAqEBioMKpI,1074
|
|
34
|
+
nmk_python-1.12.2.dist-info/METADATA,sha256=zYe92S02Xi3LNEwkC-OHYMxKlj2Ky8PBKAzk_uaKLmE,3205
|
|
35
|
+
nmk_python-1.12.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
36
|
+
nmk_python-1.12.2.dist-info/entry_points.txt,sha256=QLXIIXl6wODHDnVkh7KuiLv_XzfFtNfdWwpxyB675ak,88
|
|
37
|
+
nmk_python-1.12.2.dist-info/top_level.txt,sha256=MCb5w_hoOZ0kk3Dajxrd9Pz6lZ3pyuS6TQCRA3vddTo,11
|
|
38
|
+
nmk_python-1.12.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|