@mnci/nx-python-pip 0.1.3 → 0.1.4
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.
- package/README.md +10 -6
- package/dist/executors/build/executor.d.ts.map +1 -1
- package/dist/executors/build/executor.js +3 -2
- package/dist/executors/build/executor.js.map +1 -1
- package/dist/executors/lint/executor.d.ts +5 -4
- package/dist/executors/lint/executor.d.ts.map +1 -1
- package/dist/executors/lint/executor.js +7 -5
- package/dist/executors/lint/executor.js.map +1 -1
- package/dist/executors/publish/executor.d.ts.map +1 -1
- package/dist/executors/publish/executor.js +3 -2
- package/dist/executors/publish/executor.js.map +1 -1
- package/dist/executors/test/executor.d.ts.map +1 -1
- package/dist/executors/test/executor.js +3 -2
- package/dist/executors/test/executor.js.map +1 -1
- package/dist/internal/pythonCommand.d.ts +21 -0
- package/dist/internal/pythonCommand.d.ts.map +1 -0
- package/dist/internal/pythonCommand.js +26 -0
- package/dist/internal/pythonCommand.js.map +1 -0
- package/dist/release/versionActions.d.ts.map +1 -1
- package/dist/release/versionActions.js +2 -1
- package/dist/release/versionActions.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,10 +26,10 @@ are explicit (resolved via `generators.json`/`executors.json`, plain Node
|
|
|
26
26
|
module lookup), not inference-based.
|
|
27
27
|
|
|
28
28
|
You will also need the actual Python tools this plugin's executors shell out
|
|
29
|
-
to: `python3 -m pip install build twine ruff pytest` (
|
|
30
|
-
`requirements-dev.txt` /
|
|
31
|
-
*how* those land on a
|
|
32
|
-
is already there.
|
|
29
|
+
to: `python3 -m pip install build twine ruff pytest` (`python -m pip ...` on
|
|
30
|
+
Windows — see below) — or pin them in your own `requirements-dev.txt` /
|
|
31
|
+
`requirements-dev.in`. The plugin has no opinion on *how* those land on a
|
|
32
|
+
machine — same way `@nx/js`'s executors assume `node` is already there.
|
|
33
33
|
|
|
34
34
|
## Generators
|
|
35
35
|
|
|
@@ -56,9 +56,13 @@ nx g @mnci/nx-python-pip:function-application my-function-app
|
|
|
56
56
|
| `lint` | `python -m ruff check .` |
|
|
57
57
|
| `publish` | `python -m twine upload --skip-existing dist/*`, reading `TWINE_USERNAME`/`TWINE_PASSWORD`/`TWINE_REPOSITORY_URL` from the environment |
|
|
58
58
|
|
|
59
|
-
Every command is invoked as
|
|
59
|
+
Every command is invoked as `<python> -m <tool>`, never a hard-coded venv
|
|
60
60
|
path, so the exact same command works whether or not you've activated a
|
|
61
|
-
virtualenv — this plugin never creates or manages one itself.
|
|
61
|
+
virtualenv — this plugin never creates or manages one itself. `<python>` is
|
|
62
|
+
resolved per platform (`pythonCommand` in `src/internal/pythonCommand.ts`):
|
|
63
|
+
`python3` on POSIX, `python` on Windows, since the standard python.org
|
|
64
|
+
Windows installer registers only `python.exe` — a hard-coded `python3` fails
|
|
65
|
+
outright there.
|
|
62
66
|
|
|
63
67
|
`publish` accepts a real, typed `dryRun` option — `nx release publish
|
|
64
68
|
--dry-run` sets it automatically on every `nx-release-publish` executor, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/build/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/build/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AASjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAoBrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAA8B,aAAa,CAAE,QAAQ,EAAE,mBAAmB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAqCnI"}
|
|
@@ -6,6 +6,7 @@ const node_fs_1 = require("node:fs");
|
|
|
6
6
|
const node_os_1 = require("node:os");
|
|
7
7
|
const node_path_1 = require("node:path");
|
|
8
8
|
const executorContext_1 = require("../../internal/executorContext");
|
|
9
|
+
const pythonCommand_1 = require("../../internal/pythonCommand");
|
|
9
10
|
const pythonProject_1 = require("../../internal/pythonProject");
|
|
10
11
|
const vendor_1 = require("../../internal/vendor");
|
|
11
12
|
/**
|
|
@@ -52,7 +53,7 @@ async function buildExecutor(_options, context) {
|
|
|
52
53
|
const pyprojectToml = (0, node_fs_1.readFileSync)(pyprojectPath, 'utf8');
|
|
53
54
|
const vendorNames = (0, vendor_1.parseVendorEntries)(pyprojectToml);
|
|
54
55
|
if (vendorNames.length === 0) {
|
|
55
|
-
const result = (0, node_child_process_1.spawnSync)(
|
|
56
|
+
const result = (0, node_child_process_1.spawnSync)((0, pythonCommand_1.pythonCommand)(), ['-m', 'build', '--outdir', outDirectory, absoluteProjectRoot], { stdio: 'inherit' });
|
|
56
57
|
return { success: result.status === 0 };
|
|
57
58
|
}
|
|
58
59
|
const stagingRoot = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'nx-python-pip-build-'));
|
|
@@ -71,7 +72,7 @@ async function buildExecutor(_options, context) {
|
|
|
71
72
|
}
|
|
72
73
|
const stagedPyprojectPath = (0, node_path_1.join)(stagingRoot, 'pyproject.toml');
|
|
73
74
|
(0, node_fs_1.writeFileSync)(stagedPyprojectPath, (0, vendor_1.addPackagesToWheelTarget)((0, node_fs_1.readFileSync)(stagedPyprojectPath, 'utf8'), moduleDirectories));
|
|
74
|
-
const result = (0, node_child_process_1.spawnSync)(
|
|
75
|
+
const result = (0, node_child_process_1.spawnSync)((0, pythonCommand_1.pythonCommand)(), ['-m', 'build', '--outdir', outDirectory, stagingRoot], { stdio: 'inherit' });
|
|
75
76
|
return { success: result.status === 0 };
|
|
76
77
|
}
|
|
77
78
|
finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executors/build/executor.ts"],"names":[],"mappings":";;;AACA,2DAA8C;AAC9C,qCAAkF;AAClF,qCAAgC;AAChC,yCAAgC;AAChC,oEAAgE;AAChE,gEAAoE;AACpE,kDAAoF;AAGpF;;;;;;;;;;;;;GAaG;AACH,SAAS,mBAAmB,CAAE,IAAY,EAAE,OAAwB;IAClE,OAAO,OAAO,CAAC,sBAAsB,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;AAC7D,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACY,KAAK,wBAAyB,QAA6B,EAAE,OAAwB;IAClG,MAAM,WAAW,GAAG,IAAA,iCAAe,EAAC,OAAO,CAAC,CAAA;IAC5C,MAAM,mBAAmB,GAAG,IAAA,gBAAI,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;IAC3D,MAAM,YAAY,GAAG,IAAA,gBAAI,EAAC,mBAAmB,EAAE,MAAM,CAAC,CAAA;IACtD,MAAM,aAAa,GAAG,IAAA,gBAAI,EAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAA;IACjE,MAAM,aAAa,GAAG,IAAA,sBAAY,EAAC,aAAa,EAAE,MAAM,CAAC,CAAA;IACzD,MAAM,WAAW,GAAG,IAAA,2BAAkB,EAAC,aAAa,CAAC,CAAA;IAErD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAA,8BAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executors/build/executor.ts"],"names":[],"mappings":";;;AACA,2DAA8C;AAC9C,qCAAkF;AAClF,qCAAgC;AAChC,yCAAgC;AAChC,oEAAgE;AAChE,gEAA4D;AAC5D,gEAAoE;AACpE,kDAAoF;AAGpF;;;;;;;;;;;;;GAaG;AACH,SAAS,mBAAmB,CAAE,IAAY,EAAE,OAAwB;IAClE,OAAO,OAAO,CAAC,sBAAsB,EAAE,QAAQ,CAAC,I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.d';
|
|
3
3
|
/**
|
|
4
|
-
* Runs
|
|
4
|
+
* Runs `<python> -m ruff check .` in the project's own directory.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `-m ruff` (not a bare `ruff`) so it resolves whatever Python the caller
|
|
8
|
+
* has active — no hard-coded venv path, matching every other executor in
|
|
9
|
+
* this package. The Python binary itself is resolved by {@link pythonCommand}
|
|
10
|
+
* (`python3` on POSIX, `python` on Windows), not hard-coded.
|
|
10
11
|
*
|
|
11
12
|
* @param _options - Unused (ruff needs no per-project configuration here).
|
|
12
13
|
* @param context - The Nx executor context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/lint/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/lint/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD;;;;;;;;;;;;;;GAcG;AACH,wBAA8B,YAAY,CAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAIjI"}
|
|
@@ -4,13 +4,15 @@ exports.default = lintExecutor;
|
|
|
4
4
|
const node_child_process_1 = require("node:child_process");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const executorContext_1 = require("../../internal/executorContext");
|
|
7
|
+
const pythonCommand_1 = require("../../internal/pythonCommand");
|
|
7
8
|
/**
|
|
8
|
-
* Runs
|
|
9
|
+
* Runs `<python> -m ruff check .` in the project's own directory.
|
|
9
10
|
*
|
|
10
11
|
* @remarks
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* `-m ruff` (not a bare `ruff`) so it resolves whatever Python the caller
|
|
13
|
+
* has active — no hard-coded venv path, matching every other executor in
|
|
14
|
+
* this package. The Python binary itself is resolved by {@link pythonCommand}
|
|
15
|
+
* (`python3` on POSIX, `python` on Windows), not hard-coded.
|
|
14
16
|
*
|
|
15
17
|
* @param _options - Unused (ruff needs no per-project configuration here).
|
|
16
18
|
* @param context - The Nx executor context.
|
|
@@ -20,7 +22,7 @@ const executorContext_1 = require("../../internal/executorContext");
|
|
|
20
22
|
*/
|
|
21
23
|
async function lintExecutor(_options, context) {
|
|
22
24
|
const cwd = (0, node_path_1.join)(context.root, (0, executorContext_1.projectRootFrom)(context));
|
|
23
|
-
const result = (0, node_child_process_1.spawnSync)(
|
|
25
|
+
const result = (0, node_child_process_1.spawnSync)((0, pythonCommand_1.pythonCommand)(), ['-m', 'ruff', 'check', '.'], { cwd, stdio: 'inherit' });
|
|
24
26
|
return { success: result.status === 0 };
|
|
25
27
|
}
|
|
26
28
|
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executors/lint/executor.ts"],"names":[],"mappings":";;;AACA,2DAA8C;AAC9C,yCAAgC;AAChC,oEAAgE;
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executors/lint/executor.ts"],"names":[],"mappings":";;;AACA,2DAA8C;AAC9C,yCAAgC;AAChC,oEAAgE;AAChE,gEAA4D;AAG5D;;;;;;;;;;;;;;GAcG;AACY,KAAK,uBAAwB,QAA4B,EAAE,OAAwB;IAChG,MAAM,GAAG,GAAG,IAAA,gBAAI,EAAC,OAAO,CAAC,IAAI,EAAE,IAAA,iCAAe,EAAC,OAAO,CAAC,CAAC,CAAA;IACxD,MAAM,MAAM,GAAG,IAAA,8BAAS,EAAC,IAAA,6BAAa,GAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;IAClG,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAA;AACzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/publish/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/publish/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEvD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAA8B,eAAe,CAAE,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAWtI"}
|
|
@@ -4,6 +4,7 @@ exports.default = publishExecutor;
|
|
|
4
4
|
const node_child_process_1 = require("node:child_process");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const executorContext_1 = require("../../internal/executorContext");
|
|
7
|
+
const pythonCommand_1 = require("../../internal/pythonCommand");
|
|
7
8
|
/**
|
|
8
9
|
* Runs `python -m twine upload --skip-existing dist/*`.
|
|
9
10
|
*
|
|
@@ -30,13 +31,13 @@ const executorContext_1 = require("../../internal/executorContext");
|
|
|
30
31
|
*/
|
|
31
32
|
async function publishExecutor(options, context) {
|
|
32
33
|
if (options.dryRun) {
|
|
33
|
-
console.log(
|
|
34
|
+
console.log(`[dry-run] would run: ${(0, pythonCommand_1.pythonCommand)()} -m twine upload --skip-existing dist/*`);
|
|
34
35
|
return { success: true };
|
|
35
36
|
}
|
|
36
37
|
const cwd = (0, node_path_1.join)(context.root, (0, executorContext_1.projectRootFrom)(context));
|
|
37
38
|
// No shell: true needed for the dist/* glob — twine globs its own path
|
|
38
39
|
// arguments internally, so this stays free of a shell-injection surface.
|
|
39
|
-
const result = (0, node_child_process_1.spawnSync)(
|
|
40
|
+
const result = (0, node_child_process_1.spawnSync)((0, pythonCommand_1.pythonCommand)(), ['-m', 'twine', 'upload', '--skip-existing', 'dist/*'], { cwd, stdio: 'inherit' });
|
|
40
41
|
return { success: result.status === 0 };
|
|
41
42
|
}
|
|
42
43
|
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executors/publish/executor.ts"],"names":[],"mappings":";;;AACA,2DAA8C;AAC9C,yCAAgC;AAChC,oEAAgE;
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executors/publish/executor.ts"],"names":[],"mappings":";;;AACA,2DAA8C;AAC9C,yCAAgC;AAChC,oEAAgE;AAChE,gEAA4D;AAG5D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACY,KAAK,0BAA2B,OAA8B,EAAE,OAAwB;IACrG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAA,6BAAa,GAAE,yCAAyC,CAAC,CAAA;QAC7F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IAC1B,CAAC;IAED,MAAM,GAAG,GAAG,IAAA,gBAAI,EAAC,OAAO,CAAC,IAAI,EAAE,IAAA,iCAAe,EAAC,OAAO,CAAC,CAAC,CAAA;IACxD,uEAAuE;IACvE,yEAAyE;IACzE,MAAM,MAAM,GAAG,IAAA,8BAAS,EAAC,IAAA,6BAAa,GAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;IAC5H,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAA;AACzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/test/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/test/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAA8B,YAAY,CAAE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAYhI"}
|
|
@@ -4,6 +4,7 @@ exports.default = testExecutor;
|
|
|
4
4
|
const node_child_process_1 = require("node:child_process");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const executorContext_1 = require("../../internal/executorContext");
|
|
7
|
+
const pythonCommand_1 = require("../../internal/pythonCommand");
|
|
7
8
|
/**
|
|
8
9
|
* Runs pytest for a Python project, optionally installing it in editable
|
|
9
10
|
* mode first so its own declared dependencies are importable.
|
|
@@ -27,12 +28,12 @@ const executorContext_1 = require("../../internal/executorContext");
|
|
|
27
28
|
async function testExecutor(options, context) {
|
|
28
29
|
const cwd = (0, node_path_1.join)(context.root, (0, executorContext_1.projectRootFrom)(context));
|
|
29
30
|
if (options.installEditable !== false) {
|
|
30
|
-
const install = (0, node_child_process_1.spawnSync)(
|
|
31
|
+
const install = (0, node_child_process_1.spawnSync)((0, pythonCommand_1.pythonCommand)(), ['-m', 'pip', 'install', '--quiet', '-e', '.'], { cwd, stdio: 'inherit' });
|
|
31
32
|
if (install.status !== 0) {
|
|
32
33
|
return { success: false };
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
const result = (0, node_child_process_1.spawnSync)(
|
|
36
|
+
const result = (0, node_child_process_1.spawnSync)((0, pythonCommand_1.pythonCommand)(), ['-m', 'pytest'], { cwd, stdio: 'inherit' });
|
|
36
37
|
return { success: result.status === 0 };
|
|
37
38
|
}
|
|
38
39
|
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executors/test/executor.ts"],"names":[],"mappings":";;;AACA,2DAA8C;AAC9C,yCAAgC;AAChC,oEAAgE;
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executors/test/executor.ts"],"names":[],"mappings":";;;AACA,2DAA8C;AAC9C,yCAAgC;AAChC,oEAAgE;AAChE,gEAA4D;AAG5D;;;;;;;;;;;;;;;;;;;GAmBG;AACY,KAAK,uBAAwB,OAA2B,EAAE,OAAwB;IAC/F,MAAM,GAAG,GAAG,IAAA,gBAAI,EAAC,OAAO,CAAC,IAAI,EAAE,IAAA,iCAAe,EAAC,OAAO,CAAC,CAAC,CAAA;IAExD,IAAI,OAAO,CAAC,eAAe,KAAK,KAAK,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,IAAA,8BAAS,EAAC,IAAA,6BAAa,GAAE,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;QACrH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;QAC3B,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,8BAAS,EAAC,IAAA,6BAAa,GAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;IACtF,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAA;AACzC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the Python executable name for the current platform.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Shared by every executor and {@link versionActions} in this package, so
|
|
6
|
+
* they all invoke the same binary a given machine actually has. POSIX
|
|
7
|
+
* systems (Linux/macOS — the assumed default) register `python3`; the
|
|
8
|
+
* standard python.org Windows installer registers only `python.exe`, not
|
|
9
|
+
* `python3.exe`, so a hard-coded `python3` fails outright there with
|
|
10
|
+
* "'python3' is not recognized as an internal or external command." This is
|
|
11
|
+
* a static, zero-cost platform check (`process.platform`), not a subprocess
|
|
12
|
+
* probe — every executor call site would otherwise need its own probing
|
|
13
|
+
* logic, or silently assume POSIX.
|
|
14
|
+
*
|
|
15
|
+
* @param None - this function takes no parameters.
|
|
16
|
+
* @returns `'python'` on `win32`, `'python3'` everywhere else.
|
|
17
|
+
* @throws Never - pure platform check.
|
|
18
|
+
* @typeParam None - this function has no generic type parameters.
|
|
19
|
+
*/
|
|
20
|
+
export declare function pythonCommand(): string;
|
|
21
|
+
//# sourceMappingURL=pythonCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pythonCommand.d.ts","sourceRoot":"","sources":["../../src/internal/pythonCommand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,IAAK,MAAM,CAEvC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pythonCommand = pythonCommand;
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the Python executable name for the current platform.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Shared by every executor and {@link versionActions} in this package, so
|
|
9
|
+
* they all invoke the same binary a given machine actually has. POSIX
|
|
10
|
+
* systems (Linux/macOS — the assumed default) register `python3`; the
|
|
11
|
+
* standard python.org Windows installer registers only `python.exe`, not
|
|
12
|
+
* `python3.exe`, so a hard-coded `python3` fails outright there with
|
|
13
|
+
* "'python3' is not recognized as an internal or external command." This is
|
|
14
|
+
* a static, zero-cost platform check (`process.platform`), not a subprocess
|
|
15
|
+
* probe — every executor call site would otherwise need its own probing
|
|
16
|
+
* logic, or silently assume POSIX.
|
|
17
|
+
*
|
|
18
|
+
* @param None - this function takes no parameters.
|
|
19
|
+
* @returns `'python'` on `win32`, `'python3'` everywhere else.
|
|
20
|
+
* @throws Never - pure platform check.
|
|
21
|
+
* @typeParam None - this function has no generic type parameters.
|
|
22
|
+
*/
|
|
23
|
+
function pythonCommand() {
|
|
24
|
+
return process.platform === 'win32' ? 'python' : 'python3';
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=pythonCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pythonCommand.js","sourceRoot":"","sources":["../../src/internal/pythonCommand.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH;IACE,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAA;AAC5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versionActions.d.ts","sourceRoot":"","sources":["../../src/release/versionActions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"versionActions.d.ts","sourceRoot":"","sources":["../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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const node_child_process_1 = require("node:child_process");
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
|
+
const pythonCommand_1 = require("../internal/pythonCommand");
|
|
5
6
|
// eslint-disable-next-line @typescript-eslint/no-require-imports -- nx/release is CJS; no ESM entry to `import` from.
|
|
6
7
|
const { VersionActions } = require('nx/release');
|
|
7
8
|
const VERSION_LINE = /^version\s*=\s*"([^"]+)"/m;
|
|
@@ -71,7 +72,7 @@ class PythonVersionActions extends VersionActions {
|
|
|
71
72
|
async readCurrentVersionFromRegistry(_tree, _currentVersionResolverMetadata) {
|
|
72
73
|
const name = this.projectGraphNode.name;
|
|
73
74
|
try {
|
|
74
|
-
const output = (0, node_child_process_1.execFileSync)(
|
|
75
|
+
const output = (0, node_child_process_1.execFileSync)((0, pythonCommand_1.pythonCommand)(), ['-m', 'pip', 'index', 'versions', name], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
|
|
75
76
|
const match = /Available versions:\s*([^\s,]+)/.exec(output);
|
|
76
77
|
return { currentVersion: match ? match[1] : null, logText: 'from pip index versions' };
|
|
77
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versionActions.js","sourceRoot":"","sources":["../../src/release/versionActions.ts"],"names":[],"mappings":";;AAAA,2DAAiD;AACjD,yCAAgC;AAEhC,sHAAsH;AACtH,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,YAAY,CAAgC,CAAA;AAE/E,MAAM,YAAY,GAAG,2BAA2B,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,0BAA0C,SAAQ,cAAc;IAAhE;;QACE,2BAAsB,GAAG,CAAC,gBAAgB,CAAC,CAAA;IAqH7C,CAAC;IAnHC;;;;;;;;OAQG;IACH,KAAK,CAAC,oCAAoC,CAAE,IAAU;QACpD,MAAM,YAAY,GAAG,IAAA,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,KAAK,CAAC,8BAA8B,CAClC,KAAW,EACX,aAA2B,EAC3B,sBAA8B;QAE9B,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAA;IAC7D,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,oBAAoB,CAAE,IAAU,EAAE,UAAkB;QACxD,MAAM,YAAY,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;QAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,CAAA;QACrD,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc,UAAU,GAAG,CAAC,CAAC,CAAA;QAC1F,OAAO,CAAC,WAAW,YAAY,eAAe,UAAU,EAAE,CAAC,CAAA;IAC7D,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,yBAAyB,CAC7B,KAAW,EACX,aAA2B,EAC3B,qBAA6C;QAE7C,OAAO,EAAE,CAAA;IACX,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mnci/nx-python-pip",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "An Nx plugin for pip-native Python projects (Ruff + pytest + the standard PyPA build/twine tools) — no uv, no Poetry, no lock file.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|