nmk-python 1.12.1__py3-none-any.whl → 1.13.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.
- nmk_python/build.py +33 -16
- nmk_python/build.yml +1 -0
- nmk_python/tests.yml +1 -1
- {nmk_python-1.12.1.dist-info → nmk_python-1.13.0.dist-info}/METADATA +1 -1
- {nmk_python-1.12.1.dist-info → nmk_python-1.13.0.dist-info}/RECORD +9 -9
- {nmk_python-1.12.1.dist-info → nmk_python-1.13.0.dist-info}/WHEEL +0 -0
- {nmk_python-1.12.1.dist-info → nmk_python-1.13.0.dist-info}/entry_points.txt +0 -0
- {nmk_python-1.12.1.dist-info → nmk_python-1.13.0.dist-info}/licenses/LICENSE +0 -0
- {nmk_python-1.12.1.dist-info → nmk_python-1.13.0.dist-info}/top_level.txt +0 -0
nmk_python/build.py
CHANGED
|
@@ -166,7 +166,7 @@ class Uninstaller(NmkTaskBuilder):
|
|
|
166
166
|
Uninstall current project wheel from venv
|
|
167
167
|
"""
|
|
168
168
|
|
|
169
|
-
def build(self, name: str, local_deps: list[str] | None = None): # pyright: ignore[reportIncompatibleMethodOverride]
|
|
169
|
+
def build(self, name: str, local_deps: list[str] | None = None, lock_files: list[str] | None = None): # pyright: ignore[reportIncompatibleMethodOverride]
|
|
170
170
|
"""
|
|
171
171
|
Uninstall wheel from venv
|
|
172
172
|
|
|
@@ -174,8 +174,17 @@ class Uninstaller(NmkTaskBuilder):
|
|
|
174
174
|
|
|
175
175
|
:param name: wheel name to be uninstalled
|
|
176
176
|
:param local_deps: list of workspace local dependencies patterns, used to find additional wheels to uninstall
|
|
177
|
+
:param lock_files: list of paths to lock files to be cleaned
|
|
177
178
|
"""
|
|
178
179
|
|
|
180
|
+
# Clean lock files, if required and present
|
|
181
|
+
project_root = self.model.env_backend.project_path
|
|
182
|
+
for lock_file_path in filter(
|
|
183
|
+
lambda p: p.is_file(), map(lambda p: p if p.is_absolute() else project_root / p, map(Path, lock_files if lock_files else []))
|
|
184
|
+
):
|
|
185
|
+
self.logger.debug(f"Removing lock file: {lock_file_path}")
|
|
186
|
+
lock_file_path.unlink()
|
|
187
|
+
|
|
179
188
|
# Find local deps to uninstall, from provided packages
|
|
180
189
|
wheel_names = set([name])
|
|
181
190
|
eb = cast(EnvBackend, self.model.env_backend) # type: ignore
|
|
@@ -263,6 +272,11 @@ _INTERNAL_DEPS_KEY = "internal"
|
|
|
263
272
|
_EXTERNAL_DEPS_KEY = "external"
|
|
264
273
|
|
|
265
274
|
|
|
275
|
+
# Normalization implementation
|
|
276
|
+
def _normalize(name: str) -> str:
|
|
277
|
+
return name.lower().replace("_", "-")
|
|
278
|
+
|
|
279
|
+
|
|
266
280
|
class DepsMetadataBuilder(NmkTaskBuilder):
|
|
267
281
|
"""
|
|
268
282
|
Generate python dependencies metadata file
|
|
@@ -278,21 +292,20 @@ class DepsMetadataBuilder(NmkTaskBuilder):
|
|
|
278
292
|
:param fail_on_error: if there are mismatches between actual dependencies and constraints, and if true, and the build in error
|
|
279
293
|
"""
|
|
280
294
|
|
|
281
|
-
# Normalization implementation
|
|
282
|
-
def normalize(name: str) -> str:
|
|
283
|
-
return name.lower().replace("_", "-")
|
|
284
|
-
|
|
285
295
|
# Prepare distributions map
|
|
286
|
-
distributions = {
|
|
287
|
-
normalized_root_name =
|
|
296
|
+
distributions = {_normalize(d.name): d for d in importlib.metadata.distributions() if d.name}
|
|
297
|
+
normalized_root_name = _normalize(root_name)
|
|
288
298
|
assert normalized_root_name in distributions, f"Root package '{normalized_root_name}' not found in installed distributions"
|
|
289
299
|
output_data: dict[str, dict[str, str]] = {_INTERNAL_DEPS_KEY: {}, _EXTERNAL_DEPS_KEY: {}}
|
|
300
|
+
visited: set[tuple[str, frozenset[str]]] = set()
|
|
290
301
|
|
|
291
302
|
# Visitor implementation
|
|
292
|
-
def visit(name: str):
|
|
293
|
-
# Already visited or unknown?
|
|
294
|
-
|
|
303
|
+
def visit(name: str, extras: frozenset[str] = frozenset()):
|
|
304
|
+
# Already visited with the same extras or unknown?
|
|
305
|
+
visit_key = (name, extras)
|
|
306
|
+
if visit_key in visited or name not in distributions:
|
|
295
307
|
return
|
|
308
|
+
visited.add(visit_key)
|
|
296
309
|
|
|
297
310
|
# Check for internal/external dependency
|
|
298
311
|
if name != root_name:
|
|
@@ -309,11 +322,15 @@ class DepsMetadataBuilder(NmkTaskBuilder):
|
|
|
309
322
|
req = Requirement(dep)
|
|
310
323
|
|
|
311
324
|
# Check marker, if any (but not for root package dependencies, which are always included)
|
|
312
|
-
if (
|
|
325
|
+
if (
|
|
326
|
+
(name != root_name)
|
|
327
|
+
and (req.marker is not None)
|
|
328
|
+
and (not any(req.marker.evaluate(environment={"extra": extra}) for extra in extras) if extras else not req.marker.evaluate())
|
|
329
|
+
):
|
|
313
330
|
continue
|
|
314
331
|
|
|
315
332
|
# Visit dependency if installed
|
|
316
|
-
visit(
|
|
333
|
+
visit(_normalize(req.name), frozenset(req.extras))
|
|
317
334
|
|
|
318
335
|
# Visit from root
|
|
319
336
|
visit(root_name)
|
|
@@ -342,7 +359,7 @@ class DepsMetadataBuilder(NmkTaskBuilder):
|
|
|
342
359
|
|
|
343
360
|
def _check_constraints(self, constraints: list[str], deps: dict[str, str], fail_on_error: bool):
|
|
344
361
|
# Build all requirements
|
|
345
|
-
all_reqs = {r[0].name: r for r in [(Requirement(line), line) for line in constraints]}
|
|
362
|
+
all_reqs = {_normalize(r[0].name): r for r in [(Requirement(line), line) for line in constraints]}
|
|
346
363
|
|
|
347
364
|
# Count errors
|
|
348
365
|
errors = 0
|
|
@@ -350,13 +367,13 @@ class DepsMetadataBuilder(NmkTaskBuilder):
|
|
|
350
367
|
# Browse dependencies
|
|
351
368
|
for name, version in deps.items():
|
|
352
369
|
# Check missing constraint on actual dependency
|
|
353
|
-
if name not in all_reqs:
|
|
354
|
-
self.logger.warning(f"Found dependency with missing constraint:
|
|
370
|
+
if _normalize(name) not in all_reqs:
|
|
371
|
+
self.logger.warning(f"Found dependency with missing constraint: {name}")
|
|
355
372
|
errors += 1
|
|
356
373
|
continue
|
|
357
374
|
|
|
358
375
|
# Check mismatch version
|
|
359
|
-
req, req_line = all_reqs[name]
|
|
376
|
+
req, req_line = all_reqs[_normalize(name)]
|
|
360
377
|
if Version(version) not in req.specifier:
|
|
361
378
|
self.logger.warning(f"Found dependency with constraint mismatch: {name} ({version}) vs '{req_line}'")
|
|
362
379
|
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=5acJJ1EQGEqvcOhBqA2qtTzGaZBviAliEEvjIj8ybu8,17675
|
|
4
|
+
nmk_python/build.yml,sha256=x1jPasHa0h9Bgqmc-xnr-IBmjLBpNLdE3aEZXYMgsZA,6570
|
|
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.
|
|
34
|
-
nmk_python-1.
|
|
35
|
-
nmk_python-1.
|
|
36
|
-
nmk_python-1.
|
|
37
|
-
nmk_python-1.
|
|
38
|
-
nmk_python-1.
|
|
33
|
+
nmk_python-1.13.0.dist-info/licenses/LICENSE,sha256=PROo9EW7wP6jmSr_90OluItAsIB411b_CAqEBioMKpI,1074
|
|
34
|
+
nmk_python-1.13.0.dist-info/METADATA,sha256=hzKrXJ3O6HtO25C6qTUYD1I_P32D8VzOlZhRcwfYgTw,3205
|
|
35
|
+
nmk_python-1.13.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
36
|
+
nmk_python-1.13.0.dist-info/entry_points.txt,sha256=QLXIIXl6wODHDnVkh7KuiLv_XzfFtNfdWwpxyB675ak,88
|
|
37
|
+
nmk_python-1.13.0.dist-info/top_level.txt,sha256=MCb5w_hoOZ0kk3Dajxrd9Pz6lZ3pyuS6TQCRA3vddTo,11
|
|
38
|
+
nmk_python-1.13.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|