fastws-cli 0.0.40__tar.gz → 0.0.42__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.
Files changed (32) hide show
  1. {fastws_cli-0.0.40/fastws_cli.egg-info → fastws_cli-0.0.42}/PKG-INFO +8 -6
  2. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/README.md +7 -5
  3. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/__init__.py +3 -1
  4. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/build_backend.py +6 -4
  5. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/cargo.py +44 -17
  6. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/core.py +51 -30
  7. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/news.py +1 -2
  8. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/procs.py +2 -2
  9. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/store.py +1 -2
  10. {fastws_cli-0.0.40 → fastws_cli-0.0.42/fastws_cli.egg-info}/PKG-INFO +8 -6
  11. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/tests/test_build.py +18 -12
  12. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/tests/test_integrate.py +5 -2
  13. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/tests/test_procs.py +2 -2
  14. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/tests/test_setup.py +3 -2
  15. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/tests/test_sync.py +44 -14
  16. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/tests/test_timelock.py +2 -1
  17. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/LICENSE +0 -0
  18. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/_toml.py +0 -0
  19. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/integrate.py +0 -0
  20. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/releases.py +0 -0
  21. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws/timelock.py +0 -0
  22. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws_cli.egg-info/SOURCES.txt +0 -0
  23. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws_cli.egg-info/dependency_links.txt +0 -0
  24. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws_cli.egg-info/entry_points.txt +0 -0
  25. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws_cli.egg-info/requires.txt +0 -0
  26. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/fastws_cli.egg-info/top_level.txt +0 -0
  27. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/pyproject.toml +0 -0
  28. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/setup.cfg +0 -0
  29. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/tests/test_build_backend.py +0 -0
  30. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/tests/test_news.py +0 -0
  31. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/tests/test_releases.py +0 -0
  32. {fastws_cli-0.0.40 → fastws_cli-0.0.42}/tests/test_store.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.40
3
+ Version: 0.0.42
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License-Expression: Apache-2.0
@@ -228,7 +228,7 @@ cargo develop --path /path/to/project
228
228
  cargo develop --profile quick
229
229
  ```
230
230
 
231
- Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path`, `bindings` and features from `[tool.maturin]`. `[tool.fastws] dev-profile = "quick"` selects a project's default for both `cargo develop` and `fastws.cargo.run_tests`. Without that setting they use `test`. An explicit `--profile NAME` overrides the project default. Mixed projects must produce a `cdylib` and set `python-source`; `bindings = "bin"` projects build and install their binary targets directly into the active venv. Define the selected profile in `Cargo.toml` and keep incremental compilation enabled for the local crate.
231
+ Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path`, `bindings` and features from `[tool.maturin]`. `[tool.fastws] dev-profile = "quick"` selects a project's default for both `cargo develop` and `fastws.cargo.run_tests`. Without that setting they use `release`. An explicit `--profile NAME` overrides the project default. Mixed projects must produce a `cdylib` and set `python-source`; `bindings = "bin"` projects build and install their binary targets directly into the active venv. Define the selected profile in `Cargo.toml` and keep incremental compilation enabled for the local crate.
232
232
 
233
233
  The workspace's `[tool.fastws] cargo = "/path/to/cargo"` optionally selects one explicit Cargo executable for fastws builds, checks, metadata and tests, including nextest's subordinate Cargo calls. A missing executable fails without falling back. With no selection, subprocess uses its normal PATH and working-directory rules. Upstream Cargo stays installed and usable; manifests, profiles, features and package selection are unchanged.
234
234
 
@@ -267,7 +267,7 @@ cargo stage --profile dist
267
267
  maturin build --profile dist
268
268
  ```
269
269
 
270
- Pass the same target and feature flags to both commands, including `--no-default-features` when needed. Staging builds binaries only. On macOS it matches Maturin's linker flags through `build.rustflags` or existing `RUSTFLAGS`/`CARGO_ENCODED_RUSTFLAGS`. A macOS target with its own `rustflags` must include `-C link-arg=-undefined -C link-arg=dynamic_lookup` there. Shared crates are reused when the two builds resolve the same dependency features. Adding `--lib` to staging can select a different compilation profile under LTO.
270
+ Pass the same target, feature, and Linux glibc flags (`--zig --manylinux 2_31`, `--no-default-features`) to both commands when needed. Staging builds binaries only. On macOS it matches Maturin's linker flags through `build.rustflags` or existing `RUSTFLAGS`/`CARGO_ENCODED_RUSTFLAGS`. A macOS target with its own `rustflags` must include `-C link-arg=-undefined -C link-arg=dynamic_lookup` there. Shared crates are reused when the two builds resolve the same dependency features. Adding `--lib` to staging can select a different compilation profile under LTO.
271
271
 
272
272
  ### `cargo wait`
273
273
 
@@ -288,7 +288,7 @@ Where a root has `.config/nextest.toml`, preparation uses `cargo nextest list` t
288
288
 
289
289
  `root` can also be a list of roots, which build one after another. Roots without nextest then run their binaries in turn. Each profile then runs at the same time in every root whose config defines it: tests in different roots share a phase, and no phase starts before the previous one ends. Suite names start with the root's directory name, and with several profiles also with the profile, as in `app timed: tests/speed.rs`. A failure ends the run after its profile unless `--no-fail-fast` is given.
290
290
 
291
- The default profile is `[tool.fastws].dev-profile`, or `test` when unset. Explicit `--profile NAME`, `--profile=NAME`, `--release` and `-r` override it. Pass Cargo build/selection options positionally, and test filters and harness options in `test_args`. A failed binary stops the run unless `--no-fail-fast` is given. Results contain compiler diagnostics and each binary's outcomes and captured failures.
291
+ The default profile is `[tool.fastws].dev-profile`, or `release` when unset. Explicit `--profile NAME`, `--profile=NAME`, `--release` and `-r` override it. Pass Cargo build/selection options positionally, and test filters and harness options in `test_args`. A failed binary stops the run unless `--no-fail-fast` is given. Results contain compiler diagnostics and each binary's outcomes and captured failures.
292
292
 
293
293
  ```python
294
294
  from fastws.cargo import run_tests
@@ -359,13 +359,13 @@ Fastws discovers JavaScript packages directly under the workspace root, explicit
359
359
 
360
360
  Each sync updates `packages` in the root `pnpm-workspace.yaml` (creating it with `linkWorkspacePackages: deep`, `preferWorkspacePackages: true`, and `minimumReleaseAge: 1440` by default) and maintains `private: true` in the root `package.json`. It preserves external paths, globs, and unrelated settings, and reports added and removed packages.
361
361
 
362
- When JavaScript workspace members are present, `ws-sync` reads `vp toolchain --json -g` and populates `devDependencies["vite-plus"]` in `package.json` plus matching `vite@*` and `vitest@*` entries under `overrides` in `pnpm-workspace.yaml`. Optional tracked `pnpm-workspace.shared.yaml` and `package.json.shared` files are merged on top on every sync. Object-valued fields merge one level deep, shared values win conflicts, and arrays replace rather than concatenate. Unrelated local settings remain; removing a shared key does not delete its local value. Use these files to declare `packageManager`, `devEngines.runtime`, shared policies such as `allowBuilds`, or explicit Vite+ overrides.
362
+ When JavaScript workspace members are present, `ws-sync` reads `vp toolchain --json -g`, writes `devDependencies["vite-plus"]` to `package.json`, sets matching `vite@*` and `vitest@*` entries under `overrides` in `pnpm-workspace.yaml`, and adds those toolchain packages to `minimumReleaseAgeExclude` when `minimumReleaseAge` is enabled. Optional tracked `pnpm-workspace.shared.yaml` and `package.json.shared` files are merged on top on every sync. Object-valued fields merge one level deep, shared values win conflicts, and arrays replace rather than concatenate. Unrelated local settings remain; removing a shared key does not delete its local value. Use these files to declare `packageManager`, `devEngines.runtime`, shared policies such as `allowBuilds`, or explicit Vite+ overrides.
363
363
 
364
364
  Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` and `[tool.uv.config-settings-package]` (`metadata-only = "1"`) with the sorted package names of projects using `fastws.build_backend`, including external checkouts. These builds use the shared environment's `fastws-cli` and `maturin`, skip Rust compilation during editable installs inside the workspace, and keep metadata-only wheels separate from compiled editable wheels in uv's cache. Leave global build isolation enabled for other projects.
365
365
 
366
366
  After `uv sync`, fastws writes `_fastws_pytest.pth` into the workspace venv's `site-packages` to default `PYTEST_DISABLE_PLUGIN_AUTOLOAD=1`, keeping pytest plugins installed for one repo from leaking into others. Repos enable the plugins they need via `-p` in `addopts` (override for a run with `PYTEST_DISABLE_PLUGIN_AUTOLOAD=""`).
367
367
 
368
- After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects, with up to one project per CPU building concurrently by default. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
368
+ After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects without a `package.json`, with up to one project per CPU building concurrently by default. For clean Git checkouts, sync sets `CARGO_INCREMENTAL=0` on `cargo develop` and `cargo wasm` (unless `CARGO_INCREMENTAL` is already set) so `sccache` caches workspace crates; dirty checkouts keep each repo's configured incremental setting. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
369
369
 
370
370
  Strictly after `cargo develop` finishes, fastws runs `cargo wasm` in parallel for every repo declaring `[tool.fastws].wasm-package`, so any `post-develop-module` generators have already produced their assets and each generated `wasm/pkg/package.json` exists before JavaScript installation.
371
371
 
@@ -373,6 +373,8 @@ Fastws then runs `vp install` at the workspace root (driving pnpm underneath). N
373
373
 
374
374
  After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N> run build` (through Vite+'s managed pnpm) so local dependencies build before their consumers and independent builds share the project-concurrency limit. Packages own their build commands: AnswerUI's is `nbdev-export`, for example. Python sync runs first, so a repo-list entry such as `AnswerDotAI/answerui[dev]` supplies its Python build tools through the normal extras mechanism. No additional install lifecycle hook is needed. Cargo and other build tools retain their own incremental behavior.
375
375
 
376
+ After the JavaScript builds finish, fastws runs `cargo develop` in `bindings = "bin"` Rust projects that also have a `package.json`, using the same concurrency limit. Binaries that embed built frontend assets then compile against the updated outputs.
377
+
376
378
  `--build-workers` sets the maximum concurrent projects within the Python-native, WebAssembly, and JavaScript build phases, defaulting to the CPU count; `--build-workers 1` runs each phase serially. It is separate from `--workers`, which controls cloning, pulling and dependency updates. Cargo keeps its own within-project parallelism, so increasing project concurrency also increases CPU and memory demand. Cargo may serialize builds that share a target directory.
377
379
 
378
380
  When JavaScript workspaces are present, fastws requires Vite+ (`vp`) on `PATH` with managed `node` and `pnpm` shims active. When WebAssembly packages (`[tool.fastws].wasm-package`) are present, fastws also requires rustup's `rustc`/`cargo` proxies and the `wasm32-unknown-unknown` target. Run `ws-setup` to install or configure any missing prerequisites.
@@ -199,7 +199,7 @@ cargo develop --path /path/to/project
199
199
  cargo develop --profile quick
200
200
  ```
201
201
 
202
- Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path`, `bindings` and features from `[tool.maturin]`. `[tool.fastws] dev-profile = "quick"` selects a project's default for both `cargo develop` and `fastws.cargo.run_tests`. Without that setting they use `test`. An explicit `--profile NAME` overrides the project default. Mixed projects must produce a `cdylib` and set `python-source`; `bindings = "bin"` projects build and install their binary targets directly into the active venv. Define the selected profile in `Cargo.toml` and keep incremental compilation enabled for the local crate.
202
+ Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path`, `bindings` and features from `[tool.maturin]`. `[tool.fastws] dev-profile = "quick"` selects a project's default for both `cargo develop` and `fastws.cargo.run_tests`. Without that setting they use `release`. An explicit `--profile NAME` overrides the project default. Mixed projects must produce a `cdylib` and set `python-source`; `bindings = "bin"` projects build and install their binary targets directly into the active venv. Define the selected profile in `Cargo.toml` and keep incremental compilation enabled for the local crate.
203
203
 
204
204
  The workspace's `[tool.fastws] cargo = "/path/to/cargo"` optionally selects one explicit Cargo executable for fastws builds, checks, metadata and tests, including nextest's subordinate Cargo calls. A missing executable fails without falling back. With no selection, subprocess uses its normal PATH and working-directory rules. Upstream Cargo stays installed and usable; manifests, profiles, features and package selection are unchanged.
205
205
 
@@ -238,7 +238,7 @@ cargo stage --profile dist
238
238
  maturin build --profile dist
239
239
  ```
240
240
 
241
- Pass the same target and feature flags to both commands, including `--no-default-features` when needed. Staging builds binaries only. On macOS it matches Maturin's linker flags through `build.rustflags` or existing `RUSTFLAGS`/`CARGO_ENCODED_RUSTFLAGS`. A macOS target with its own `rustflags` must include `-C link-arg=-undefined -C link-arg=dynamic_lookup` there. Shared crates are reused when the two builds resolve the same dependency features. Adding `--lib` to staging can select a different compilation profile under LTO.
241
+ Pass the same target, feature, and Linux glibc flags (`--zig --manylinux 2_31`, `--no-default-features`) to both commands when needed. Staging builds binaries only. On macOS it matches Maturin's linker flags through `build.rustflags` or existing `RUSTFLAGS`/`CARGO_ENCODED_RUSTFLAGS`. A macOS target with its own `rustflags` must include `-C link-arg=-undefined -C link-arg=dynamic_lookup` there. Shared crates are reused when the two builds resolve the same dependency features. Adding `--lib` to staging can select a different compilation profile under LTO.
242
242
 
243
243
  ### `cargo wait`
244
244
 
@@ -259,7 +259,7 @@ Where a root has `.config/nextest.toml`, preparation uses `cargo nextest list` t
259
259
 
260
260
  `root` can also be a list of roots, which build one after another. Roots without nextest then run their binaries in turn. Each profile then runs at the same time in every root whose config defines it: tests in different roots share a phase, and no phase starts before the previous one ends. Suite names start with the root's directory name, and with several profiles also with the profile, as in `app timed: tests/speed.rs`. A failure ends the run after its profile unless `--no-fail-fast` is given.
261
261
 
262
- The default profile is `[tool.fastws].dev-profile`, or `test` when unset. Explicit `--profile NAME`, `--profile=NAME`, `--release` and `-r` override it. Pass Cargo build/selection options positionally, and test filters and harness options in `test_args`. A failed binary stops the run unless `--no-fail-fast` is given. Results contain compiler diagnostics and each binary's outcomes and captured failures.
262
+ The default profile is `[tool.fastws].dev-profile`, or `release` when unset. Explicit `--profile NAME`, `--profile=NAME`, `--release` and `-r` override it. Pass Cargo build/selection options positionally, and test filters and harness options in `test_args`. A failed binary stops the run unless `--no-fail-fast` is given. Results contain compiler diagnostics and each binary's outcomes and captured failures.
263
263
 
264
264
  ```python
265
265
  from fastws.cargo import run_tests
@@ -330,13 +330,13 @@ Fastws discovers JavaScript packages directly under the workspace root, explicit
330
330
 
331
331
  Each sync updates `packages` in the root `pnpm-workspace.yaml` (creating it with `linkWorkspacePackages: deep`, `preferWorkspacePackages: true`, and `minimumReleaseAge: 1440` by default) and maintains `private: true` in the root `package.json`. It preserves external paths, globs, and unrelated settings, and reports added and removed packages.
332
332
 
333
- When JavaScript workspace members are present, `ws-sync` reads `vp toolchain --json -g` and populates `devDependencies["vite-plus"]` in `package.json` plus matching `vite@*` and `vitest@*` entries under `overrides` in `pnpm-workspace.yaml`. Optional tracked `pnpm-workspace.shared.yaml` and `package.json.shared` files are merged on top on every sync. Object-valued fields merge one level deep, shared values win conflicts, and arrays replace rather than concatenate. Unrelated local settings remain; removing a shared key does not delete its local value. Use these files to declare `packageManager`, `devEngines.runtime`, shared policies such as `allowBuilds`, or explicit Vite+ overrides.
333
+ When JavaScript workspace members are present, `ws-sync` reads `vp toolchain --json -g`, writes `devDependencies["vite-plus"]` to `package.json`, sets matching `vite@*` and `vitest@*` entries under `overrides` in `pnpm-workspace.yaml`, and adds those toolchain packages to `minimumReleaseAgeExclude` when `minimumReleaseAge` is enabled. Optional tracked `pnpm-workspace.shared.yaml` and `package.json.shared` files are merged on top on every sync. Object-valued fields merge one level deep, shared values win conflicts, and arrays replace rather than concatenate. Unrelated local settings remain; removing a shared key does not delete its local value. Use these files to declare `packageManager`, `devEngines.runtime`, shared policies such as `allowBuilds`, or explicit Vite+ overrides.
334
334
 
335
335
  Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` and `[tool.uv.config-settings-package]` (`metadata-only = "1"`) with the sorted package names of projects using `fastws.build_backend`, including external checkouts. These builds use the shared environment's `fastws-cli` and `maturin`, skip Rust compilation during editable installs inside the workspace, and keep metadata-only wheels separate from compiled editable wheels in uv's cache. Leave global build isolation enabled for other projects.
336
336
 
337
337
  After `uv sync`, fastws writes `_fastws_pytest.pth` into the workspace venv's `site-packages` to default `PYTEST_DISABLE_PLUGIN_AUTOLOAD=1`, keeping pytest plugins installed for one repo from leaking into others. Repos enable the plugins they need via `-p` in `addopts` (override for a run with `PYTEST_DISABLE_PLUGIN_AUTOLOAD=""`).
338
338
 
339
- After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects, with up to one project per CPU building concurrently by default. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
339
+ After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects without a `package.json`, with up to one project per CPU building concurrently by default. For clean Git checkouts, sync sets `CARGO_INCREMENTAL=0` on `cargo develop` and `cargo wasm` (unless `CARGO_INCREMENTAL` is already set) so `sccache` caches workspace crates; dirty checkouts keep each repo's configured incremental setting. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
340
340
 
341
341
  Strictly after `cargo develop` finishes, fastws runs `cargo wasm` in parallel for every repo declaring `[tool.fastws].wasm-package`, so any `post-develop-module` generators have already produced their assets and each generated `wasm/pkg/package.json` exists before JavaScript installation.
342
342
 
@@ -344,6 +344,8 @@ Fastws then runs `vp install` at the workspace root (driving pnpm underneath). N
344
344
 
345
345
  After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N> run build` (through Vite+'s managed pnpm) so local dependencies build before their consumers and independent builds share the project-concurrency limit. Packages own their build commands: AnswerUI's is `nbdev-export`, for example. Python sync runs first, so a repo-list entry such as `AnswerDotAI/answerui[dev]` supplies its Python build tools through the normal extras mechanism. No additional install lifecycle hook is needed. Cargo and other build tools retain their own incremental behavior.
346
346
 
347
+ After the JavaScript builds finish, fastws runs `cargo develop` in `bindings = "bin"` Rust projects that also have a `package.json`, using the same concurrency limit. Binaries that embed built frontend assets then compile against the updated outputs.
348
+
347
349
  `--build-workers` sets the maximum concurrent projects within the Python-native, WebAssembly, and JavaScript build phases, defaulting to the CPU count; `--build-workers 1` runs each phase serially. It is separate from `--workers`, which controls cloning, pulling and dependency updates. Cargo keeps its own within-project parallelism, so increasing project concurrency also increases CPU and memory demand. Cargo may serialize builds that share a target directory.
348
350
 
349
351
  When JavaScript workspaces are present, fastws requires Vite+ (`vp`) on `PATH` with managed `node` and `pnpm` shims active. When WebAssembly packages (`[tool.fastws].wasm-package`) are present, fastws also requires rustup's `rustc`/`cargo` proxies and the `wasm32-unknown-unknown` target. Run `ws-setup` to install or configure any missing prerequisites.
@@ -1,4 +1,6 @@
1
- __version__ = "0.0.40"
1
+ __version__ = "0.0.42"
2
+
3
+
2
4
 
3
5
 
4
6
 
@@ -20,9 +20,12 @@ def _stage(config_settings, default_profile='release'):
20
20
  parser.add_argument('--features', '-F', action='append')
21
21
  parser.add_argument('--all-features', action='store_true')
22
22
  parser.add_argument('--no-default-features', action='store_true')
23
+ parser.add_argument('--zig', action='store_true')
24
+ parser.add_argument('--manylinux', '--compatibility')
23
25
  args, _ = parser.parse_known_args(maturin.get_maturin_pep517_args(config_settings))
24
26
  profile = args.profile or ('release' if args.release else tool['maturin'].get('profile', default_profile))
25
- stage_binaries(root, profile, args.target, args.features, args.all_features, args.no_default_features)
27
+ stage_binaries(root, profile, args.target, args.features, args.all_features, args.no_default_features,
28
+ zig=args.zig, manylinux=args.manylinux)
26
29
 
27
30
 
28
31
  def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
@@ -41,11 +44,10 @@ def build_editable(wheel_directory, config_settings=None, metadata_directory=Non
41
44
  tag = next(line.removeprefix('Tag: ') for line in (info/'WHEEL').read_text().splitlines() if line.startswith('Tag: '))
42
45
  files = {p.relative_to(info.parent).as_posix(): p.read_bytes() for p in info.rglob('*') if p.is_file() and p != info/'RECORD'}
43
46
  root = Path.cwd()
44
- if py_src := settings(root)['maturin'].get('python-source'):
45
- files[f'{name}.pth'] = f'{(root/py_src).resolve()}\n'.encode()
47
+ if py_src := settings(root)['maturin'].get('python-source'): files[f'{name}.pth'] = f'{(root/py_src).resolve()}\n'.encode()
46
48
  record = f'{info.name}/RECORD'
47
49
  rows = [(path, 'sha256=' + base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b'=').decode(), len(data))
48
- for path, data in files.items()]
50
+ for path, data in files.items()]
49
51
  buffer = io.StringIO()
50
52
  csv.writer(buffer).writerows([*rows, (record, '', '')])
51
53
  files[record] = buffer.getvalue().encode()
@@ -20,8 +20,7 @@ def settings(root):
20
20
  return tomllib.loads((Path(root).expanduser()/'pyproject.toml').read_text()).get('tool', {})
21
21
 
22
22
 
23
- def _dev_profile(root):
24
- return settings(root).get('fastws', {}).get('dev-profile', 'test') if (root/'pyproject.toml').exists() else 'test'
23
+ def _dev_profile(root): return settings(root).get('fastws', {}).get('dev-profile', 'release') if (root/'pyproject.toml').exists() else 'release'
25
24
 
26
25
 
27
26
  def _cargo_command(*args, env=None):
@@ -109,8 +108,8 @@ class Suite:
109
108
  elif in_failures and (m := _FAILURE.match(line)): current = failures.setdefault(m[1], [])
110
109
  elif current is not None: current.append(line)
111
110
  return cls(name, '\n'.join(lines), {m[1]: m[2] for l in lines if (m := _TEST.match(l))},
112
- {k: '\n'.join(v).strip('\n') for k,v in failures.items()},
113
- next((l for l in lines if l.startswith('test result: ')), ''), bool(returncode), timed_out)
111
+ {k: '\n'.join(v).strip('\n') for k,v in failures.items()},
112
+ next((l for l in lines if l.startswith('test result: ')), ''), bool(returncode), timed_out)
114
113
 
115
114
  def __str__(self):
116
115
  n = Counter(self.tests.values())
@@ -248,7 +247,7 @@ def run_tests(
248
247
  timeout:float=30, # Seconds that each native test binary, or each nextest run of one profile in one root, may take after building; None: no limit
249
248
  profiles:tuple=('default',) # The nextest profiles to run in turn, each at once in every root whose `.config/nextest.toml` defines it
250
249
  )->Results:
251
- "Build native tests once per root, with no time limit, then run Cargo's reported executables directly from their package directories. Where a root has `.config/nextest.toml`, `cargo nextest run` runs them instead, each test in its own process, once for each of `profiles` that its config defines, and each binary's results come from nextest's JUnit report. Several roots build in turn. Roots without nextest then run in turn, and each profile then runs in every root that defines it at once. Without `--no-fail-fast`, a failure ends the run after its binary, or after its profile. With several roots, each suite's name starts with its root's directory name, and with several profiles, with the profile. Source edits after building cannot trigger another build; results describe the compiled build, not the latest working tree. `timeout` bounds each binary, or each root's run of a profile, excluding compilation. Outside `FASTWS_JOB`, a run that runs out of time is reported as a failed suite with `timed_out` set. Inside a marked job, the timeout raises so its owner can clean up descendants. An omitted Cargo profile uses each root's tool.fastws.dev-profile, or test. Doctests are not run. This takes no timing lock: rustc's wrapper and tests that time own their holds."
250
+ "Build native tests once per root, with no time limit, then run Cargo's reported executables directly from their package directories. Where a root has `.config/nextest.toml`, `cargo nextest run` runs them instead, each test in its own process, once for each of `profiles` that its config defines, and each binary's results come from nextest's JUnit report. Several roots build in turn. Roots without nextest then run in turn, and each profile then runs in every root that defines it at once. Without `--no-fail-fast`, a failure ends the run after its binary, or after its profile. With several roots, each suite's name starts with its root's directory name, and with several profiles, with the profile. Source edits after building cannot trigger another build; results describe the compiled build, not the latest working tree. `timeout` bounds each binary, or each root's run of a profile, excluding compilation. Outside `FASTWS_JOB`, a run that runs out of time is reported as a failed suite with `timed_out` set. Inside a marked job, the timeout raises so its owner can clean up descendants. An omitted Cargo profile uses each root's tool.fastws.dev-profile, or release. Doctests are not run. This takes no timing lock: rustc's wrapper and tests that time own their holds."
252
251
  roots = [Path(r).expanduser().resolve() for r in (root if isinstance(root, (list, tuple)) else [root])]
253
252
  env = {'CARGO_TERM_QUIET': 'false', 'CARGO_TERM_COLOR': 'never'} | (env or {})
254
253
  has_profile = any(a in ('-r', '--release', '--profile') or isinstance(a, str) and a.startswith('--profile=') for a in args)
@@ -310,8 +309,7 @@ def _maturin_flags(target, env):
310
309
  target = target or env.get('CARGO_BUILD_TARGET')
311
310
  if not (target.endswith('-apple-darwin') if target else sys.platform == 'darwin'): return [], None
312
311
  link_args = ['link-arg=-undefined', 'link-arg=dynamic_lookup']
313
- if 'CARGO_ENCODED_RUSTFLAGS' in env:
314
- flags = env['CARGO_ENCODED_RUSTFLAGS'].split('\x1f') if env['CARGO_ENCODED_RUSTFLAGS'] else []
312
+ if 'CARGO_ENCODED_RUSTFLAGS' in env: flags = env['CARGO_ENCODED_RUSTFLAGS'].split('\x1f') if env['CARGO_ENCODED_RUSTFLAGS'] else []
315
313
  elif 'RUSTFLAGS' in env: flags = env['RUSTFLAGS'].split()
316
314
  else:
317
315
  flags = [arg for flag in link_args for arg in ('-C', flag)]
@@ -320,6 +318,30 @@ def _maturin_flags(target, env):
320
318
  if flag not in flags and '-C'+flag not in flags: flags += ['-C', flag]
321
319
  return [], dict(env, CARGO_ENCODED_RUSTFLAGS='\x1f'.join(flags))
322
320
 
321
+ _MANYLINUX_ALIASES = {'manylinux2014': '2.17', 'manylinux2010': '2.12', 'manylinux1': '2.5'}
322
+
323
+
324
+ def _glibc_version(manylinux):
325
+ if not manylinux: return None
326
+ s = str(manylinux).strip().lower()
327
+ if s in ('off', 'linux', 'auto'): return None
328
+ if s in _MANYLINUX_ALIASES: return _MANYLINUX_ALIASES[s]
329
+ m = re.fullmatch(r'(?:manylinux_)?(\d+)[_.](\d+)', s)
330
+ return f'{m[1]}.{m[2]}' if m else None
331
+
332
+
333
+ def _host_triple(env=None):
334
+ out = subprocess.run(['rustc', '-vV'], capture_output=True, text=True, check=True, env=env).stdout
335
+ return next(l.split(':', 1)[1].strip() for l in out.splitlines() if l.startswith('host:'))
336
+
337
+
338
+ def _zig_target(target, manylinux, env=None):
339
+ t = target or (env or {}).get('CARGO_BUILD_TARGET')
340
+ glibc = _glibc_version(manylinux)
341
+ if not glibc: return t
342
+ if not t: t = _host_triple(env)
343
+ return f'{t}.{glibc}' if '-linux-gnu' in t and not re.search(r'\.\d+\.\d+$', t) else t
344
+
323
345
 
324
346
  def build(
325
347
  root, # The project directory, whose `tool.maturin` gives the defaults (expands `~`)
@@ -332,21 +354,25 @@ def build(
332
354
  all_features=False, # Enable every feature? `tool.maturin`'s `all-features` also turns this on
333
355
  no_default_features=False, # Leave out the default features? `tool.maturin`'s `no-default-features` also turns this on
334
356
  for_maturin=False, # Use the macOS linker flags that maturin's own wheel build uses?
357
+ env=None, # Extra environment variables for Cargo
358
+ zig=False, # Build via `cargo zigbuild` for Linux glibc targeting?
359
+ manylinux=None, # Target glibc version for `zig`, e.g. `'2_31'` or `'manylinux_2_31'`
335
360
  ):
336
361
  "Build with Cargo and return the compiler artifacts of the workspace's packages."
337
362
  root = Path(root).expanduser()
338
363
  cfg = settings(root)['maturin']
339
- cmd = ['build', '--manifest-path', str((root/'Cargo.toml').resolve()), '--message-format=json-diagnostic-short']
364
+ base_env = os.environ | (env or {})
365
+ if zig: target = _zig_target(target, manylinux, base_env)
366
+ cmd = ['zigbuild' if zig else 'build', '--manifest-path', str((root/'Cargo.toml').resolve()), '--message-format=json-diagnostic-short']
340
367
  if library: cmd.append('--lib')
341
368
  if binaries: cmd.append('--bins')
342
369
  if profile := profile or cfg.get('profile'): cmd += ['--profile', profile]
343
370
  if target: cmd += ['--target', target]
344
- if features := features or cfg.get('features'):
345
- cmd += ['--features', features if isinstance(features, str) else ','.join(features)]
371
+ if features := features or cfg.get('features'): cmd += ['--features', features if isinstance(features, str) else ','.join(features)]
346
372
  for flag, active in [('all-features', all_features), ('no-default-features', no_default_features)]:
347
373
  if active or cfg.get(flag): cmd.append('--' + flag)
348
- extra, env = _maturin_flags(target, os.environ) if for_maturin else ([], None)
349
- cmd, env = _cargo_command(*cmd, *extra, env=env)
374
+ extra, maturin_env = _maturin_flags(target, base_env) if for_maturin else ([], None)
375
+ cmd, env = _cargo_command(*cmd, *extra, env=maturin_env or env)
350
376
  result = subprocess.run(cmd, cwd=root, stdout=subprocess.PIPE, text=True, env=env)
351
377
  if log := env.get('FASTWS_CARGO_LOG'):
352
378
  with Path(log).expanduser().open('a') as capture: capture.write(result.stdout)
@@ -369,8 +395,8 @@ def replace(source, destination):
369
395
  return destination
370
396
 
371
397
 
372
- def develop(root, *, profile=None):
373
- "Serialize this project's cooperating develop runs through build, artifact capture, installation, generator and wheel data. An omitted profile uses tool.fastws.dev-profile, or test. Raw Cargo commands do not take this lock."
398
+ def develop(root, *, profile=None, env=None):
399
+ "Serialize this project's cooperating develop runs through build, artifact capture, installation, generator and wheel data. An omitted profile uses tool.fastws.dev-profile, or release. Raw Cargo commands do not take this lock."
374
400
  root = Path(root).expanduser()
375
401
  with store.building(root) as started:
376
402
  tool = settings(root)
@@ -378,7 +404,7 @@ def develop(root, *, profile=None):
378
404
  bin_only = cfg.get('bindings') == 'bin'
379
405
  if not bin_only and 'python-source' not in cfg: raise ConfigError(r'cargo develop requires tool.maturin.python-source')
380
406
  binaries = bin_only or tool.get('fastws', {}).get('native-binaries', False)
381
- artifacts = build(root, library=not bin_only, binaries=binaries, profile=profile or _dev_profile(root))
407
+ artifacts = build(root, library=not bin_only, binaries=binaries, profile=profile or _dev_profile(root), env=env)
382
408
  env = Path(os.environ.get('VIRTUAL_ENV', sys.prefix))
383
409
  scripts = env/('Scripts' if os.name == 'nt' else 'bin')
384
410
  exes = [Path(m['executable']) for m in artifacts if binaries and m.get('executable')]
@@ -410,13 +436,14 @@ def develop(root, *, profile=None):
410
436
  if f.is_file(): replace(f, env/f.relative_to(data))
411
437
 
412
438
 
413
- def stage_binaries(root, profile=None, target=None, features=None, all_features=False, no_default_features=False):
439
+ def stage_binaries(root, profile=None, target=None, features=None, all_features=False, no_default_features=False,
440
+ zig=False, manylinux=None):
414
441
  "Stage Python-free Cargo binaries for a maturin wheel build."
415
442
  root = Path(root).expanduser()
416
443
  cfg = settings(root)['maturin']
417
444
  if 'data' not in cfg: raise ConfigError(r'staging native binaries requires tool.maturin.data')
418
445
  dest = root/cfg['data']/'scripts'
419
446
  artifacts = build(root, library=False, binaries=True, profile=profile, target=target, features=features,
420
- all_features=all_features, no_default_features=no_default_features, for_maturin=True)
447
+ all_features=all_features, no_default_features=no_default_features, for_maturin=True, zig=zig, manylinux=manylinux)
421
448
  if dest.exists(): shutil.rmtree(dest)
422
449
  return [replace(m['executable'], dest/Path(m['executable']).name) for m in artifacts if m.get('executable')]
@@ -317,7 +317,7 @@ members = ["./*"]
317
317
  return True
318
318
 
319
319
  def _sync_ws_pyproject(pyproject_path: Path, template_path: Path, projects: list[str], externals: list[tuple] = None,
320
- extras: dict[str, set[str]] = None) -> list[str]:
320
+ extras: dict[str, set] = None) -> list[str]:
321
321
  if not pyproject_path.exists():
322
322
  if template_path.exists(): shutil.copyfile(template_path, pyproject_path)
323
323
  else: _init_ws_pyproject(pyproject_path)
@@ -348,7 +348,7 @@ def _sync_ws_pyproject(pyproject_path: Path, template_path: Path, projects: list
348
348
  if content != original: pyproject_path.write_text(content)
349
349
  return missing + [n for n,_ in ext_missing]
350
350
 
351
- def _sync_build_backend(pyproject_path: Path, projects: list[tuple[str, Path]]):
351
+ def _sync_build_backend(pyproject_path: Path, projects: list[tuple]):
352
352
  "Regenerate uv's build-isolation and metadata-only config settings for projects using the fastws backend."
353
353
  from .build_backend import METADATA_ONLY
354
354
  content = pyproject_path.read_text()
@@ -373,8 +373,7 @@ def _sync_build_backend(pyproject_path: Path, projects: list[tuple[str, Path]]):
373
373
  if new_cfg:
374
374
  lines = "\n".join(f"{_toml_key(pkg)} = {_fmt_source(new_cfg[pkg])}" for pkg in sorted(new_cfg))
375
375
  content = _replace_table(content, 'tool.uv.config-settings-package', lines)
376
- elif span := _table_span(content, 'tool.uv.config-settings-package'):
377
- content = content[:span[0]] + content[span[1]:]
376
+ elif span := _table_span(content, 'tool.uv.config-settings-package'): content = content[:span[0]] + content[span[1]:]
378
377
  tomllib.loads(content)
379
378
  pyproject_path.write_text(content)
380
379
 
@@ -706,7 +705,7 @@ def _cli_errors():
706
705
  def cargo_develop(
707
706
  command: str = 'develop', # Subcommand name supplied by Cargo
708
707
  path: str = '.', # Rust/Python project directory
709
- profile: str = None, # Cargo profile; default: tool.fastws.dev-profile, or test
708
+ profile: str = None, # Cargo profile; default: tool.fastws.dev-profile, or release
710
709
  ):
711
710
  r"Build and install a mixed Rust/Python project's extension and opted-in binaries."
712
711
  from .cargo import develop
@@ -721,12 +720,14 @@ def cargo_stage(
721
720
  features: str = '', # Space or comma separated Cargo features
722
721
  all_features: bool = False, # Enable all Cargo features
723
722
  no_default_features: bool = False, # Disable default Cargo features
723
+ zig: bool = False, # Build via `cargo zigbuild` for Linux glibc targeting
724
+ manylinux: str = '', # Target glibc version for `--zig`, e.g. `2_31` or `manylinux_2_31`
724
725
  ):
725
726
  r"Stage Python-free native binaries for maturin wheel builds."
726
727
  from .cargo import stage_binaries
727
728
  with _cli_errors():
728
729
  for dest in stage_binaries(Path(path).resolve(), profile or None, target or None, features,
729
- all_features, no_default_features): print(f'Staged {dest}')
730
+ all_features, no_default_features, zig=zig, manylinux=manylinux or None): print(f'Staged {dest}')
730
731
 
731
732
  def _newest(paths):
732
733
  "Newest file mtime among `paths`, walking each directory as `_src_mtime` does"
@@ -790,8 +791,7 @@ def ws_build(
790
791
  artifacts = [('sdist', n, d) for n,d in py]
791
792
  artifacts += [('npm', p['name'], d) for d,p in packages.items() if p.get('name') and p.get('version') and not p.get('private')]
792
793
  artifacts += [('npm', p['name'], d) for d,p in wasm_dists.items() if p.get('name') and p.get('version') and not p.get('private')]
793
- js_closure = {d: _dependency_dirs(d, js_graph)
794
- for d,p in packages.items() if p.get('scripts', {}).get('build')}
794
+ js_closure = {d: _dependency_dirs(d, js_graph) for d, p in packages.items() if p.get('scripts', {}).get('build')}
795
795
  for _, d in py:
796
796
  if nested := [j for j in _js_package_specs(d) if j in js_closure]: js_closure[d] = {d}.union(*(js_closure[j] for j in nested))
797
797
  lock = root/'pnpm-lock.yaml'
@@ -879,8 +879,8 @@ def _local_crates(root: Path) -> list[tuple[dict, Path]]:
879
879
  def _registry_requirements(root: Path) -> set[str]:
880
880
  "Packages that some manifest under `root` requires from crates.io: a version with no `path`, `git`, `registry` or `workspace` key"
881
881
  return {spec.get("package", name) if isinstance(spec, dict) else name
882
- for crate in _crate_dirs(root) for data, _ in _crate_manifests(crate) for deps in _cargo_dep_tables(data, every=True)
883
- for name, spec in deps.items() if isinstance(spec, str) or isinstance(spec, dict) and not {"path", "git", "registry", "workspace"} & spec.keys()}
882
+ for crate in _crate_dirs(root) for data, _ in _crate_manifests(crate) for deps in _cargo_dep_tables(data, every=True)
883
+ for name, spec in deps.items() if isinstance(spec, str) or isinstance(spec, dict) and not {"path", "git", "registry", "workspace"} & spec.keys()}
884
884
 
885
885
  def _git_dep_tables(root: Path, crates: dict[str, Path]) -> dict[str, dict[str, Path]]:
886
886
  "Git URL -> {package: local dir} for members' git deps that name a local crate"
@@ -985,8 +985,7 @@ def _sccache_disk_dir() -> Path:
985
985
  if os.name == "nt": return Path(os.environ.get("LOCALAPPDATA", Path.home()/"AppData/Local"))/"Mozilla/sccache"
986
986
  return Path(os.environ.get("XDG_CACHE_HOME", Path.home()/".cache"))/"sccache"
987
987
 
988
- def _aws_creds_path() -> Path:
989
- return Path(os.environ.get("AWS_SHARED_CREDENTIALS_FILE", Path.home()/".aws/credentials")).expanduser()
988
+ def _aws_creds_path() -> Path: return Path(os.environ.get("AWS_SHARED_CREDENTIALS_FILE", Path.home()/".aws/credentials")).expanduser()
990
989
 
991
990
  def _parse_sccache_r2(url: str) -> dict:
992
991
  "Parse `SCCACHE_R2` (`https://[key:secret@]<acct>.r2.cloudflarestorage.com/<bucket>[/prefix][?rw_mode=READ_ONLY]`)."
@@ -1187,11 +1186,16 @@ def _merge_shared(data: dict, shared: dict) -> dict:
1187
1186
 
1188
1187
  def _rel_ws_path(root: Path, d: Path) -> str: return Path(os.path.relpath(d.resolve(), root.resolve())).as_posix()
1189
1188
 
1189
+ def _maturin_cfg(d: Path) -> dict:
1190
+ p = d/'pyproject.toml'
1191
+ return tomllib.loads(p.read_text()).get('tool', {}).get('maturin', {}) if p.exists() else {}
1192
+
1190
1193
  def _is_maturin_native(d: Path) -> bool:
1191
- if not (d/'pyproject.toml').exists(): return False
1192
- cfg = tomllib.loads((d/'pyproject.toml').read_text()).get('tool', {}).get('maturin', {})
1194
+ cfg = _maturin_cfg(d)
1193
1195
  return 'python-source' in cfg or cfg.get('bindings') == 'bin'
1194
1196
 
1197
+ def _is_bin_with_js(d: Path) -> bool: return (d/'package.json').is_file() and _maturin_cfg(d).get('bindings') == 'bin'
1198
+
1195
1199
  def _repo_roots(root: Path, repos_file="repos.txt") -> list[Path]:
1196
1200
  "Candidate top-level workspace directories plus registered external checkouts."
1197
1201
  exclude = _fastws_cfg(root).get("exclude", [])
@@ -1249,6 +1253,14 @@ def _js_dirs(root: Path, repos_file="repos.txt") -> list[Path]:
1249
1253
  else: res.append(spec[1])
1250
1254
  return list(dict.fromkeys(d.resolve() for d in res if ok(d) and d.resolve() not in superseded_wasm))
1251
1255
 
1256
+ _VP_AGE_EXCLUDES = (
1257
+ ("vite-plus", ("vite-plus", "@voidzero-dev/vite-plus-*")),
1258
+ ("vitest", ("vitest", "@vitest/*")),
1259
+ ("oxlint", ("oxlint", "@oxlint/*")),
1260
+ ("oxfmt", ("oxfmt", "@oxfmt/*")),
1261
+ ("tsrs", ("tsrs", "@tsrs/*")),
1262
+ )
1263
+
1252
1264
  def _sync_ws_pnpm_workspace(root: Path, members: list[Path], toolchain: dict[str, str] = None) -> tuple[list[str], list[str]]:
1253
1265
  "Generate/update `pnpm-workspace.yaml`, applying Vite+ toolchain overrides and merging `pnpm-workspace.shared.yaml`; return `(added, removed)` packages."
1254
1266
  path = root/"pnpm-workspace.yaml"
@@ -1273,6 +1285,10 @@ def _sync_ws_pnpm_workspace(root: Path, members: list[Path], toolchain: dict[str
1273
1285
  else: ov.pop("vitest@*", None)
1274
1286
  if ov: data["overrides"] = ov
1275
1287
  if shared_data: _merge_shared(data, shared_data)
1288
+ if toolchain and data.get("minimumReleaseAge"):
1289
+ ex = [p for k, pats in _VP_AGE_EXCLUDES if toolchain.get(k) for p in pats]
1290
+ if toolchain.get("vite-plus-core") and "@voidzero-dev/vite-plus-*" not in ex: ex.append("@voidzero-dev/vite-plus-core")
1291
+ if ex: data["minimumReleaseAgeExclude"] = ex + [e for e in (data.get("minimumReleaseAgeExclude") or []) if e not in ex]
1276
1292
  cur_after = list(data.get("packages") or [])
1277
1293
  kept = [e for e in cur_after if any(c in e for c in "*?[") or not (root/e).resolve().is_relative_to(root.resolve())]
1278
1294
  new = kept + [e for e in (_rel_ws_path(root, d) for d in members) if e not in kept]
@@ -1289,8 +1305,7 @@ def _sync_ws_package_json(root: Path, toolchain: dict[str, str] = None) -> bool:
1289
1305
  before = json.dumps(data)
1290
1306
  data["private"] = True
1291
1307
  data.pop("workspaces", None)
1292
- if toolchain and (vp_v := toolchain.get("vite-plus")):
1293
- data["devDependencies"] = {**data.get("devDependencies", {}), "vite-plus": vp_v}
1308
+ if toolchain and (vp_v := toolchain.get("vite-plus")): data["devDependencies"] = {**data.get("devDependencies", {}), "vite-plus": vp_v}
1294
1309
  shared = root/"package.json.shared"
1295
1310
  if shared.exists(): _merge_shared(data, json.loads(shared.read_text()))
1296
1311
  if json.dumps(data) == before: return False
@@ -1316,10 +1331,7 @@ def _check_rustup(wasm: bool = False):
1316
1331
  for tool in "rustc","cargo":
1317
1332
  path = shutil.which(tool)
1318
1333
  if path and os.path.samefile(path, rustup): continue
1319
- raise SystemExit(f"Rust-backed WebAssembly builds require rustup-managed Rust, but {tool} resolves to {path or 'nothing'}. "
1320
- "Put rustup's bin directory first on PATH after Homebrew or other toolchain setup in your shell profile "
1321
- '(normally: export PATH="$HOME/.cargo/bin:$PATH"; use $CARGO_HOME/bin when customized). '
1322
- "Homebrew Rust can remain installed. Open a new shell and rerun ws-sync.")
1334
+ raise SystemExit(f"""Rust-backed WebAssembly builds require rustup-managed Rust, but {tool} resolves to {path or 'nothing'}. Put rustup's bin directory first on PATH after Homebrew or other toolchain setup in your shell profile (normally: export PATH="$HOME/.cargo/bin:$PATH"; use $CARGO_HOME/bin when customized). Homebrew Rust can remain installed. Open a new shell and rerun ws-sync.""")
1323
1335
  if wasm:
1324
1336
  installed = subprocess.run([rustup, "target", "list", "--installed"], capture_output=True, text=True, check=True).stdout.splitlines()
1325
1337
  if "wasm32-unknown-unknown" not in installed:
@@ -1327,14 +1339,11 @@ def _check_rustup(wasm: bool = False):
1327
1339
 
1328
1340
  def _check_vp():
1329
1341
  "Require Vite+ (`vp`) and its managed `node` and `pnpm` shims on PATH."
1330
- if not (vp := shutil.which("vp")):
1331
- raise SystemExit("JavaScript workspaces require Vite+ (vp). Run ws-setup to install it.")
1342
+ if not (vp := shutil.which("vp")): raise SystemExit("JavaScript workspaces require Vite+ (vp). Run ws-setup to install it.")
1332
1343
  for tool in "node", "pnpm":
1333
1344
  path = shutil.which(tool)
1334
1345
  if path and os.path.samefile(path, vp): continue
1335
- raise SystemExit(f"JavaScript workspaces require Vite+-managed {tool}, but {tool} resolves to {path or 'nothing'}. "
1336
- "Run ws-setup to enable Vite+ managed shims, and put Vite+'s bin directory first on PATH "
1337
- "(normally via `~/.config/vite-plus/env`), then open a new shell and rerun ws-sync.")
1346
+ raise SystemExit(f"JavaScript workspaces require Vite+-managed {tool}, but {tool} resolves to {path or 'nothing'}. Run ws-setup to enable Vite+ managed shims, and put Vite+'s bin directory first on PATH (normally via `~/.config/vite-plus/env`), then open a new shell and rerun ws-sync.")
1338
1347
 
1339
1348
  def _vp_toolchain() -> dict[str, str]:
1340
1349
  "Versions of `vite-plus`, `vite-plus-core`, and `vitest` from the global `vp` CLI."
@@ -1342,11 +1351,17 @@ def _vp_toolchain() -> dict[str, str]:
1342
1351
  raw = subprocess.run(["vp", "toolchain", "--json", "-g"], capture_output=True, text=True, check=True).stdout
1343
1352
  return {n["id"]: n["version"] for n in json.loads(raw).get("nodes", []) if "id" in n and "version" in n}
1344
1353
 
1345
- def _build_wasm(repo: Path):
1354
+ def _sync_cargo_env(repo: Path) -> dict[str, str] | None:
1355
+ "Disable Cargo incremental compilation for clean repos during sync so sccache can cache workspace crates."
1356
+ if "CARGO_INCREMENTAL" in os.environ: return None
1357
+ g = Git(repo)
1358
+ return {"CARGO_INCREMENTAL": "0"} if g.exists and g.status("--porcelain") == "" else None
1359
+
1360
+ def _build_wasm(repo: Path, env: dict = None):
1346
1361
  "Run `cargo wasm` in `repo` through the workspace's configured Cargo."
1347
1362
  from .cargo import _cargo_command
1348
- cmd, env = _cargo_command("wasm")
1349
- subprocess.run(cmd, cwd=repo, env=env, check=True)
1363
+ cmd, cmd_env = _cargo_command("wasm", env=env)
1364
+ subprocess.run(cmd, cwd=repo, env=cmd_env, check=True)
1350
1365
 
1351
1366
  def _run_quiet(cmd: list[str], cwd: Path):
1352
1367
  "Run `cmd`, hiding routine output on success and printing captured output to stderr on failure."
@@ -1436,12 +1451,18 @@ async def ws_sync(
1436
1451
  _write_pytest_pth(root)
1437
1452
  from .cargo import develop
1438
1453
  native = [d.resolve() for _,d in projects if _is_maturin_native(d)]
1439
- with ThreadPoolExecutor(max_workers=build_workers) as ex: list(ex.map(develop, native))
1454
+ post_js = [d for d in native if _is_bin_with_js(d)]
1455
+ pre_js = [d for d in native if d not in post_js]
1456
+ sync_develop = lambda d: develop(d, env=_sync_cargo_env(d))
1457
+ if pre_js:
1458
+ with ThreadPoolExecutor(max_workers=build_workers) as ex: list(ex.map(sync_develop, pre_js))
1440
1459
  if wasm_pkgs:
1441
- with ThreadPoolExecutor(max_workers=build_workers) as ex: list(ex.map(_build_wasm, wasm_pkgs))
1460
+ with ThreadPoolExecutor(max_workers=build_workers) as ex: list(ex.map(lambda d: _build_wasm(d, env=_sync_cargo_env(d)), wasm_pkgs))
1442
1461
  if up: _upgrade_stamp(root).touch()
1443
1462
  if cargo_up: _upgrade_stamp(root, "fastws-cargo-upgraded").touch()
1444
1463
  if js_members: _sync_js(root, build_workers)
1464
+ if post_js:
1465
+ with ThreadPoolExecutor(max_workers=build_workers) as ex: list(ex.map(sync_develop, post_js))
1445
1466
 
1446
1467
  @call_parse
1447
1468
  async def ws_add(
@@ -89,8 +89,7 @@ async def _repo_news(entry, since, until, commits, model, max_chars):
89
89
  return f'## {name}\n\n{info}\n\n{summary}\n'
90
90
 
91
91
  def _save_checkpoint(path, state):
92
- with tempfile.NamedTemporaryFile(mode='w', dir=path.parent, delete=False) as f:
93
- json.dump(state, f, indent=2)
92
+ with tempfile.NamedTemporaryFile(mode='w', dir=path.parent, delete=False) as f: json.dump(state, f, indent=2)
94
93
  Path(f.name).replace(path)
95
94
 
96
95
  @call_parse(pos=['project'])
@@ -25,7 +25,7 @@ def bounded(
25
25
  env = kwargs.pop('env', None)
26
26
  env = dict(os.environ if env is None else env) | {JOB_ENV: '1'}
27
27
  with subprocess.Popen(cmd, stdin=None if input is None else subprocess.PIPE, stdout=subprocess.PIPE,
28
- stderr=subprocess.STDOUT if merge else subprocess.PIPE, text=True, start_new_session=owner, env=env, **kwargs) as p:
28
+ stderr=subprocess.STDOUT if merge else subprocess.PIPE, text=True, start_new_session=owner, env=env, **kwargs) as p:
29
29
  try:
30
30
  try: out, err = p.communicate(input, timeout=seconds)
31
31
  except BaseException as e:
@@ -36,7 +36,7 @@ def bounded(
36
36
  p.kill()
37
37
  p.wait()
38
38
  out, err = (s.decode(errors='replace') if isinstance(s, bytes) else s or ''
39
- for s in (getattr(e, 'output', ''), getattr(e, 'stderr', '')))
39
+ for s in (getattr(e, 'output', ''), getattr(e, 'stderr', '')))
40
40
  if not isinstance(e, subprocess.TimeoutExpired): raise
41
41
  tail = '\n'.join(f' {line}' for line in (out + (err or '')).splitlines()[-20:])
42
42
  cleanup = 'its process group was killed' if owner else 'its child was killed; the job owner must clean up descendants'
@@ -55,8 +55,7 @@ def _blob(path):
55
55
  def dep_files(artifact):
56
56
  "The files that Cargo's dep-info lists for `artifact`, the `.d` file beside it, with the files under each directory it lists, such as one that a build script watches."
57
57
  deps = re.split(r'(?<!\\)\s+', Path(artifact).with_suffix('.d').read_text().split(': ', 1)[1].strip())
58
- for p in (Path(d.replace('\\ ', ' ')) for d in deps):
59
- yield from (sorted(f for f in p.rglob('*') if f.is_file()) if p.is_dir() else [p])
58
+ for p in (Path(d.replace('\\ ', ' ')) for d in deps): yield from (sorted(f for f in p.rglob('*') if f.is_file()) if p.is_dir() else [p])
60
59
 
61
60
 
62
61
  def _kept(d):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.40
3
+ Version: 0.0.42
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License-Expression: Apache-2.0
@@ -228,7 +228,7 @@ cargo develop --path /path/to/project
228
228
  cargo develop --profile quick
229
229
  ```
230
230
 
231
- Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path`, `bindings` and features from `[tool.maturin]`. `[tool.fastws] dev-profile = "quick"` selects a project's default for both `cargo develop` and `fastws.cargo.run_tests`. Without that setting they use `test`. An explicit `--profile NAME` overrides the project default. Mixed projects must produce a `cdylib` and set `python-source`; `bindings = "bin"` projects build and install their binary targets directly into the active venv. Define the selected profile in `Cargo.toml` and keep incremental compilation enabled for the local crate.
231
+ Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path`, `bindings` and features from `[tool.maturin]`. `[tool.fastws] dev-profile = "quick"` selects a project's default for both `cargo develop` and `fastws.cargo.run_tests`. Without that setting they use `release`. An explicit `--profile NAME` overrides the project default. Mixed projects must produce a `cdylib` and set `python-source`; `bindings = "bin"` projects build and install their binary targets directly into the active venv. Define the selected profile in `Cargo.toml` and keep incremental compilation enabled for the local crate.
232
232
 
233
233
  The workspace's `[tool.fastws] cargo = "/path/to/cargo"` optionally selects one explicit Cargo executable for fastws builds, checks, metadata and tests, including nextest's subordinate Cargo calls. A missing executable fails without falling back. With no selection, subprocess uses its normal PATH and working-directory rules. Upstream Cargo stays installed and usable; manifests, profiles, features and package selection are unchanged.
234
234
 
@@ -267,7 +267,7 @@ cargo stage --profile dist
267
267
  maturin build --profile dist
268
268
  ```
269
269
 
270
- Pass the same target and feature flags to both commands, including `--no-default-features` when needed. Staging builds binaries only. On macOS it matches Maturin's linker flags through `build.rustflags` or existing `RUSTFLAGS`/`CARGO_ENCODED_RUSTFLAGS`. A macOS target with its own `rustflags` must include `-C link-arg=-undefined -C link-arg=dynamic_lookup` there. Shared crates are reused when the two builds resolve the same dependency features. Adding `--lib` to staging can select a different compilation profile under LTO.
270
+ Pass the same target, feature, and Linux glibc flags (`--zig --manylinux 2_31`, `--no-default-features`) to both commands when needed. Staging builds binaries only. On macOS it matches Maturin's linker flags through `build.rustflags` or existing `RUSTFLAGS`/`CARGO_ENCODED_RUSTFLAGS`. A macOS target with its own `rustflags` must include `-C link-arg=-undefined -C link-arg=dynamic_lookup` there. Shared crates are reused when the two builds resolve the same dependency features. Adding `--lib` to staging can select a different compilation profile under LTO.
271
271
 
272
272
  ### `cargo wait`
273
273
 
@@ -288,7 +288,7 @@ Where a root has `.config/nextest.toml`, preparation uses `cargo nextest list` t
288
288
 
289
289
  `root` can also be a list of roots, which build one after another. Roots without nextest then run their binaries in turn. Each profile then runs at the same time in every root whose config defines it: tests in different roots share a phase, and no phase starts before the previous one ends. Suite names start with the root's directory name, and with several profiles also with the profile, as in `app timed: tests/speed.rs`. A failure ends the run after its profile unless `--no-fail-fast` is given.
290
290
 
291
- The default profile is `[tool.fastws].dev-profile`, or `test` when unset. Explicit `--profile NAME`, `--profile=NAME`, `--release` and `-r` override it. Pass Cargo build/selection options positionally, and test filters and harness options in `test_args`. A failed binary stops the run unless `--no-fail-fast` is given. Results contain compiler diagnostics and each binary's outcomes and captured failures.
291
+ The default profile is `[tool.fastws].dev-profile`, or `release` when unset. Explicit `--profile NAME`, `--profile=NAME`, `--release` and `-r` override it. Pass Cargo build/selection options positionally, and test filters and harness options in `test_args`. A failed binary stops the run unless `--no-fail-fast` is given. Results contain compiler diagnostics and each binary's outcomes and captured failures.
292
292
 
293
293
  ```python
294
294
  from fastws.cargo import run_tests
@@ -359,13 +359,13 @@ Fastws discovers JavaScript packages directly under the workspace root, explicit
359
359
 
360
360
  Each sync updates `packages` in the root `pnpm-workspace.yaml` (creating it with `linkWorkspacePackages: deep`, `preferWorkspacePackages: true`, and `minimumReleaseAge: 1440` by default) and maintains `private: true` in the root `package.json`. It preserves external paths, globs, and unrelated settings, and reports added and removed packages.
361
361
 
362
- When JavaScript workspace members are present, `ws-sync` reads `vp toolchain --json -g` and populates `devDependencies["vite-plus"]` in `package.json` plus matching `vite@*` and `vitest@*` entries under `overrides` in `pnpm-workspace.yaml`. Optional tracked `pnpm-workspace.shared.yaml` and `package.json.shared` files are merged on top on every sync. Object-valued fields merge one level deep, shared values win conflicts, and arrays replace rather than concatenate. Unrelated local settings remain; removing a shared key does not delete its local value. Use these files to declare `packageManager`, `devEngines.runtime`, shared policies such as `allowBuilds`, or explicit Vite+ overrides.
362
+ When JavaScript workspace members are present, `ws-sync` reads `vp toolchain --json -g`, writes `devDependencies["vite-plus"]` to `package.json`, sets matching `vite@*` and `vitest@*` entries under `overrides` in `pnpm-workspace.yaml`, and adds those toolchain packages to `minimumReleaseAgeExclude` when `minimumReleaseAge` is enabled. Optional tracked `pnpm-workspace.shared.yaml` and `package.json.shared` files are merged on top on every sync. Object-valued fields merge one level deep, shared values win conflicts, and arrays replace rather than concatenate. Unrelated local settings remain; removing a shared key does not delete its local value. Use these files to declare `packageManager`, `devEngines.runtime`, shared policies such as `allowBuilds`, or explicit Vite+ overrides.
363
363
 
364
364
  Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` and `[tool.uv.config-settings-package]` (`metadata-only = "1"`) with the sorted package names of projects using `fastws.build_backend`, including external checkouts. These builds use the shared environment's `fastws-cli` and `maturin`, skip Rust compilation during editable installs inside the workspace, and keep metadata-only wheels separate from compiled editable wheels in uv's cache. Leave global build isolation enabled for other projects.
365
365
 
366
366
  After `uv sync`, fastws writes `_fastws_pytest.pth` into the workspace venv's `site-packages` to default `PYTEST_DISABLE_PLUGIN_AUTOLOAD=1`, keeping pytest plugins installed for one repo from leaking into others. Repos enable the plugins they need via `-p` in `addopts` (override for a run with `PYTEST_DISABLE_PLUGIN_AUTOLOAD=""`).
367
367
 
368
- After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects, with up to one project per CPU building concurrently by default. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
368
+ After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects without a `package.json`, with up to one project per CPU building concurrently by default. For clean Git checkouts, sync sets `CARGO_INCREMENTAL=0` on `cargo develop` and `cargo wasm` (unless `CARGO_INCREMENTAL` is already set) so `sccache` caches workspace crates; dirty checkouts keep each repo's configured incremental setting. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
369
369
 
370
370
  Strictly after `cargo develop` finishes, fastws runs `cargo wasm` in parallel for every repo declaring `[tool.fastws].wasm-package`, so any `post-develop-module` generators have already produced their assets and each generated `wasm/pkg/package.json` exists before JavaScript installation.
371
371
 
@@ -373,6 +373,8 @@ Fastws then runs `vp install` at the workspace root (driving pnpm underneath). N
373
373
 
374
374
  After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N> run build` (through Vite+'s managed pnpm) so local dependencies build before their consumers and independent builds share the project-concurrency limit. Packages own their build commands: AnswerUI's is `nbdev-export`, for example. Python sync runs first, so a repo-list entry such as `AnswerDotAI/answerui[dev]` supplies its Python build tools through the normal extras mechanism. No additional install lifecycle hook is needed. Cargo and other build tools retain their own incremental behavior.
375
375
 
376
+ After the JavaScript builds finish, fastws runs `cargo develop` in `bindings = "bin"` Rust projects that also have a `package.json`, using the same concurrency limit. Binaries that embed built frontend assets then compile against the updated outputs.
377
+
376
378
  `--build-workers` sets the maximum concurrent projects within the Python-native, WebAssembly, and JavaScript build phases, defaulting to the CPU count; `--build-workers 1` runs each phase serially. It is separate from `--workers`, which controls cloning, pulling and dependency updates. Cargo keeps its own within-project parallelism, so increasing project concurrency also increases CPU and memory demand. Cargo may serialize builds that share a target directory.
377
379
 
378
380
  When JavaScript workspaces are present, fastws requires Vite+ (`vp`) on `PATH` with managed `node` and `pnpm` shims active. When WebAssembly packages (`[tool.fastws].wasm-package`) are present, fastws also requires rustup's `rustc`/`cargo` proxies and the `wasm32-unknown-unknown` target. Run `ws-setup` to install or configure any missing prerequisites.
@@ -1,5 +1,5 @@
1
1
  import json, shutil, subprocess, tarfile, pytest, fastws.core as core
2
- from fastws.cargo import build, check, run_tests, Suite
2
+ from fastws.cargo import build, check, run_tests, Suite, _zig_target
3
3
  from pathlib import Path
4
4
 
5
5
 
@@ -8,7 +8,7 @@ def _mk_proj(root, name, extra=''):
8
8
  d.mkdir()
9
9
  (d/'pyproject.toml').write_text(fr'''[project]
10
10
  name = "{name}"
11
- {extra}
11
+ {extra}
12
12
  ''')
13
13
  return d
14
14
 
@@ -56,10 +56,8 @@ def _write_cached_vp_shared(root):
56
56
  vp = Path(shutil.which('vp')).resolve().parent.parent
57
57
  pm = json.loads((vp/'package.json').read_text())['packageManager']
58
58
  node_vers = sorted(p.name for p in (vp.parent/'js_runtime'/'node').iterdir() if p.is_dir())
59
- (root/'package.json.shared').write_text(json.dumps({
60
- 'packageManager': pm,
61
- 'devEngines': {'runtime': {'name': 'node', 'version': node_vers[-1]}},
62
- }))
59
+ (root / 'package.json.shared').write_text(json.dumps({'packageManager': pm,
60
+ 'devEngines': {'runtime': {'name': 'node', 'version': node_vers[-1]}}}))
63
61
 
64
62
 
65
63
 
@@ -101,13 +99,12 @@ const version = fs.readFileSync('../pnpm-lock.yaml', 'utf8').match(/theme@([^\s:
101
99
  fs.writeFileSync('dist/style.txt', fs.readFileSync('../styles/generated.txt', 'utf8') + ':' + version);
102
100
  console.log('bundled app');
103
101
  ''')
104
- style_pkg = {'name':'@example/styles', 'version':'0.1.0', 'files':['generated.txt'], 'scripts':{'build':'node build.js'}}
102
+ style_pkg = dict(name='@example/styles', version='0.1.0', files=['generated.txt'], scripts={'build':'node build.js'})
105
103
  (styles/'package.json').write_text(json.dumps(style_pkg))
106
- (app/'package.json').write_text(json.dumps({'name':'@example/app', 'version':'0.1.0', 'files':['dist'],
107
- 'dependencies':{'@example/styles':'^0.1.0'}, 'scripts':{'build':'node build.js'}}))
104
+ (app/'package.json').write_text(json.dumps(dict(name='@example/app', version='0.1.0', files=['dist'], dependencies={'@example/styles':'^0.1.0'}, scripts={'build':'node build.js'})))
108
105
  (app/'frontend').mkdir()
109
- (app/'frontend'/'package.json').write_text(json.dumps({'name':'priv-fe', 'version':'0.0.0', 'private':True,
110
- 'scripts':{'build': 'node -e "require(\'node:fs\').writeFileSync(\'built.txt\', \'ok\')"'}}))
106
+ (app/'frontend'/'package.json').write_text(json.dumps(dict(name='priv-fe', version='0.0.0', private=True,
107
+ scripts={'build': 'node -e "require(\'node:fs\').writeFileSync(\'built.txt\', \'ok\')"'})))
111
108
  _write_cached_vp_shared(tmp_path)
112
109
  core._sync_ws_pnpm_workspace(tmp_path, core._js_dirs(tmp_path))
113
110
  core._sync_ws_package_json(tmp_path)
@@ -264,7 +261,7 @@ default-filter = "rdeps(optional)"
264
261
  r = run_tests([a, b], profiles=('one', 'two'))
265
262
  tests = {s.name: s.tests for s in r.suites if s.tests}
266
263
  assert not r.ok and tests == {'a one: unittests src/lib.rs': {'t::passes': 'ok'}, 'a one: tests/more.rs': {'other': 'ok'},
267
- 'b one: tests/fine.rs': {'fine': 'ok'}, 'a two: unittests src/lib.rs': {'t::fails': 'FAILED'}}, r.text
264
+ 'b one: tests/fine.rs': {'fine': 'ok'}, 'a two: unittests src/lib.rs': {'t::fails': 'FAILED'}}, r.text
268
265
  first = run_tests([a, b], profiles=('two', 'one'))
269
266
  assert not first.ok and {s.name for s in first.suites if s.tests} == {'a two: unittests src/lib.rs'}
270
267
 
@@ -278,3 +275,12 @@ def test_captured_test_output():
278
275
  lines.append(f'test result: {"FAILED" if failed else "ok"}. 1 passed; {int(failed)} failed; 0 ignored')
279
276
  s = Suite.read('unit', lines, int(failed))
280
277
  assert s.failures == ({'fails': 'broken'} if failed else {}) and 'printed' in s.output
278
+
279
+
280
+ def test_zig_target():
281
+ t = 'x86_64-unknown-linux-gnu'
282
+ assert _zig_target(t, '2_31') == _zig_target(t, '2.31') == _zig_target(t, 'manylinux_2_31') == f'{t}.2.31'
283
+ assert _zig_target(t, 'manylinux2014') == f'{t}.2.17'
284
+ assert _zig_target(f'{t}.2.17', '2_31') == f'{t}.2.17'
285
+ assert _zig_target('aarch64-apple-darwin', '2_31') == 'aarch64-apple-darwin'
286
+ assert _zig_target(t, 'off') == _zig_target(t, 'auto') == _zig_target(t, 'musllinux_1_2') == t
@@ -11,9 +11,12 @@ def test_snapshot_takes_the_working_tree_and_leaves_head_and_index(tmp_path):
11
11
  git(tmp_path, "init", "-q")
12
12
  (tmp_path/".gitignore").write_text("ignored\n")
13
13
  (tmp_path/"kept").write_text("old")
14
- git(tmp_path, "add", "-A"); git(tmp_path, "-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "base")
14
+ git(tmp_path, "add", "-A")
15
+ git(tmp_path, "-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "base")
15
16
  head = git(tmp_path, "rev-parse", "HEAD")
16
- (tmp_path/"kept").write_text("new"); (tmp_path/"untracked").write_text("u"); (tmp_path/"ignored").write_text("i")
17
+ (tmp_path/"kept").write_text("new")
18
+ (tmp_path/"untracked").write_text("u")
19
+ (tmp_path/"ignored").write_text("i")
17
20
  commit = snapshot(tmp_path)
18
21
  assert git(tmp_path, "show", f"{commit}:kept") == "new"
19
22
  assert git(tmp_path, "show", f"{commit}:untracked") == "u"
@@ -1,4 +1,4 @@
1
- import fcntl, os, subprocess, sys, threading, pytest
1
+ import fcntl, os, subprocess, sys, threading
2
2
  from fastws.procs import JOB_ENV, kill_group
3
3
 
4
4
 
@@ -24,7 +24,7 @@ print('job survived inner timeout', flush=True)
24
24
  time.sleep(60)
25
25
  '''
26
26
  with subprocess.Popen([sys.executable, '-c', job], start_new_session=True, env=os.environ | {JOB_ENV: '1'},
27
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) as p:
27
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) as p:
28
28
  lines, survived = [], threading.Event()
29
29
  def read():
30
30
  for line in p.stdout:
@@ -16,7 +16,8 @@ def test_setup_preserves_existing_destinations(tmp_path):
16
16
 
17
17
  def test_sccache_config_merge_and_schema(tmp_path):
18
18
  ws1, ws2 = tmp_path/'ws1', tmp_path/'ws2'
19
- ws1.mkdir(); ws2.mkdir()
19
+ ws1.mkdir()
20
+ ws2.mkdir()
20
21
  existing = 'server_startup_timeout_ms = 5000\n\n[dist]\nscheduler_url = "http://1.2.3.4:10600"\n'
21
22
  spec = core._parse_sccache_r2('https://r2id:r2sec@acct.r2.cloudflarestorage.com/aai-sccache')
22
23
  rendered = core._render_sccache_config(ws1, spec, existing)
@@ -27,7 +28,7 @@ def test_sccache_config_merge_and_schema(tmp_path):
27
28
  assert data['basedirs'] == [str(ws1.resolve()), str(ws2.resolve())]
28
29
  pub = core._render_sccache_config(ws1, core._parse_sccache_r2('https://acct.r2.cloudflarestorage.com/pub/pfx'), '')
29
30
  if os.name != 'nt' and (sc := shutil.which('sccache')):
30
- env = {'PATH': os.environ['PATH'], 'HOME': str(tmp_path), 'SCCACHE_SERVER_UDS': str(tmp_path/'sc.sock')}
31
+ env = dict(PATH=os.environ['PATH'], HOME=str(tmp_path), SCCACHE_SERVER_UDS=str(tmp_path/'sc.sock'))
31
32
  for name, text in (('auth', merged), ('pub', pub)):
32
33
  cfg = tmp_path/f'{name}.toml'
33
34
  cfg.write_text(text)
@@ -1,4 +1,4 @@
1
- import json, os, subprocess, sys, pytest
1
+ import json, os, subprocess, pytest
2
2
  from fastgit import Git
3
3
  import fastws.core as core
4
4
 
@@ -80,8 +80,12 @@ def test_invalid_repo_extras(entry):
80
80
 
81
81
  def test_sync_extras_preserves_constraints_markers_and_unrelated_settings(tmp_path):
82
82
  pyproject = tmp_path/'pyproject.toml'
83
- pyproject.write_text('[project]\nname = "ws"\ndependencies = [\'My_Pkg[old]>=1; python_version >= "3.10"\', "other[keep]"]\n'
84
- '[tool.uv.sources]\nMy_Pkg = { path = "../somewhere", editable = true }\n')
83
+ pyproject.write_text('''[project]
84
+ name = "ws"
85
+ dependencies = ['My_Pkg[old]>=1; python_version >= "3.10"', "other[keep]"]
86
+ [tool.uv.sources]
87
+ My_Pkg = { path = "../somewhere", editable = true }
88
+ ''')
85
89
  for extras in ({'dev', 'test'}, set()):
86
90
  core._sync_ws_pyproject(pyproject, tmp_path/'pyproject.tmpl', ['my-pkg'], extras={'my-pkg': extras})
87
91
  data = core.tomllib.loads(pyproject.read_text())
@@ -140,18 +144,42 @@ def test_ws_remove_refuses_unsafe_repos(tmp_path):
140
144
  def test_sync_cargo_patches_generates_and_preserves(tmp_path):
141
145
  (tmp_path/'.cargo').mkdir()
142
146
  config = tmp_path/'.cargo'/'config.toml'
143
- config.write_text('[term]\nquiet = true\n\n[patch.crates-io]\n'
144
- f'foreign = {{ path = "/elsewhere/foreign" }}\ngone = {{ path = "{tmp_path}/gone" }}\n')
147
+ config.write_text(f'''[term]
148
+ quiet = true
149
+
150
+ [patch.crates-io]
151
+ foreign = {{ path = "/elsewhere/foreign" }}
152
+ gone = {{ path = "{tmp_path}/gone" }}
153
+ ''')
145
154
  config.write_text(core._replace_table(config.read_text(), 'unstable', 'checksum-freshness = true'))
146
155
  crate1, helper = tmp_path/'crate1', tmp_path/'helper'
147
- crate1.mkdir(); helper.mkdir()
148
- (crate1/'Cargo.toml').write_text('[package]\nname = "crate1"\nversion = "0.1.0"\n\n[dependencies]\nfamily = { git = "https://example.com/family" }\n'
149
- '\n[dev-dependencies]\nfamily-sub = { version = "0.1" }\n')
156
+ crate1.mkdir()
157
+ helper.mkdir()
158
+ (crate1/'Cargo.toml').write_text('''[package]
159
+ name = "crate1"
160
+ version = "0.1.0"
161
+
162
+ [dependencies]
163
+ family = { git = "https://example.com/family" }
164
+
165
+ [dev-dependencies]
166
+ family-sub = { version = "0.1" }
167
+ ''')
150
168
  (helper/'Cargo.toml').write_text('[package]\nname = "helper"\nversion = "0.1.0"\n')
151
169
  family = tmp_path/'family'
152
170
  (family/'sub').mkdir(parents=True)
153
- (family/'Cargo.toml').write_text('[package]\nname = "family"\nversion = "0.1.0"\npublish = false\n\n[workspace]\nmembers = ["sub"]\n'
154
- '\n[workspace.dependencies]\nhelper = "0.1"\ncrate1 = { path = "../crate1", version = "0.1" }\n')
171
+ (family/'Cargo.toml').write_text('''[package]
172
+ name = "family"
173
+ version = "0.1.0"
174
+ publish = false
175
+
176
+ [workspace]
177
+ members = ["sub"]
178
+
179
+ [workspace.dependencies]
180
+ helper = "0.1"
181
+ crate1 = { path = "../crate1", version = "0.1" }
182
+ ''')
155
183
  (family/'sub'/'Cargo.toml').write_text('[package]\nname = "family-sub"\nversion = "0.1.0"\n')
156
184
 
157
185
  added, removed = core._sync_cargo_patches(tmp_path, root_dir=True)
@@ -184,12 +212,13 @@ def test_sync_ws_pnpm_workspace_and_package_json(tmp_path):
184
212
  core._sync_ws_pnpm_workspace(tmp_path, [tmp_path/'app'], toolchain=tc)
185
213
  assert core._yaml_load(ws)['overrides'] == {'keep': '1.0.0', 'vite@*': 'npm:@voidzero-dev/vite-plus-core@8.4.0', 'vitest@*': '5.2.0'}
186
214
 
187
- ws_shared.write_text('allowBuilds:\n esbuild: true\noverrides:\n vite: npm:@voidzero-dev/vite-plus-core@8.3.8000\n vitest: 5.1.0\n')
215
+ ws_shared.write_text('allowBuilds:\n esbuild: true\nminimumReleaseAgeExclude:\n - custom-pkg\noverrides:\n vite: npm:@voidzero-dev/vite-plus-core@8.3.8000\n vitest: 5.1.0\n')
188
216
  core._sync_ws_pnpm_workspace(tmp_path, [tmp_path/'app'], toolchain=tc)
189
- assert core._yaml_load(ws)['overrides'] == {'keep': '1.0.0', 'vite': 'npm:@voidzero-dev/vite-plus-core@8.3.8000', 'vitest': '5.1.0'}
217
+ assert core._yaml_load(ws)['overrides'] == dict(keep='1.0.0', vite='npm:@voidzero-dev/vite-plus-core@8.3.8000', vitest='5.1.0')
218
+ assert core._yaml_load(ws)['minimumReleaseAgeExclude'] == ['vite-plus', '@voidzero-dev/vite-plus-*', 'vitest', '@vitest/*', 'custom-pkg']
190
219
 
191
220
  pkg, pkg_shared = tmp_path/'package.json', tmp_path/'package.json.shared'
192
- pkg.write_text(json.dumps({'name': 'local', 'workspaces': ['stale'], 'devDependencies': {'keep': '1'}}))
221
+ pkg.write_text(json.dumps(dict(name='local', workspaces=['stale'], devDependencies={'keep': '1'})))
193
222
  pkg_shared.write_text(json.dumps({'packageManager': 'pnpm@10.34.9'}))
194
223
  assert core._sync_ws_package_json(tmp_path, toolchain=tc) is True
195
224
  out = json.loads(pkg.read_text())
@@ -206,7 +235,8 @@ def test_sync_build_backend(tmp_path):
206
235
  ws = tmp_path/'pyproject.toml'
207
236
  ws.write_text('[project]\nname = "ws"\n\n[tool.uv.config-settings-package]\na = { "maturin.build-args" = ["--features", "x"] }\nb = { metadata-only = "1", custom = "yes" }\ngone = { metadata-only = "1" }\n')
208
237
  a, b = tmp_path/'a', tmp_path/'b'
209
- a.mkdir(); b.mkdir()
238
+ a.mkdir()
239
+ b.mkdir()
210
240
  (a/'pyproject.toml').write_text('[build-system]\nbuild-backend = "fastws.build_backend"\n[project]\nname = "a"\n')
211
241
  (b/'pyproject.toml').write_text('[build-system]\nbuild-backend = "maturin"\n[project]\nname = "b"\n')
212
242
  core._sync_build_backend(ws, [('a', a), ('b', b)])
@@ -13,7 +13,8 @@ def test_shared_hold_outlives_other_thread(tmp_path, monkeypatch):
13
13
  t = threading.Thread(target=hold, daemon=True)
14
14
  try:
15
15
  with timelock.timing_lock():
16
- t.start(); assert held.wait(3)
16
+ t.start()
17
+ assert held.wait(3)
17
18
  with open(timelock.LOCK) as f, pytest.raises(BlockingIOError): fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
18
19
  finally:
19
20
  release.set()
File without changes
File without changes
File without changes
File without changes