nmk-python 1.0.0__py3-none-any.whl → 1.2.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 +4 -4
- nmk_python/build.yml +14 -4
- nmk_python/ruff.py +18 -1
- nmk_python/ruff.yml +36 -3
- {nmk_python-1.0.0.dist-info → nmk_python-1.2.0.dist-info}/METADATA +3 -3
- {nmk_python-1.0.0.dist-info → nmk_python-1.2.0.dist-info}/RECORD +9 -9
- {nmk_python-1.0.0.dist-info → nmk_python-1.2.0.dist-info}/WHEEL +1 -1
- {nmk_python-1.0.0.dist-info → nmk_python-1.2.0.dist-info}/LICENSE +0 -0
- {nmk_python-1.0.0.dist-info → nmk_python-1.2.0.dist-info}/top_level.txt +0 -0
nmk_python/build.py
CHANGED
|
@@ -121,7 +121,7 @@ class Installer(VenvUpdateBuilder):
|
|
|
121
121
|
Install built wheel in venv
|
|
122
122
|
"""
|
|
123
123
|
|
|
124
|
-
def build(self, name: str, pip_args: str, to_remove: str):
|
|
124
|
+
def build(self, name: str, pip_args: list[str], to_remove: str):
|
|
125
125
|
"""
|
|
126
126
|
Install wheel in venv
|
|
127
127
|
|
|
@@ -133,7 +133,7 @@ class Installer(VenvUpdateBuilder):
|
|
|
133
133
|
# Check if wheel can be installed
|
|
134
134
|
if _can_install(name, self.logger):
|
|
135
135
|
# Install wheel in current venv
|
|
136
|
-
super().build(pip_args)
|
|
136
|
+
super().build(" ".join(pip_args))
|
|
137
137
|
|
|
138
138
|
# Remove stamp file
|
|
139
139
|
Path(to_remove).unlink(missing_ok=True)
|
|
@@ -162,7 +162,7 @@ class EditableBuilder(NmkTaskBuilder):
|
|
|
162
162
|
Install python project in editable mode
|
|
163
163
|
"""
|
|
164
164
|
|
|
165
|
-
def build(self, pip_args: str):
|
|
165
|
+
def build(self, pip_args: list[str]):
|
|
166
166
|
"""
|
|
167
167
|
Install project in venv as editable package
|
|
168
168
|
|
|
@@ -172,7 +172,7 @@ class EditableBuilder(NmkTaskBuilder):
|
|
|
172
172
|
# Check if project can be installed in editable mode
|
|
173
173
|
if _can_install(self.model.config["pythonPackage"].value, self.logger):
|
|
174
174
|
# Delegate to pip
|
|
175
|
-
run_pip(["install", "-e", "."], logger=self.logger, extra_args=pip_args)
|
|
175
|
+
run_pip(["install", "-e", "."], logger=self.logger, extra_args=" ".join(pip_args))
|
|
176
176
|
|
|
177
177
|
# Touch stamp file
|
|
178
178
|
self.main_output.touch()
|
nmk_python/build.yml
CHANGED
|
@@ -48,6 +48,16 @@ config:
|
|
|
48
48
|
password: ${{ secrets.pypi_password }}
|
|
49
49
|
packages_dir: ${r!pythonArtifacts}
|
|
50
50
|
|
|
51
|
+
# Wheel install arguments
|
|
52
|
+
pythonWheelInstallArgs:
|
|
53
|
+
- --force-reinstall # force reinstall because otherwise install will be skipped if version didn't changed
|
|
54
|
+
- --no-deps # but skip dependencies to avoid reinstalling everything (deps are already installed by py.venv task)
|
|
55
|
+
|
|
56
|
+
# Editable install arguments
|
|
57
|
+
pythonEditableInstallArgs:
|
|
58
|
+
- --no-deps # skip dependencies to avoid reinstalling everything
|
|
59
|
+
- --no-build-isolation # disable dependencies install when building for "editable" mode
|
|
60
|
+
|
|
51
61
|
tasks:
|
|
52
62
|
|
|
53
63
|
# Python editable install
|
|
@@ -66,7 +76,8 @@ tasks:
|
|
|
66
76
|
- ${pythonProjectFile}
|
|
67
77
|
builder: nmk_python.build.EditableBuilder
|
|
68
78
|
params:
|
|
69
|
-
pip_args:
|
|
79
|
+
pip_args:
|
|
80
|
+
- ${pythonEditableInstallArgs}
|
|
70
81
|
|
|
71
82
|
# Python wheel build
|
|
72
83
|
py.build:
|
|
@@ -107,9 +118,8 @@ tasks:
|
|
|
107
118
|
builder: nmk_python.build.Installer
|
|
108
119
|
params:
|
|
109
120
|
name: ${pythonPackage}
|
|
110
|
-
pip_args:
|
|
111
|
-
|
|
112
|
-
# - but skip dependencies to avoid reinstalling everything (deps are already installed by py.venv task)
|
|
121
|
+
pip_args:
|
|
122
|
+
- ${pythonWheelInstallArgs}
|
|
113
123
|
to_remove: ${pythonEditableStamp}
|
|
114
124
|
|
|
115
125
|
# Python module clean
|
nmk_python/ruff.py
CHANGED
|
@@ -7,6 +7,7 @@ from pathlib import Path
|
|
|
7
7
|
|
|
8
8
|
from nmk.model.builder import NmkTaskBuilder
|
|
9
9
|
from nmk.model.keys import NmkRootConfig
|
|
10
|
+
from nmk.model.resolver import NmkStrConfigResolver
|
|
10
11
|
from nmk.utils import run_with_logs
|
|
11
12
|
|
|
12
13
|
|
|
@@ -35,7 +36,23 @@ class RuffBuilder(NmkTaskBuilder):
|
|
|
35
36
|
relative_src_folders.append(p)
|
|
36
37
|
|
|
37
38
|
# Delegate to ruff
|
|
38
|
-
run_with_logs(["ruff"
|
|
39
|
+
run_with_logs(["ruff"] + [arg for arg in command.split(" ") if arg] + relative_src_folders, self.logger, cwd=project_folder)
|
|
39
40
|
|
|
40
41
|
# Touch output file
|
|
41
42
|
self.main_output.touch()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class JoinedRulesResolver(NmkStrConfigResolver):
|
|
46
|
+
"""
|
|
47
|
+
Join auto-fix rules as a comma separated string
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def get_value(self, name: str, rules: list[str]) -> str:
|
|
51
|
+
"""
|
|
52
|
+
Return coma separated rules list string
|
|
53
|
+
|
|
54
|
+
:param name: name of the config
|
|
55
|
+
:param rules: list of rules
|
|
56
|
+
:return: coma separated rules list string
|
|
57
|
+
"""
|
|
58
|
+
return ",".join(rules)
|
nmk_python/ruff.yml
CHANGED
|
@@ -9,8 +9,23 @@ config:
|
|
|
9
9
|
|
|
10
10
|
# Stamp files for ruff execution
|
|
11
11
|
pythonRuffFormatStamp: ${outputDir}/.ruff-format
|
|
12
|
+
pythonRuffFixStamp: ${outputDir}/.ruff-fix
|
|
12
13
|
pythonRuffCheckStamp: ${outputDir}/.ruff-check
|
|
13
14
|
|
|
15
|
+
# Extra arguments for ruff command lines
|
|
16
|
+
pythonRuffCommonExtraArgs: ""
|
|
17
|
+
pythonRuffFormatExtraArgs: ""
|
|
18
|
+
pythonRuffFixExtraArgs: ""
|
|
19
|
+
pythonRuffCheckExtraArgs: ""
|
|
20
|
+
|
|
21
|
+
# Auto-fix rules
|
|
22
|
+
pythonAutoFixRules: ["I"] # Default: only fix imports
|
|
23
|
+
pythonAutoFixJoinedRules:
|
|
24
|
+
__resolver__: nmk_python.ruff.JoinedRulesResolver
|
|
25
|
+
params:
|
|
26
|
+
rules:
|
|
27
|
+
- ${pythonAutoFixRules}
|
|
28
|
+
|
|
14
29
|
# Ignored rules
|
|
15
30
|
pythonIgnoredRules:
|
|
16
31
|
- E203 # space before ":"; sometimes formatting with black introduces this kind of space in slice expressions
|
|
@@ -39,14 +54,32 @@ tasks:
|
|
|
39
54
|
builder: nmk_python.ruff.RuffBuilder
|
|
40
55
|
params:
|
|
41
56
|
src_folders: ${pythonSrcFolders}
|
|
42
|
-
command: format
|
|
57
|
+
command: format ${pythonRuffCommonExtraArgs} ${pythonRuffFormatExtraArgs}
|
|
58
|
+
|
|
59
|
+
# Python source code fix with ruff
|
|
60
|
+
py.fix:
|
|
61
|
+
description: Fix python code
|
|
62
|
+
emoji: ":snake:.:wrench:"
|
|
63
|
+
deps:
|
|
64
|
+
- py.format
|
|
65
|
+
appendToDeps: build
|
|
66
|
+
if: ${pythonSrcFiles} # Only if python source files are found
|
|
67
|
+
output:
|
|
68
|
+
- ${pythonRuffFixStamp}
|
|
69
|
+
input:
|
|
70
|
+
- ${pythonProjectFile}
|
|
71
|
+
- ${pythonSrcFiles}
|
|
72
|
+
builder: nmk_python.ruff.RuffBuilder
|
|
73
|
+
params:
|
|
74
|
+
src_folders: ${pythonSrcFolders}
|
|
75
|
+
command: check --fix-only --select ${pythonAutoFixJoinedRules} ${pythonRuffCommonExtraArgs} ${pythonRuffFixExtraArgs}
|
|
43
76
|
|
|
44
77
|
# Python source code analysis with ruff
|
|
45
78
|
py.analyze:
|
|
46
79
|
description: Analyze python code
|
|
47
80
|
emoji: ":snake:.:eye: "
|
|
48
81
|
deps:
|
|
49
|
-
- py.
|
|
82
|
+
- py.fix
|
|
50
83
|
appendToDeps: build
|
|
51
84
|
if: ${pythonSrcFiles} # Only if python source files are found
|
|
52
85
|
output:
|
|
@@ -57,4 +90,4 @@ tasks:
|
|
|
57
90
|
builder: nmk_python.ruff.RuffBuilder
|
|
58
91
|
params:
|
|
59
92
|
src_folders: ${pythonSrcFolders}
|
|
60
|
-
command: check
|
|
93
|
+
command: check ${pythonRuffCommonExtraArgs} ${pythonRuffCheckExtraArgs}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: nmk-python
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: Python plugin for nmk build system
|
|
5
5
|
Author: The dynod project
|
|
6
6
|
Maintainer: The dynod project
|
|
@@ -43,7 +43,7 @@ Python plugin for nmk build system
|
|
|
43
43
|
|
|
44
44
|
This plugin adds support for Python development in an **`nmk`** project:
|
|
45
45
|
* project file generation
|
|
46
|
-
* code format and analysis with [ruff](https://astral.sh/ruff)
|
|
46
|
+
* code format, fix and analysis with [ruff](https://astral.sh/ruff)
|
|
47
47
|
* python wheel build
|
|
48
48
|
* test with [pytest](https://pytest.org)
|
|
49
49
|
* VSCode settings generation (if [**`nmk-vscode`**](https://github.com/dynod/nmk-vscode) plugin is also used)
|
|
@@ -1,14 +1,14 @@
|
|
|
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=rN7CvAUPU-gGsg17cBojdqGBSbW-GAEFItz234rqM1E,6307
|
|
4
|
+
nmk_python/build.yml,sha256=Yn4zVuNNo1fnAsvlI_ul_kmEpLp_5WHK4pA0T9kkQ3I,4297
|
|
5
5
|
nmk_python/doc.yml,sha256=12amAlYylH7JAHaqBIOoEZ_LrXY_bPNKuHrrwUkIj8w,932
|
|
6
6
|
nmk_python/files.py,sha256=gtPf6ldR5F4oGsAdzFnEIbI9MqqvF3z5JQnyONZmLmk,1863
|
|
7
7
|
nmk_python/files.yml,sha256=-vGjogdulwsfdKVEUa5RARYDKxF3m9RmHKFnIhaT3_k,780
|
|
8
8
|
nmk_python/plugin.yml,sha256=hi7osXyIwpHgJAsww5mhOA6emxhzgitDF8cOsvyY29Y,1068
|
|
9
9
|
nmk_python/project.yml,sha256=sRIMvKkasrYlIvOo3DsVyNM_sgID_sHVgZg_bSIqtfw,975
|
|
10
|
-
nmk_python/ruff.py,sha256=
|
|
11
|
-
nmk_python/ruff.yml,sha256=
|
|
10
|
+
nmk_python/ruff.py,sha256=TBmn5nFflcFRvjj36JtJGJ-GYHOK6XfhK9Jp-2dO5_E,1557
|
|
11
|
+
nmk_python/ruff.yml,sha256=FNmYjbv2l5vlqFXinY87LfgzpZ3PSiduB_xUiYw8aMw,3019
|
|
12
12
|
nmk_python/tests.py,sha256=8kRKP3dT2Thi5W5sCQSQOPXkV1D9C7tde3QYySo6G2c,1212
|
|
13
13
|
nmk_python/tests.yml,sha256=wQusYK1bxSl87zWFQy5lJcrkcAz4pMEZT9Vt6o2K5Vs,1538
|
|
14
14
|
nmk_python/version.py,sha256=fLpOWdujYwlJB7XhWaOGCTeg3gQaClk2YHoRkkW64dE,3109
|
|
@@ -19,8 +19,8 @@ nmk_python/templates/pytest.toml.jinja,sha256=zQ3SRWnF23Omxm7zInE54j0l3OyjXSOn5p
|
|
|
19
19
|
nmk_python/templates/python-settings.json.jinja,sha256=-6J1tybWEzChxlDqu4tp9BMWxbYD8HpztGs9G8LkC_w,877
|
|
20
20
|
nmk_python/templates/python-test-debug-launch.json.jinja,sha256=J_xju2EpHNXvgvqBxlf99p7g-ZMh3xE-_2r7o_57gpU,364
|
|
21
21
|
nmk_python/templates/ruff.toml.jinja,sha256=DTHe1ixK1SBY8d2xBCfkGz89HzjAoMO7Ogs12AY1i4Y,346
|
|
22
|
-
nmk_python-1.
|
|
23
|
-
nmk_python-1.
|
|
24
|
-
nmk_python-1.
|
|
25
|
-
nmk_python-1.
|
|
26
|
-
nmk_python-1.
|
|
22
|
+
nmk_python-1.2.0.dist-info/LICENSE,sha256=PROo9EW7wP6jmSr_90OluItAsIB411b_CAqEBioMKpI,1074
|
|
23
|
+
nmk_python-1.2.0.dist-info/METADATA,sha256=jg5UEZbY9-uyEvCIH1PF3x2sqmFkPAxR5DsUejU5epQ,3123
|
|
24
|
+
nmk_python-1.2.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
25
|
+
nmk_python-1.2.0.dist-info/top_level.txt,sha256=MCb5w_hoOZ0kk3Dajxrd9Pz6lZ3pyuS6TQCRA3vddTo,11
|
|
26
|
+
nmk_python-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|