fastws-cli 0.0.20__tar.gz → 0.0.22__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.20
3
+ Version: 0.0.22
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License-Expression: Apache-2.0
@@ -210,11 +210,11 @@ Make the initial editable installation through `ws-sync` or maturin. Repeat that
210
210
 
211
211
  Cargo must already build a loadable Python extension. For PyO3 extension-module builds on macOS, configure the linker in `build.rs` with `pyo3_build_config::add_extension_module_link_args()`. This command does not inject maturin's extra compiler flags.
212
212
 
213
- To share the library build with `cargo test`, also produce an `rlib` and use the same features for both commands. Rust unit tests compile a separate library with `cfg(test)`; integration tests reuse the ordinary library. `cargo develop` does not change the project's Cargo configuration or its test layout.
213
+ For reusable Rust libraries, keep the core crate Python-free and put PyO3 in an unpublished `py/` binding crate. Set the workspace's `default-members = [".", "py"]` and maturin's `manifest-path = "py/Cargo.toml"`. The binding crate should produce `["cdylib", "rlib"]` with `test = false`. Both commands then reuse the ordinary core and binding libraries. Rust unit tests still compile a separate `cfg(test)` executable; integration tests reuse the ordinary library. `cargo develop` does not change the project's Cargo configuration or its test layout.
214
214
 
215
- Set `native-binaries = true` under `[tool.fastws]` to build and install the package's Cargo binary targets into the active venv alongside its extension. Cargo reports the executable paths; there is no separate list of binary names.
215
+ Set `native-binaries = true` under `[tool.fastws]` to build and install the binary targets of the workspace's default members into the active venv alongside the extension. A binary can live in its own member crate, such as a `cli/` crate beside `py/`, listed in `default-members`. maturin's sdist keeps only the members that the extension depends on, so a wheel built from the sdist lacks a binary from such a crate. Cargo reports the executable paths; there is no separate list of binary names.
216
216
 
217
- For wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to the wheel-data directory. The backend stages Python-free binaries in its `scripts/` subdirectory, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
217
+ For wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to a generated wheel-data directory. The backend replaces its `scripts/` subdirectory with the current Python-free binaries, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
218
218
 
219
219
  Direct maturin CLI builds bypass the Python build backend. Stage the binaries first with the shared command:
220
220
 
@@ -185,11 +185,11 @@ Make the initial editable installation through `ws-sync` or maturin. Repeat that
185
185
 
186
186
  Cargo must already build a loadable Python extension. For PyO3 extension-module builds on macOS, configure the linker in `build.rs` with `pyo3_build_config::add_extension_module_link_args()`. This command does not inject maturin's extra compiler flags.
187
187
 
188
- To share the library build with `cargo test`, also produce an `rlib` and use the same features for both commands. Rust unit tests compile a separate library with `cfg(test)`; integration tests reuse the ordinary library. `cargo develop` does not change the project's Cargo configuration or its test layout.
188
+ For reusable Rust libraries, keep the core crate Python-free and put PyO3 in an unpublished `py/` binding crate. Set the workspace's `default-members = [".", "py"]` and maturin's `manifest-path = "py/Cargo.toml"`. The binding crate should produce `["cdylib", "rlib"]` with `test = false`. Both commands then reuse the ordinary core and binding libraries. Rust unit tests still compile a separate `cfg(test)` executable; integration tests reuse the ordinary library. `cargo develop` does not change the project's Cargo configuration or its test layout.
189
189
 
190
- Set `native-binaries = true` under `[tool.fastws]` to build and install the package's Cargo binary targets into the active venv alongside its extension. Cargo reports the executable paths; there is no separate list of binary names.
190
+ Set `native-binaries = true` under `[tool.fastws]` to build and install the binary targets of the workspace's default members into the active venv alongside the extension. A binary can live in its own member crate, such as a `cli/` crate beside `py/`, listed in `default-members`. maturin's sdist keeps only the members that the extension depends on, so a wheel built from the sdist lacks a binary from such a crate. Cargo reports the executable paths; there is no separate list of binary names.
191
191
 
192
- For wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to the wheel-data directory. The backend stages Python-free binaries in its `scripts/` subdirectory, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
192
+ For wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to a generated wheel-data directory. The backend replaces its `scripts/` subdirectory with the current Python-free binaries, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
193
193
 
194
194
  Direct maturin CLI builds bypass the Python build backend. Stage the binaries first with the shared command:
195
195
 
@@ -1,4 +1,6 @@
1
- __version__ = "0.0.20"
1
+ __version__ = "0.0.22"
2
+
3
+
2
4
 
3
5
 
4
6
 
@@ -11,12 +11,20 @@ def settings(root):
11
11
  return tomllib.loads((root/'pyproject.toml').read_text()).get('tool', {})
12
12
 
13
13
 
14
+ def cargo(root, *args):
15
+ "Run Cargo in the project and return its standard output."
16
+ return subprocess.run(['cargo', *args], cwd=root, stdout=subprocess.PIPE, text=True, check=True).stdout
17
+
18
+
19
+ def members(root):
20
+ "The manifests of the workspace's member packages."
21
+ return {Path(p['manifest_path']) for p in json.loads(cargo(root, 'metadata', '--no-deps', '--format-version', '1'))['packages']}
22
+
23
+
14
24
  def build(root, *, library=True, binaries=False, profile=None, target=None, no_default_features=False):
15
- "Build with Cargo and return this package's compiler artifacts."
25
+ "Build with Cargo and return the compiler artifacts of the workspace's packages."
16
26
  cfg = settings(root)['maturin']
17
- manifest = (root/'Cargo.toml').resolve()
18
- binding = (root/cfg.get('manifest-path', 'Cargo.toml')).resolve()
19
- cmd = ['cargo', 'build', '--manifest-path', str(manifest), '--message-format=json-render-diagnostics']
27
+ cmd = ['build', '--manifest-path', str((root/'Cargo.toml').resolve()), '--message-format=json-render-diagnostics']
20
28
  if library: cmd.append('--lib')
21
29
  if binaries: cmd.append('--bins')
22
30
  if profile := profile or cfg.get('profile'): cmd += ['--profile', profile]
@@ -26,9 +34,9 @@ def build(root, *, library=True, binaries=False, profile=None, target=None, no_d
26
34
  if features := cfg.get('features'): cmd += ['--features', ','.join(features)]
27
35
  for flag in ('all-features', 'no-default-features'):
28
36
  if cfg.get(flag): cmd.append('--' + flag)
29
- out = subprocess.run(cmd, cwd=root, stdout=subprocess.PIPE, text=True, check=True).stdout
30
- messages = [json.loads(line) for line in out.splitlines()]
31
- return [m for m in messages if m.get('reason') == 'compiler-artifact' and Path(m['manifest_path']) in (manifest, binding)]
37
+ messages = [json.loads(line) for line in cargo(root, *cmd).splitlines()]
38
+ workspace = members(root)
39
+ return [m for m in messages if m.get('reason') == 'compiler-artifact' and Path(m['manifest_path']) in workspace]
32
40
 
33
41
 
34
42
  def replace(source, destination):
@@ -64,4 +72,5 @@ def stage_binaries(root, profile=None, target=None):
64
72
  cfg = settings(root)['maturin']
65
73
  dest = root/cfg['data']/'scripts'
66
74
  artifacts = build(root, library=False, binaries=True, profile=profile, target=target, no_default_features=True)
75
+ if dest.exists(): shutil.rmtree(dest)
67
76
  return [replace(m['executable'], dest/Path(m['executable']).name) for m in artifacts if m.get('executable')]
@@ -564,7 +564,7 @@ def cargo_develop(
564
564
  ):
565
565
  r"Build and install a mixed Rust/Python project's extension and opted-in binaries."
566
566
  from .cargo import develop
567
- for dest in develop(Path(path).resolve()): print(f'Installed {dest}')
567
+ for dest in develop(Path(path).resolve()): pass
568
568
 
569
569
  @call_parse(pos=['command'])
570
570
  def cargo_stage(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.20
3
+ Version: 0.0.22
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License-Expression: Apache-2.0
@@ -210,11 +210,11 @@ Make the initial editable installation through `ws-sync` or maturin. Repeat that
210
210
 
211
211
  Cargo must already build a loadable Python extension. For PyO3 extension-module builds on macOS, configure the linker in `build.rs` with `pyo3_build_config::add_extension_module_link_args()`. This command does not inject maturin's extra compiler flags.
212
212
 
213
- To share the library build with `cargo test`, also produce an `rlib` and use the same features for both commands. Rust unit tests compile a separate library with `cfg(test)`; integration tests reuse the ordinary library. `cargo develop` does not change the project's Cargo configuration or its test layout.
213
+ For reusable Rust libraries, keep the core crate Python-free and put PyO3 in an unpublished `py/` binding crate. Set the workspace's `default-members = [".", "py"]` and maturin's `manifest-path = "py/Cargo.toml"`. The binding crate should produce `["cdylib", "rlib"]` with `test = false`. Both commands then reuse the ordinary core and binding libraries. Rust unit tests still compile a separate `cfg(test)` executable; integration tests reuse the ordinary library. `cargo develop` does not change the project's Cargo configuration or its test layout.
214
214
 
215
- Set `native-binaries = true` under `[tool.fastws]` to build and install the package's Cargo binary targets into the active venv alongside its extension. Cargo reports the executable paths; there is no separate list of binary names.
215
+ Set `native-binaries = true` under `[tool.fastws]` to build and install the binary targets of the workspace's default members into the active venv alongside the extension. A binary can live in its own member crate, such as a `cli/` crate beside `py/`, listed in `default-members`. maturin's sdist keeps only the members that the extension depends on, so a wheel built from the sdist lacks a binary from such a crate. Cargo reports the executable paths; there is no separate list of binary names.
216
216
 
217
- For wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to the wheel-data directory. The backend stages Python-free binaries in its `scripts/` subdirectory, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
217
+ For wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to a generated wheel-data directory. The backend replaces its `scripts/` subdirectory with the current Python-free binaries, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
218
218
 
219
219
  Direct maturin CLI builds bypass the Python build backend. Stage the binaries first with the shared command:
220
220
 
File without changes
File without changes
File without changes