nmk-python 1.13.1__py3-none-any.whl → 2.0.1__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
@@ -5,11 +5,10 @@ Build backend factory definition module
5
5
  from nmk.model.model import NmkModel
6
6
 
7
7
  from .build_backend import PythonBuildBackend
8
- from .pip_build_backend import PipBuildBackend
9
8
  from .uv_build_backend import UvBuildBackend
10
9
 
11
10
  # Supported backends mapping
12
- _SUPPORTED_BACKENDS = {"pip": PipBuildBackend, "legacy": PipBuildBackend, "uv": UvBuildBackend}
11
+ _SUPPORTED_BACKENDS = {"uv": UvBuildBackend}
13
12
 
14
13
 
15
14
  class BuildBackendFactory:
@@ -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]):
35
+ def uninstall_wheels(self):
50
36
  # 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)
37
+ self._env_backend.upgrade(full=False)
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,26 +137,18 @@ class Installer(NmkTaskBuilder):
139
137
  Install built wheel in venv
140
138
  """
141
139
 
142
- def build(self, name: str, wheel: str, pip_args: list[str] | None = None, 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 pip_args: pip command line arguments; deprecated, not used anymore
149
- :param to_remove: stamp file to be removed
150
146
  """
151
147
 
152
148
  # Check if wheel can be installed
153
149
  if _can_install(name, self.logger):
154
150
  # Delegate to build backend
155
- eb = cast(EnvBackend, self.model.env_backend) # type: ignore
156
- old_packages = eb.installed_packages
157
151
  BuildBackendFactory.create(self.model).install_wheel(wheel_path=Path(wheel))
158
- eb.print_updates(old_packages, ignored_packages=set([name]))
159
-
160
- # Remove stamp file
161
- Path(to_remove).unlink(missing_ok=True)
162
152
 
163
153
 
164
154
  class Uninstaller(NmkTaskBuilder):
@@ -166,62 +156,15 @@ class Uninstaller(NmkTaskBuilder):
166
156
  Uninstall current project wheel from venv
167
157
  """
168
158
 
169
- def build(self, name: str, local_deps: list[str] | None = None, lock_files: list[str] | None = None): # pyright: ignore[reportIncompatibleMethodOverride]
159
+ def build(self):
170
160
  """
171
- Uninstall wheel from venv
161
+ Uninstall wheel from venv (i.e. restore venv in editable mode)
172
162
 
173
163
  Note that task won't fail if the wheel is not installed
174
-
175
- :param name: wheel name to be uninstalled
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
178
164
  """
179
165
 
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
-
188
- # Find local deps to uninstall, from provided packages
189
- wheel_names = set([name])
190
- eb = cast(EnvBackend, self.model.env_backend) # type: ignore
191
- old_packages = eb.installed_packages
192
- for pattern, dep_name in product(local_deps if local_deps else [], old_packages.keys()):
193
- if fnmatch(dep_name, pattern):
194
- self.logger.debug(f"wheel name '{dep_name}' matches local dependency pattern '{pattern}', will be uninstalled")
195
- wheel_names.add(dep_name)
196
-
197
166
  # Delegate to build backend
198
- BuildBackendFactory.create(self.model).uninstall_wheels(wheel_names=sorted(list(wheel_names)))
199
- eb.print_updates(old_packages, ignored_packages=set([_python_package(self.model)]))
200
-
201
-
202
- class EditableBuilder(NmkTaskBuilder):
203
- """
204
- Install python project in editable mode
205
- """
206
-
207
- def build(self, pip_args: list[str] | None = None): # pyright: ignore[reportIncompatibleMethodOverride]
208
- """
209
- Install project in venv as editable package
210
-
211
- :param pip_args: pip command line arguments; deprecated, not used anymore
212
- """
213
-
214
- # Check if project can be installed in editable mode
215
- package_name = _python_package(self.model)
216
- if _can_install(package_name, self.logger):
217
- # Delegate to build backend
218
- eb = cast(EnvBackend, self.model.env_backend) # type: ignore
219
- old_packages = eb.installed_packages
220
- BuildBackendFactory.create(self.model).install_editable()
221
- eb.print_updates(old_packages, ignored_packages=set([package_name]))
222
-
223
- # Touch stamp file
224
- self.main_output.touch()
167
+ BuildBackendFactory.create(self.model).uninstall_wheels()
225
168
 
226
169
 
227
170
  class PythonOptionalDepsResolver(NmkListConfigResolver):
@@ -381,22 +324,6 @@ class DepsMetadataBuilder(NmkTaskBuilder):
381
324
  assert (errors == 0) or not fail_on_error, f"{errors} error(s) found while checking dependencies vs constraints"
382
325
 
383
326
 
384
- class PythonIgnoredLockfileResolver(NmkListConfigResolver):
385
- """
386
- Python ignored lockfile resolver
387
- """
388
-
389
- def get_value(self, name: str) -> list[str]: # pyright: ignore[reportIncompatibleMethodOverride]
390
- """
391
- Return the list of lockfiles to be ignored, depending on the env backend and if the project is locked or not
392
- """
393
-
394
- # Ignore uv.lock file if using uv env backend and project is not locked
395
- if not self.model.env_backend.is_locked and self.model.env_backend.name == "uv":
396
- return ["uv.lock"]
397
- return [] # pragma: no cover
398
-
399
-
400
327
  class PythonMergedConstraintsResolver(NmkListConfigResolver):
401
328
  """
402
329
  Python merged constraints resolver
nmk_python/build.yml CHANGED
@@ -56,20 +56,12 @@ 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
- # Python ignored lockfile, depending on the env backend and if the project is locked or not
63
- pythonIgnoredLockfile:
64
- __resolver__: nmk_python.build.PythonIgnoredLockfileResolver
65
-
66
59
  # Python files to be ignored
67
60
  gitIgnoredFiles:
68
61
  - .eggs/
69
62
  - "*.egg-info/"
70
63
  - "*.pyc"
71
64
  - __pycache__
72
- - ${pythonIgnoredLockfile}
73
65
 
74
66
  # Additional github publish step: publish on pypi.org
75
67
  githubPublishSteps:
@@ -80,22 +72,6 @@ config:
80
72
  password: ${{ secrets.pypi_password }}
81
73
  packages_dir: ${r!pythonBuildDir}/wheel_dist
82
74
 
83
- # Wheel install arguments (for pip backend)
84
- pythonWheelPipInstallArgs:
85
- - --force-reinstall # force reinstall because otherwise install will be skipped if version didn't changed
86
- - --no-deps # but skip dependencies to avoid reinstalling everything (deps are already installed by py.venv task)
87
-
88
- # Editable install arguments (for pip backend)
89
- pythonEditablePipInstallArgs:
90
- - --no-deps # skip dependencies to avoid reinstalling everything
91
- - --no-build-isolation # disable dependencies install when building for "editable" mode
92
-
93
- # Wheel install arguments (for uv backend)
94
- pythonWheelUvInstallArgs: []
95
-
96
- # Editable install arguments (for uv backend)
97
- pythonEditableUvInstallArgs: []
98
-
99
75
  # Type checking mode for Pyright; may be off, basic, standard, strict
100
76
  pythonTypeCheckingMode: strict
101
77
 
@@ -125,28 +101,12 @@ config:
125
101
  pythonConstraintsStrictCheck: false
126
102
 
127
103
  tasks:
128
- # Python editable install
129
- py.editable:
130
- description: Install python editable package
131
- emoji: ":snake:.:house:"
132
- deps:
133
- - py.project
134
- - py.format
135
- - py.analyze
136
- appendToDeps: build.compile
137
- if: ${pythonSrcFiles} # Only if python source files are found
138
- output:
139
- - ${pythonEditableStamp}
140
- input:
141
- - ${pythonProjectFile}
142
- builder: nmk_python.build.EditableBuilder
143
-
144
104
  # Python dependencies metadata
145
105
  py.deps:
146
106
  description: Gather python dependencies metadata
147
107
  emoji: ":snake:.:link:"
148
108
  deps:
149
- - py.editable
109
+ - py.project
150
110
  appendToDeps: build.compile
151
111
  if: ${pythonSrcFiles} # Only if python source files are found
152
112
  output:
@@ -200,17 +160,12 @@ tasks:
200
160
  params:
201
161
  name: ${pythonPackage}
202
162
  wheel: ${pythonWheel}
203
- to_remove: ${pythonEditableStamp}
204
163
 
205
164
  # Python module clean
206
165
  py.uninstall:
207
- description: Uninstall python package and local dependencies
166
+ description: Uninstall python wheel
208
167
  emoji: ":broom:.:snake:"
209
168
  appendToDeps:
210
169
  - clean
211
170
  builder: nmk_python.build.Uninstaller
212
- params:
213
- name: ${pythonPackage}
214
- local_deps: ${pythonLocalDepsPatterns}
215
- lock_files: ${pythonIgnoredLockfile}
216
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}
nmk_python/version.yml CHANGED
@@ -17,8 +17,8 @@ config:
17
17
  pythonVersionStamp: ${outputDir}/.pythonversion
18
18
 
19
19
  # Python supported versions range (min-max)
20
- pythonMinVersion: "3.10"
21
- pythonMaxVersion: "3.14"
20
+ pythonMinVersion: "3.11"
21
+ pythonMaxVersion: "3.15"
22
22
  pythonSupportedVersions:
23
23
  __resolver__: nmk_python.version.PythonSupportedVersionsResolver
24
24
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nmk-python
3
- Version: 1.13.1
3
+ Version: 2.0.1
4
4
  Summary: Python plugin for nmk build system
5
5
  Author: The dynod project
6
6
  Maintainer: The dynod project
@@ -8,12 +8,12 @@ License: MIT License
8
8
  Project-URL: Homepage, https://github.com/dynod/nmk-python
9
9
  Project-URL: Repository, https://github.com/dynod/nmk-python
10
10
  Project-URL: Issues, https://github.com/dynod/nmk/issues?q=is%3Aopen+is%3Aissue+label%3Aplugin%3Apython
11
- Classifier: Programming Language :: Python :: 3.10
12
11
  Classifier: Programming Language :: Python :: 3.11
13
12
  Classifier: Programming Language :: Python :: 3.12
14
13
  Classifier: Programming Language :: Python :: 3.13
15
14
  Classifier: Programming Language :: Python :: 3.14
16
- Requires-Python: >=3.10
15
+ Classifier: Programming Language :: Python :: 3.15
16
+ Requires-Python: >=3.11
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: nmk-base>=1.5.0
@@ -37,7 +37,7 @@ Python plugin for nmk build system
37
37
  [![License: MIT License](https://img.shields.io/github/license/dynod/nmk-python)](https://github.com/dynod/nmk-python/blob/main/LICENSE)
38
38
  [![Checks](https://img.shields.io/github/actions/workflow/status/dynod/nmk-python/build.yml?branch=main&label=build%20%26%20u.t.)](https://github.com/dynod/nmk-python/actions?query=branch%3Amain)
39
39
  [![Issues](https://img.shields.io/github/issues-search/dynod/nmk?label=issues&query=is%3Aopen+is%3Aissue+label%3Aplugin%3Apython)](https://github.com/dynod/nmk/issues?q=is%3Aopen+is%3Aissue+label%3Aplugin%3Apython)
40
- [![Supported python versions](https://img.shields.io/badge/python-3.10%20--%203.14-blue)](https://www.python.org/)
40
+ [![Supported python versions](https://img.shields.io/badge/python-3.11%20--%203.15-blue)](https://www.python.org/)
41
41
  [![PyPI](https://img.shields.io/pypi/v/nmk-python)](https://pypi.org/project/nmk-python/)
42
42
  [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://astral.sh/ruff)
43
43
  [![Code coverage](https://img.shields.io/codecov/c/github/dynod/nmk-python)](https://app.codecov.io/gh/dynod/nmk-python)
@@ -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=5acJJ1EQGEqvcOhBqA2qtTzGaZBviAliEEvjIj8ybu8,17675
4
- nmk_python/build.yml,sha256=dbgGj__RgLqthFeG4csPJGvsnK2H96crz-zLQL4xH-Q,6570
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,16 +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
- nmk_python/version.yml,sha256=D_rUnEzjEtCmCgUhfaDPSsANaRkcDW7aZgPX6GZOUIk,1159
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
20
- nmk_python/backends/factory.py,sha256=NMYByORffwSSIjeNMLkOnwh6x1xhJQVhoV-0rSooq6Q,953
21
- nmk_python/backends/pip_build_backend.py,sha256=4MGYghBeMjZhUlKTwE0svSHArYwOAaK1I6_gmeNnwaI,1698
22
- nmk_python/backends/uv_build_backend.py,sha256=gpM1L5FuJ5CF-OkRORnAbZHACPNhjkoO1sKZtdAhpf0,1671
19
+ nmk_python/backends/build_backend.py,sha256=F3ky1CoMjSWfcFiPVRvfJmsv34MwpTbk5pBFhIMaqX0,1179
20
+ nmk_python/backends/factory.py,sha256=hlR-CTE4wAoYBO1t2DQe_ISXv8rSMft8kKQSjeAKr5M,855
21
+ nmk_python/backends/uv_build_backend.py,sha256=hIgWOmNFYxyCwL9reYT9lhNdJNUOkC1vqwXYUJCF2co,1090
23
22
  nmk_python/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
23
  nmk_python/templates/build.toml.jinja,sha256=D-RYPUGiqkYUKyQt_dP_tNFU-83eer7bnv57k4pMmIw,2137
25
24
  nmk_python/templates/pytest.toml.jinja,sha256=zQ3SRWnF23Omxm7zInE54j0l3OyjXSOn5pQ5Pak8Boo,641
@@ -30,9 +29,9 @@ nmk_python/templates/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
30
29
  nmk_python/templates/src/__init__.py.jinja,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
30
  nmk_python/templates/src/sample.py.jinja,sha256=OOTps7EjviwYFCIb5GpMHcidxhBY5NLQVlcFLqxuxNU,227
32
31
  nmk_python/templates/src/test_sample.py.jinja,sha256=u-ShBoKDF3se9KvgQ1SzO4NwymjqNowwURF4Q1oR3wo,221
33
- nmk_python-1.13.1.dist-info/licenses/LICENSE,sha256=PROo9EW7wP6jmSr_90OluItAsIB411b_CAqEBioMKpI,1074
34
- nmk_python-1.13.1.dist-info/METADATA,sha256=4JPeVTQHJL9YkUHN2-ahTehj3Vf6_TN4zpdOKuvrSTM,3205
35
- nmk_python-1.13.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
36
- nmk_python-1.13.1.dist-info/entry_points.txt,sha256=QLXIIXl6wODHDnVkh7KuiLv_XzfFtNfdWwpxyB675ak,88
37
- nmk_python-1.13.1.dist-info/top_level.txt,sha256=MCb5w_hoOZ0kk3Dajxrd9Pz6lZ3pyuS6TQCRA3vddTo,11
38
- nmk_python-1.13.1.dist-info/RECORD,,
32
+ nmk_python-2.0.1.dist-info/licenses/LICENSE,sha256=PROo9EW7wP6jmSr_90OluItAsIB411b_CAqEBioMKpI,1074
33
+ nmk_python-2.0.1.dist-info/METADATA,sha256=8wsWramdmQTAesrKFJHvtc8ysQNnQKD2ETp8xZZpXWU,3204
34
+ nmk_python-2.0.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
35
+ nmk_python-2.0.1.dist-info/entry_points.txt,sha256=QLXIIXl6wODHDnVkh7KuiLv_XzfFtNfdWwpxyB675ak,88
36
+ nmk_python-2.0.1.dist-info/top_level.txt,sha256=MCb5w_hoOZ0kk3Dajxrd9Pz6lZ3pyuS6TQCRA3vddTo,11
37
+ nmk_python-2.0.1.dist-info/RECORD,,
@@ -1,53 +0,0 @@
1
- """
2
- Pip build backend module.
3
- """
4
-
5
- import sys
6
- from pathlib import Path
7
- from typing import cast
8
-
9
- from nmk.utils import run_with_logs
10
-
11
- from .build_backend import PythonBuildBackend
12
-
13
-
14
- class PipBuildBackend(PythonBuildBackend):
15
- """
16
- Pip build backend implementation
17
-
18
- :param model: NmkModel instance
19
- """
20
-
21
- def install_editable(self):
22
- # Prepare install args
23
- install_args = ["install", "-e", "."]
24
-
25
- # Add extra args from model config
26
- install_args += cast(list[str], self._model.config["pythonEditablePipInstallArgs"].value)
27
-
28
- # Delegate to subprocess
29
- self._env_backend.subprocess(install_args, cwd=self._env_backend.project_path)
30
-
31
- def install_wheel(self, wheel_path: Path):
32
- # Prepare install args
33
- install_args = ["install", str(wheel_path)]
34
-
35
- # Add extra args from model config
36
- install_args += cast(list[str], self._model.config["pythonWheelPipInstallArgs"].value)
37
-
38
- # Delegate to subprocess
39
- self._env_backend.subprocess(install_args, cwd=self._env_backend.project_path)
40
-
41
- def build_wheel(self, build_dir: Path, built_wheel_name: str, wheel_version: str) -> Path:
42
- # Delegate to build module
43
- run_with_logs([sys.executable, "-m", "build", "--wheel", "--skip-dependency-check", "--no-isolation"], cwd=build_dir)
44
-
45
- # Return built wheel path
46
- return build_dir / "dist" / built_wheel_name
47
-
48
- def uninstall_wheels(self, wheel_names: list[str]):
49
- # Prepare uninstall args
50
- uninstall_args = ["uninstall", "--yes"] + wheel_names
51
-
52
- # Delegate to subprocess
53
- self._env_backend.subprocess(uninstall_args, cwd=self._env_backend.project_path)