nmk-python 2.0.0__py3-none-any.whl → 2.0.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.
@@ -21,13 +21,6 @@ class PythonBuildBackend(ABC):
21
21
  self._model = model
22
22
  self._env_backend = cast(EnvBackend, model.env_backend) # type: ignore
23
23
 
24
- @abstractmethod
25
- def install_editable(self): # pragma: no cover
26
- """
27
- Install current project as editable package
28
- """
29
- pass
30
-
31
24
  @abstractmethod
32
25
  def install_wheel(self, wheel_path: Path): # pragma: no cover
33
26
  """
@@ -47,10 +40,8 @@ class PythonBuildBackend(ABC):
47
40
  pass
48
41
 
49
42
  @abstractmethod
50
- def uninstall_wheels(self, wheel_names: list[str]): # pragma: no cover
43
+ def uninstall_wheels(self): # pragma: no cover
51
44
  """
52
- Uninstall specified wheels
53
-
54
- :param wheel_names: names of the wheels to uninstall
45
+ Uninstall wheels (i.e. restore venv in editable mode)
55
46
  """
56
47
  pass
@@ -3,7 +3,6 @@ Uv build backend module.
3
3
  """
4
4
 
5
5
  from pathlib import Path
6
- from typing import cast
7
6
 
8
7
  from .build_backend import PythonBuildBackend
9
8
 
@@ -15,23 +14,10 @@ class UvBuildBackend(PythonBuildBackend):
15
14
  :param model: NmkModel instance
16
15
  """
17
16
 
18
- def install_editable(self):
19
- # Prepare install args
20
- install_args = ["sync"]
21
-
22
- # Add extra args from model config
23
- install_args += cast(list[str], self._model.config["pythonEditableUvInstallArgs"].value)
24
-
25
- # Delegate to subprocess
26
- self._env_backend.subprocess(install_args, cwd=self._env_backend.project_path)
27
-
28
17
  def install_wheel(self, wheel_path: Path):
29
18
  # Prepare install args
30
19
  install_args = ["pip", "install", str(wheel_path)]
31
20
 
32
- # Add extra args from model config
33
- install_args += cast(list[str], self._model.config["pythonWheelUvInstallArgs"].value)
34
-
35
21
  # Delegate to subprocess
36
22
  self._env_backend.subprocess(install_args, cwd=self._env_backend.project_path)
37
23
 
@@ -46,6 +32,6 @@ class UvBuildBackend(PythonBuildBackend):
46
32
  # Return built wheel path
47
33
  return build_dir / wheel_sub_dir / built_wheel_name
48
34
 
49
- def uninstall_wheels(self, wheel_names: list[str]):
50
- # Same as setup, just don't print updates (will be done by uninstall builder)
51
- self._env_backend.upgrade(full=False, only_deps=True, print_updates=False)
35
+ def uninstall_wheels(self):
36
+ # Same as setup, in exact mode, to uninstall all extra wheels
37
+ self._env_backend.upgrade(full=False, exact=True)
nmk_python/build.py CHANGED
@@ -7,11 +7,9 @@ import json
7
7
  import os
8
8
  import shutil
9
9
  from fnmatch import fnmatch
10
- from itertools import product
11
10
  from pathlib import Path
12
11
  from typing import cast
13
12
 
14
- from nmk.envbackend import EnvBackend
15
13
  from nmk.logs import NmkLogger, NmkLogWrapper
16
14
  from nmk.model.builder import NmkTaskBuilder
17
15
  from nmk.model.model import NmkModel
@@ -139,25 +137,18 @@ class Installer(NmkTaskBuilder):
139
137
  Install built wheel in venv
140
138
  """
141
139
 
142
- def build(self, name: str, wheel: str, to_remove: str = ""): # pyright: ignore[reportIncompatibleMethodOverride]
140
+ def build(self, name: str, wheel: str): # pyright: ignore[reportIncompatibleMethodOverride]
143
141
  """
144
142
  Install wheel in venv
145
143
 
146
144
  :param name: wheel name to be installed
147
145
  :param wheel: wheel path to be installed
148
- :param to_remove: stamp file to be removed
149
146
  """
150
147
 
151
148
  # Check if wheel can be installed
152
149
  if _can_install(name, self.logger):
153
150
  # Delegate to build backend
154
- eb = cast(EnvBackend, self.model.env_backend) # type: ignore
155
- old_packages = eb.installed_packages
156
151
  BuildBackendFactory.create(self.model).install_wheel(wheel_path=Path(wheel))
157
- eb.print_updates(old_packages, ignored_packages=set([name]))
158
-
159
- # Remove stamp file
160
- Path(to_remove).unlink(missing_ok=True)
161
152
 
162
153
 
163
154
  class Uninstaller(NmkTaskBuilder):
@@ -165,51 +156,15 @@ class Uninstaller(NmkTaskBuilder):
165
156
  Uninstall current project wheel from venv
166
157
  """
167
158
 
168
- def build(self, name: str, local_deps: list[str] | None = None): # pyright: ignore[reportIncompatibleMethodOverride]
159
+ def build(self):
169
160
  """
170
- Uninstall wheel from venv
161
+ Uninstall wheel from venv (i.e. restore venv in editable mode)
171
162
 
172
163
  Note that task won't fail if the wheel is not installed
173
-
174
- :param name: wheel name to be uninstalled
175
- :param local_deps: list of workspace local dependencies patterns, used to find additional wheels to uninstall
176
164
  """
177
165
 
178
- # Find local deps to uninstall, from provided packages
179
- wheel_names = set([name])
180
- eb = cast(EnvBackend, self.model.env_backend) # type: ignore
181
- old_packages = eb.installed_packages
182
- for pattern, dep_name in product(local_deps if local_deps else [], old_packages.keys()):
183
- if fnmatch(dep_name, pattern):
184
- self.logger.debug(f"wheel name '{dep_name}' matches local dependency pattern '{pattern}', will be uninstalled")
185
- wheel_names.add(dep_name)
186
-
187
166
  # Delegate to build backend
188
- BuildBackendFactory.create(self.model).uninstall_wheels(wheel_names=sorted(list(wheel_names)))
189
- eb.print_updates(old_packages, ignored_packages=set([_python_package(self.model)]))
190
-
191
-
192
- class EditableBuilder(NmkTaskBuilder):
193
- """
194
- Install python project in editable mode
195
- """
196
-
197
- def build(self):
198
- """
199
- Install project in venv as editable package
200
- """
201
-
202
- # Check if project can be installed in editable mode
203
- package_name = _python_package(self.model)
204
- if _can_install(package_name, self.logger):
205
- # Delegate to build backend
206
- eb = cast(EnvBackend, self.model.env_backend) # type: ignore
207
- old_packages = eb.installed_packages
208
- BuildBackendFactory.create(self.model).install_editable()
209
- eb.print_updates(old_packages, ignored_packages=set([package_name]))
210
-
211
- # Touch stamp file
212
- self.main_output.touch()
167
+ BuildBackendFactory.create(self.model).uninstall_wheels()
213
168
 
214
169
 
215
170
  class PythonOptionalDepsResolver(NmkListConfigResolver):
nmk_python/build.yml CHANGED
@@ -56,9 +56,6 @@ config:
56
56
  # Extra (external) resources to be bundled in built python wheel
57
57
  pythonExtraResources: {}
58
58
 
59
- # Python editable install stamp
60
- pythonEditableStamp: ${outputDir}/.pyeditable
61
-
62
59
  # Python files to be ignored
63
60
  gitIgnoredFiles:
64
61
  - .eggs/
@@ -75,12 +72,6 @@ config:
75
72
  password: ${{ secrets.pypi_password }}
76
73
  packages_dir: ${r!pythonBuildDir}/wheel_dist
77
74
 
78
- # Wheel install arguments (for uv backend)
79
- pythonWheelUvInstallArgs: []
80
-
81
- # Editable install arguments (for uv backend)
82
- pythonEditableUvInstallArgs: []
83
-
84
75
  # Type checking mode for Pyright; may be off, basic, standard, strict
85
76
  pythonTypeCheckingMode: strict
86
77
 
@@ -110,28 +101,12 @@ config:
110
101
  pythonConstraintsStrictCheck: false
111
102
 
112
103
  tasks:
113
- # Python editable install
114
- py.editable:
115
- description: Install python editable package
116
- emoji: ":snake:.:house:"
117
- deps:
118
- - py.project
119
- - py.format
120
- - py.analyze
121
- appendToDeps: build.compile
122
- if: ${pythonSrcFiles} # Only if python source files are found
123
- output:
124
- - ${pythonEditableStamp}
125
- input:
126
- - ${pythonProjectFile}
127
- builder: nmk_python.build.EditableBuilder
128
-
129
104
  # Python dependencies metadata
130
105
  py.deps:
131
106
  description: Gather python dependencies metadata
132
107
  emoji: ":snake:.:link:"
133
108
  deps:
134
- - py.editable
109
+ - py.project
135
110
  appendToDeps: build.compile
136
111
  if: ${pythonSrcFiles} # Only if python source files are found
137
112
  output:
@@ -185,16 +160,12 @@ tasks:
185
160
  params:
186
161
  name: ${pythonPackage}
187
162
  wheel: ${pythonWheel}
188
- to_remove: ${pythonEditableStamp}
189
163
 
190
164
  # Python module clean
191
165
  py.uninstall:
192
- description: Uninstall python package and local dependencies
166
+ description: Uninstall python wheel
193
167
  emoji: ":broom:.:snake:"
194
168
  appendToDeps:
195
169
  - clean
196
170
  builder: nmk_python.build.Uninstaller
197
- params:
198
- name: ${pythonPackage}
199
- local_deps: ${pythonLocalDepsPatterns}
200
171
  if: ${pythonSrcFiles} # Only if python source files are found
nmk_python/tests.yml CHANGED
@@ -44,8 +44,6 @@ tasks:
44
44
  py.tests:
45
45
  description: Run python tests
46
46
  emoji: ":snake:.:crossed_fingers:"
47
- deps:
48
- - py.editable
49
47
  appendToDeps: tests
50
48
  output:
51
49
  - ${pythonCoverageHtmlReport}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nmk-python
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Python plugin for nmk build system
5
5
  Author: The dynod project
6
6
  Maintainer: The dynod project
@@ -16,7 +16,8 @@ Classifier: Programming Language :: Python :: 3.15
16
16
  Requires-Python: >=3.11
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
- Requires-Dist: nmk-base>=1.5.0
19
+ Requires-Dist: nmk-base>=2.0.0
20
+ Requires-Dist: buildenv>=3.0.0
20
21
  Requires-Dist: nmk>=1.5.1
21
22
  Requires-Dist: Jinja2
22
23
  Requires-Dist: tomlkit
@@ -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=0wah9c6GHzhEo9sELn2fCTBzCO1H9uPiZUYFO_Ayo-M,16277
4
- nmk_python/build.yml,sha256=db5NXEPIyvYEDCJboBtcNGabnLYNeD2y-l7MxVJmDoE,5764
3
+ nmk_python/build.py,sha256=-JQt9zg17Hf56RmqgBHxo4SKMYQDR2Akea8E0YGFMkI,14224
4
+ nmk_python/build.yml,sha256=F-NMVF-6UJH575KRbB2_pH8ZNH2Jgrl9NQ5SJk_cYgo,4954
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,15 +10,15 @@ 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=WwQPgVKztrWAn-JXdMdhYuu0DrnQSXgkwWNn8Nn7X0o,1636
13
+ nmk_python/tests.yml,sha256=v130d_UzH0bKvuhch8DoVANn6ZqLkdRNnMu6cJsmLxk,1606
14
14
  nmk_python/version.py,sha256=ivSff_1l-u-rSACF91s58zX_EUzl0ate_JcX_l7dSQk,2739
15
15
  nmk_python/version.yml,sha256=R8l1xXwMdU3JGlK0dpSH3mf7HYLmwETH0kdRUAcGgJ0,1159
16
16
  nmk_python/_buildenv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  nmk_python/_buildenv/template.py,sha256=-yugMcl93gcKfPKrLYTmIMOEIoNvVWGVnqkY3-z4JF8,3922
18
18
  nmk_python/backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- nmk_python/backends/build_backend.py,sha256=WO0wZaxGdPna4K2yK7pNLtZX3cKf6atLLa00931N43Y,1400
19
+ nmk_python/backends/build_backend.py,sha256=F3ky1CoMjSWfcFiPVRvfJmsv34MwpTbk5pBFhIMaqX0,1179
20
20
  nmk_python/backends/factory.py,sha256=hlR-CTE4wAoYBO1t2DQe_ISXv8rSMft8kKQSjeAKr5M,855
21
- nmk_python/backends/uv_build_backend.py,sha256=gpM1L5FuJ5CF-OkRORnAbZHACPNhjkoO1sKZtdAhpf0,1671
21
+ nmk_python/backends/uv_build_backend.py,sha256=mV9Hd90UlM7iB31fsN_6iFfC3J69fxowRQV8svYun6U,1086
22
22
  nmk_python/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  nmk_python/templates/build.toml.jinja,sha256=D-RYPUGiqkYUKyQt_dP_tNFU-83eer7bnv57k4pMmIw,2137
24
24
  nmk_python/templates/pytest.toml.jinja,sha256=zQ3SRWnF23Omxm7zInE54j0l3OyjXSOn5pQ5Pak8Boo,641
@@ -29,9 +29,9 @@ nmk_python/templates/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
29
29
  nmk_python/templates/src/__init__.py.jinja,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  nmk_python/templates/src/sample.py.jinja,sha256=OOTps7EjviwYFCIb5GpMHcidxhBY5NLQVlcFLqxuxNU,227
31
31
  nmk_python/templates/src/test_sample.py.jinja,sha256=u-ShBoKDF3se9KvgQ1SzO4NwymjqNowwURF4Q1oR3wo,221
32
- nmk_python-2.0.0.dist-info/licenses/LICENSE,sha256=PROo9EW7wP6jmSr_90OluItAsIB411b_CAqEBioMKpI,1074
33
- nmk_python-2.0.0.dist-info/METADATA,sha256=aGsUG9vkfMt-WQA_VQaKmsoSJy8Wbxme3ymoXrIfg_U,3204
34
- nmk_python-2.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
35
- nmk_python-2.0.0.dist-info/entry_points.txt,sha256=QLXIIXl6wODHDnVkh7KuiLv_XzfFtNfdWwpxyB675ak,88
36
- nmk_python-2.0.0.dist-info/top_level.txt,sha256=MCb5w_hoOZ0kk3Dajxrd9Pz6lZ3pyuS6TQCRA3vddTo,11
37
- nmk_python-2.0.0.dist-info/RECORD,,
32
+ nmk_python-2.0.2.dist-info/licenses/LICENSE,sha256=PROo9EW7wP6jmSr_90OluItAsIB411b_CAqEBioMKpI,1074
33
+ nmk_python-2.0.2.dist-info/METADATA,sha256=2f6RM34h4sh8VlQYc3219DGhrFeoxF4irquniOix0wE,3235
34
+ nmk_python-2.0.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
35
+ nmk_python-2.0.2.dist-info/entry_points.txt,sha256=QLXIIXl6wODHDnVkh7KuiLv_XzfFtNfdWwpxyB675ak,88
36
+ nmk_python-2.0.2.dist-info/top_level.txt,sha256=MCb5w_hoOZ0kk3Dajxrd9Pz6lZ3pyuS6TQCRA3vddTo,11
37
+ nmk_python-2.0.2.dist-info/RECORD,,