fastws-cli 0.0.21__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.21
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
@@ -212,7 +212,7 @@ Cargo must already build a loadable Python extension. For PyO3 extension-module
212
212
 
213
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
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
 
@@ -187,7 +187,7 @@ Cargo must already build a loadable Python extension. For PyO3 extension-module
187
187
 
188
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
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
 
@@ -1,4 +1,5 @@
1
- __version__ = "0.0.21"
1
+ __version__ = "0.0.22"
2
+
2
3
 
3
4
 
4
5
 
@@ -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):
@@ -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.21
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
@@ -212,7 +212,7 @@ Cargo must already build a loadable Python extension. For PyO3 extension-module
212
212
 
213
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
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
 
File without changes
File without changes
File without changes