fastws-cli 0.0.38__tar.gz → 0.0.40__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 (33) hide show
  1. {fastws_cli-0.0.38/fastws_cli.egg-info → fastws_cli-0.0.40}/PKG-INFO +27 -16
  2. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/README.md +26 -15
  3. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/__init__.py +3 -1
  4. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/build_backend.py +11 -6
  5. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/cargo.py +21 -14
  6. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/core.py +288 -116
  7. {fastws_cli-0.0.38 → fastws_cli-0.0.40/fastws_cli.egg-info}/PKG-INFO +27 -16
  8. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/tests/test_build.py +0 -40
  9. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/tests/test_build_backend.py +2 -2
  10. fastws_cli-0.0.40/tests/test_setup.py +35 -0
  11. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/tests/test_sync.py +25 -37
  12. fastws_cli-0.0.38/tests/test_setup.py +0 -15
  13. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/LICENSE +0 -0
  14. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/_toml.py +0 -0
  15. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/integrate.py +0 -0
  16. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/news.py +0 -0
  17. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/procs.py +0 -0
  18. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/releases.py +0 -0
  19. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/store.py +0 -0
  20. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws/timelock.py +0 -0
  21. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws_cli.egg-info/SOURCES.txt +0 -0
  22. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws_cli.egg-info/dependency_links.txt +0 -0
  23. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws_cli.egg-info/entry_points.txt +0 -0
  24. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws_cli.egg-info/requires.txt +0 -0
  25. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/fastws_cli.egg-info/top_level.txt +0 -0
  26. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/pyproject.toml +0 -0
  27. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/setup.cfg +0 -0
  28. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/tests/test_integrate.py +0 -0
  29. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/tests/test_news.py +0 -0
  30. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/tests/test_procs.py +0 -0
  31. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/tests/test_releases.py +0 -0
  32. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/tests/test_store.py +0 -0
  33. {fastws_cli-0.0.38 → fastws_cli-0.0.40}/tests/test_timelock.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.38
3
+ Version: 0.0.40
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License-Expression: Apache-2.0
@@ -103,7 +103,7 @@ Keep `repos.txt` tracked in the workspace Git repo. Put personal additions in a
103
103
 
104
104
  `--repos-file myrepos.txt` uses `myrepos-local.txt` alongside it. Either list may be absent. Removing a repo from the baseline does not delete its checkout. The next sync discovers an existing root checkout as a personal addition unless `[tool.fastws].exclude` matches its path. External checkouts also remain on disk; add them to the local list to keep managing them.
105
105
 
106
- The workspace `pyproject.toml` is local generated state. `ws-sync` creates it from the tracked `pyproject.tmpl` when available, or generates a minimal one, then maintains it while preserving personal settings except for the managed repo extras, workspace exclusions, and build-isolation list. The template supplies starting defaults only: later template edits do not overwrite existing configuration. Ignore these files in the workspace repo (not in its member repos):
106
+ The workspace `pyproject.toml` is local generated state. `ws-sync` creates it from the tracked `pyproject.tmpl` when available, or generates a minimal one, then maintains it while preserving personal settings except for the managed repo extras, workspace exclusions, build-isolation list, and `metadata-only` backend config settings. The template supplies starting defaults only: later template edits do not overwrite existing configuration. Ignore these files in the workspace repo (not in its member repos):
107
107
 
108
108
  ```gitignore
109
109
  /repos-local.txt
@@ -116,6 +116,7 @@ The workspace `pyproject.toml` is local generated state. `ws-sync` creates it fr
116
116
  /uv.lock
117
117
  /.cargo/
118
118
  /.fastws-upgraded
119
+ /.fastws-cargo-upgraded
119
120
  ```
120
121
 
121
122
  Keep project checkouts out of the workspace Git index too. When migrating a workspace that already tracks generated files, save local copies before pulling the change that untracks them, then restore those copies afterward. Also save personal repo entries to `repos-local.txt` before pulling a smaller baseline.
@@ -139,16 +140,28 @@ echo source ~/aai-ws/.venv/bin/activate >> ~/.bashrc
139
140
 
140
141
  ### `ws-setup`
141
142
 
142
- Clone a workspace repo into a new directory, create its `.venv`, install fastws, and run that environment's `ws-sync`. It targets the new environment even when another workspace or uv tool environment is already active. It does not change the caller's environment, shell startup files, or harness settings.
143
+ Bootstrap a new workspace, or check an existing workspace and complete any missing toolchain and `sccache` setup.
143
144
 
144
145
  ```bash
145
- ws-setup AnswerDotAI/aai-ws ~/aai-ws
146
- ws-setup AnswerDotAI/private-ws ~/aai-ws
147
- ws-setup owner/workspace ~/my-workspace --python 3.13
146
+ ws-setup # check/configure the active workspace
147
+ ws-setup --workspace ~/aai-ws # check/configure a specific workspace
148
+ ws-setup AnswerDotAI/aai-ws ~/aai-ws # bootstrap a new workspace
148
149
  ws-setup AnswerDotAI/private-ws ~/aai-ws --workers 8
150
+ ws-setup owner/workspace ~/my-workspace --python 3.13
149
151
  ```
150
152
 
151
- The destination must not exist, including as an empty directory or a symlink. A failed step stops setup and leaves the checkout in place for inspection; it never deletes a partial workspace automatically. For an existing workspace, activate its environment and use `ws-sync` instead. Workspace repos should include fastws in their repo list or package dependencies so syncing retains the workspace commands.
153
+ With `repo` and `dest`, `ws-setup` clones the workspace repo into a new directory (which must not exist, including as an empty directory or symlink), creates its `.venv`, installs fastws, clones the workspace repos, installs any missing Rust/WebAssembly/JavaScript prerequisites and `sccache` config, and runs that environment's `ws-sync`. It targets the new environment even when another workspace or uv tool environment is already active, and never changes shell startup files or harness settings. A failed step leaves the checkout in place for inspection.
154
+
155
+ With no `repo`, `ws-setup` inspects the existing workspace and completes any missing steps idempotently: installing `rustup` and `wasm32-unknown-unknown` when Rust/WebAssembly packages are present, installing `sccache`, installing Vite+ (`vp`) and enabling its managed `node`/`pnpm` shims when JavaScript packages are present, and configuring `sccache` when `SCCACHE_R2` is set.
156
+
157
+ Set `SCCACHE_R2` to a single R2 URL to configure multilevel local-disk + Cloudflare R2 `sccache` caching:
158
+
159
+ ```bash
160
+ export SCCACHE_R2="https://<access_key_id>:<secret_access_key>@<account_id>.r2.cloudflarestorage.com/<bucket>"
161
+ ws-setup
162
+ ```
163
+
164
+ `ws-setup` writes `[cache.multilevel]` (`disk` + `s3`), `[cache.disk]`, `[cache.s3]`, and the workspace root under `basedirs` into the platform `sccache` config (`~/Library/Application Support/Mozilla.sccache/config` on macOS, `~/.config/sccache/config` on Linux, or `SCCACHE_CONF`), preserving existing `basedirs` and unrelated sections. Credentials are written to an isolated `[r2-sccache]` profile in `~/.aws/credentials` (leaving `[default]` untouched), and `.cargo/rustc-lock` selects that profile for `sccache`. Append `?rw_mode=READ_ONLY` for read-only tokens, omit credentials for public read-only buckets, or add `/<prefix>` after `<bucket>` for a `key_prefix`.
152
165
 
153
166
  ### `ws-clone`
154
167
 
@@ -215,7 +228,7 @@ cargo develop --path /path/to/project
215
228
  cargo develop --profile quick
216
229
  ```
217
230
 
218
- Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path` 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. The project must produce a `cdylib` and set `python-source`. 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 `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.
219
232
 
220
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.
221
234
 
@@ -243,7 +256,7 @@ On Unix, cooperating `cargo develop` runs take a per-project lock through compil
243
256
 
244
257
  On Unix, every rustc call holds a shared `flock` on `/tmp/aai-ws-timing.lock`, through the rustc wrapper that sync writes (see `ws-sync`). A speed test that takes that lock exclusively stays apart from participating builds and test runs. A timing also holds `/tmp/aai-ws-timing.gate` while it waits for the lock and holds it, and a shared hold passes that file first, so new rustc calls and test runs wait behind the timing. Both shared and exclusive acquisition fail after 5 minutes; work never proceeds unlocked. Python code takes the same lock with `fastws.timelock.timing_lock`: `with timing_lock(exclusive=True):` around a timing, and `with timing_lock():` around a test run. Shared-inside-shared in one thread reuses its hold; each thread otherwise takes its own hold. Any nesting involving exclusive raises `RuntimeError` immediately. An exclusive hold that has waited 30 seconds prints the processes that have the lock's file open. Windows builds and tests run without this timing coordination.
245
258
 
246
- Use `fastws.build_backend` as the build backend of a mixed project, and include `fastws-cli>=0.0.29` alongside `maturin>=1.13,<2.0` in `[build-system].requires`. Its editable builds install only Python metadata and the source path, and compile no Rust. `ws-sync` then runs `cargo develop` to build and install the extension, the binaries and the wheel data files. After standalone `uv sync`, run `cargo develop` yourself.
259
+ Use `fastws.build_backend` as the build backend of a mixed Rust/Python project (with `fastws-cli>=0.0.29` alongside `maturin>=1.13,<2.0` in `[build-system].requires`) or a `bindings = "bin"` Rust CLI project (`fastws-cli>=0.0.39`). Inside a fastws workspace, `ws-sync` writes `[tool.uv.config-settings-package]` with `metadata-only = "1"` into the workspace `pyproject.toml`, so editable builds through `uv sync` install only Python metadata (and the source path when `python-source` is set) and leave Rust compilation to `cargo develop`, which installs the extension, binaries, and wheel data files. Outside the workspace, including `pip install -e .` in CI and standalone installs, editable builds receive no `metadata-only` setting, stage any `native-binaries`, and delegate to maturin so they compile normally.
247
260
 
248
261
  For distribution wheels containing the binaries, also set `[tool.maturin].data` to a generated wheel-data directory. With `native-binaries = true`, wheel builds through the backend replace its `scripts/` subdirectory with the current Python-free binaries, then delegate packaging to maturin. Explicit profile, target and feature arguments from maturin's build settings also apply to the binaries. Without `native-binaries`, wheel builds go straight to maturin, and `[tool.maturin].data` is optional.
249
262
 
@@ -338,7 +351,7 @@ Sync also defaults `[term] quiet = true` in that file to suppress routine Cargo
338
351
 
339
352
  Do not commit a `Cargo.lock` generated under these patches. Its source-less local entries cannot be resolved on another machine.
340
353
 
341
- Sync writes `.cargo/rustc-lock` and makes it Cargo's `rustc-wrapper`. The script runs each rustc call holding the timing lock shared (see `cargo develop` above). Inside the lock it runs the wrapper that the config named before sync first wrote the script, where another tool set one, and otherwise `sccache` when it's installed, so unchanged compilation units are reused across the workspace's otherwise-independent Cargo target directories. Later syncs keep that inner wrapper. The script costs about 9 ms a rustc call, mostly the Python interpreter's start. If `sccache` isn't installed, sync warns with the install command (`cargo install sccache --locked`) and continues; rerun `ws-sync` after installing to enable it. On Windows, where the lock does nothing, the config keeps another tool's wrapper, or else names `sccache`.
354
+ Sync writes `.cargo/rustc-lock` and makes it Cargo's `rustc-wrapper`. The script runs each rustc call holding the timing lock shared (see `cargo develop` above). Inside the lock it runs the wrapper that the config named before sync first wrote the script, where another tool set one, and otherwise `sccache` when it's installed, so unchanged compilation units are reused across the workspace's otherwise-independent Cargo target directories. When `ws-setup` has configured an isolated `r2-sccache` AWS credentials profile for a shared R2 cache, the script passes `AWS_PROFILE=r2-sccache` to `sccache` (clearing ambient `AWS_*` keys in that child process) so it never collides with AWS CLI or `boto3`. Later syncs keep that inner wrapper. The script costs about 9 ms a rustc call, mostly the Python interpreter's start. If `sccache` isn't installed—or `SCCACHE_R2` is set without matching `sccache` config—sync warns and tells you to run `ws-setup`. On Windows, where the lock does nothing, the config keeps another tool's wrapper, or else names `sccache`.
342
355
 
343
356
  For an isolated build workspace, `fastws.core.cargo_setup(root)` regenerates these Cargo patches and the same compiler wrapper without pulling, syncing Python or building.
344
357
 
@@ -348,11 +361,11 @@ Each sync updates `packages` in the root `pnpm-workspace.yaml` (creating it with
348
361
 
349
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.
350
363
 
351
- Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` 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`. Leave global build isolation enabled for other projects.
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.
352
365
 
353
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=""`).
354
367
 
355
- After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python 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. Maturin packages with `bindings = "bin"` keep their existing uv installation path.
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.
356
369
 
357
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.
358
371
 
@@ -362,11 +375,9 @@ After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N
362
375
 
363
376
  `--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.
364
377
 
365
- When JavaScript workspaces are present, fastws requires Vite+ (`vp`) on `PATH` with managed `node` and `pnpm` shims active (`curl -fsSL https://vite.plus | bash`, with Vite+'s bin directory ahead of Homebrew on `PATH`). When WebAssembly packages (`[tool.fastws].wasm-package`) are present, fastws also requires rustup's `rustc`/`cargo` proxies and the `wasm32-unknown-unknown` target (`rustup target add wasm32-unknown-unknown`).
366
-
367
- At most once per day, sync upgrades dependencies with `uv sync -U` and a parallel `cargo update` in every member with a `Cargo.toml`. It prints the changes and records the run in a stamp file inside the workspace's `.git` directory. Pass `--upgrade` to force an upgrade regardless of the last run time.
378
+ 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.
368
379
 
369
- Before every uv sync, `ws-sync` writes `.git/fastws-cargo-key` for each member crate. The key hashes `Cargo.lock` contents and the workspace Cargo patch configuration. For Git dependencies redirected to local paths by `[patch."<url>"]`, it also hashes each patched crate's `Cargo.toml`, `build.rs`, and `src` tree, recursively. The file is rewritten only when that content changes, so projects can use `{ file = ".git/fastws-cargo-key" }` in `tool.uv.cache-keys` without rebuilding after a timestamp-only `Cargo.lock` write.
380
+ At most once per day, sync upgrades Python dependencies with `uv sync -U`. At most once every seven days, when Rust crates are present, it updates the stable toolchain with `rustup update stable` (if `rustup` is on `PATH` and no `rust-toolchain.toml` or `rust-toolchain` exists at the workspace root) and runs a parallel `cargo update` in every member with a `Cargo.toml`. It prints the changes and records each run in its own stamp file inside the workspace's `.git` directory (`fastws-upgraded` and `fastws-cargo-upgraded`). Pass `--upgrade` to force both upgrades regardless of the last run time.
370
381
 
371
382
  ```bash
372
383
  ws-sync
@@ -74,7 +74,7 @@ Keep `repos.txt` tracked in the workspace Git repo. Put personal additions in a
74
74
 
75
75
  `--repos-file myrepos.txt` uses `myrepos-local.txt` alongside it. Either list may be absent. Removing a repo from the baseline does not delete its checkout. The next sync discovers an existing root checkout as a personal addition unless `[tool.fastws].exclude` matches its path. External checkouts also remain on disk; add them to the local list to keep managing them.
76
76
 
77
- The workspace `pyproject.toml` is local generated state. `ws-sync` creates it from the tracked `pyproject.tmpl` when available, or generates a minimal one, then maintains it while preserving personal settings except for the managed repo extras, workspace exclusions, and build-isolation list. The template supplies starting defaults only: later template edits do not overwrite existing configuration. Ignore these files in the workspace repo (not in its member repos):
77
+ The workspace `pyproject.toml` is local generated state. `ws-sync` creates it from the tracked `pyproject.tmpl` when available, or generates a minimal one, then maintains it while preserving personal settings except for the managed repo extras, workspace exclusions, build-isolation list, and `metadata-only` backend config settings. The template supplies starting defaults only: later template edits do not overwrite existing configuration. Ignore these files in the workspace repo (not in its member repos):
78
78
 
79
79
  ```gitignore
80
80
  /repos-local.txt
@@ -87,6 +87,7 @@ The workspace `pyproject.toml` is local generated state. `ws-sync` creates it fr
87
87
  /uv.lock
88
88
  /.cargo/
89
89
  /.fastws-upgraded
90
+ /.fastws-cargo-upgraded
90
91
  ```
91
92
 
92
93
  Keep project checkouts out of the workspace Git index too. When migrating a workspace that already tracks generated files, save local copies before pulling the change that untracks them, then restore those copies afterward. Also save personal repo entries to `repos-local.txt` before pulling a smaller baseline.
@@ -110,16 +111,28 @@ echo source ~/aai-ws/.venv/bin/activate >> ~/.bashrc
110
111
 
111
112
  ### `ws-setup`
112
113
 
113
- Clone a workspace repo into a new directory, create its `.venv`, install fastws, and run that environment's `ws-sync`. It targets the new environment even when another workspace or uv tool environment is already active. It does not change the caller's environment, shell startup files, or harness settings.
114
+ Bootstrap a new workspace, or check an existing workspace and complete any missing toolchain and `sccache` setup.
114
115
 
115
116
  ```bash
116
- ws-setup AnswerDotAI/aai-ws ~/aai-ws
117
- ws-setup AnswerDotAI/private-ws ~/aai-ws
118
- ws-setup owner/workspace ~/my-workspace --python 3.13
117
+ ws-setup # check/configure the active workspace
118
+ ws-setup --workspace ~/aai-ws # check/configure a specific workspace
119
+ ws-setup AnswerDotAI/aai-ws ~/aai-ws # bootstrap a new workspace
119
120
  ws-setup AnswerDotAI/private-ws ~/aai-ws --workers 8
121
+ ws-setup owner/workspace ~/my-workspace --python 3.13
120
122
  ```
121
123
 
122
- The destination must not exist, including as an empty directory or a symlink. A failed step stops setup and leaves the checkout in place for inspection; it never deletes a partial workspace automatically. For an existing workspace, activate its environment and use `ws-sync` instead. Workspace repos should include fastws in their repo list or package dependencies so syncing retains the workspace commands.
124
+ With `repo` and `dest`, `ws-setup` clones the workspace repo into a new directory (which must not exist, including as an empty directory or symlink), creates its `.venv`, installs fastws, clones the workspace repos, installs any missing Rust/WebAssembly/JavaScript prerequisites and `sccache` config, and runs that environment's `ws-sync`. It targets the new environment even when another workspace or uv tool environment is already active, and never changes shell startup files or harness settings. A failed step leaves the checkout in place for inspection.
125
+
126
+ With no `repo`, `ws-setup` inspects the existing workspace and completes any missing steps idempotently: installing `rustup` and `wasm32-unknown-unknown` when Rust/WebAssembly packages are present, installing `sccache`, installing Vite+ (`vp`) and enabling its managed `node`/`pnpm` shims when JavaScript packages are present, and configuring `sccache` when `SCCACHE_R2` is set.
127
+
128
+ Set `SCCACHE_R2` to a single R2 URL to configure multilevel local-disk + Cloudflare R2 `sccache` caching:
129
+
130
+ ```bash
131
+ export SCCACHE_R2="https://<access_key_id>:<secret_access_key>@<account_id>.r2.cloudflarestorage.com/<bucket>"
132
+ ws-setup
133
+ ```
134
+
135
+ `ws-setup` writes `[cache.multilevel]` (`disk` + `s3`), `[cache.disk]`, `[cache.s3]`, and the workspace root under `basedirs` into the platform `sccache` config (`~/Library/Application Support/Mozilla.sccache/config` on macOS, `~/.config/sccache/config` on Linux, or `SCCACHE_CONF`), preserving existing `basedirs` and unrelated sections. Credentials are written to an isolated `[r2-sccache]` profile in `~/.aws/credentials` (leaving `[default]` untouched), and `.cargo/rustc-lock` selects that profile for `sccache`. Append `?rw_mode=READ_ONLY` for read-only tokens, omit credentials for public read-only buckets, or add `/<prefix>` after `<bucket>` for a `key_prefix`.
123
136
 
124
137
  ### `ws-clone`
125
138
 
@@ -186,7 +199,7 @@ cargo develop --path /path/to/project
186
199
  cargo develop --profile quick
187
200
  ```
188
201
 
189
- Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path` 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. The project must produce a `cdylib` and set `python-source`. 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 `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.
190
203
 
191
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.
192
205
 
@@ -214,7 +227,7 @@ On Unix, cooperating `cargo develop` runs take a per-project lock through compil
214
227
 
215
228
  On Unix, every rustc call holds a shared `flock` on `/tmp/aai-ws-timing.lock`, through the rustc wrapper that sync writes (see `ws-sync`). A speed test that takes that lock exclusively stays apart from participating builds and test runs. A timing also holds `/tmp/aai-ws-timing.gate` while it waits for the lock and holds it, and a shared hold passes that file first, so new rustc calls and test runs wait behind the timing. Both shared and exclusive acquisition fail after 5 minutes; work never proceeds unlocked. Python code takes the same lock with `fastws.timelock.timing_lock`: `with timing_lock(exclusive=True):` around a timing, and `with timing_lock():` around a test run. Shared-inside-shared in one thread reuses its hold; each thread otherwise takes its own hold. Any nesting involving exclusive raises `RuntimeError` immediately. An exclusive hold that has waited 30 seconds prints the processes that have the lock's file open. Windows builds and tests run without this timing coordination.
216
229
 
217
- Use `fastws.build_backend` as the build backend of a mixed project, and include `fastws-cli>=0.0.29` alongside `maturin>=1.13,<2.0` in `[build-system].requires`. Its editable builds install only Python metadata and the source path, and compile no Rust. `ws-sync` then runs `cargo develop` to build and install the extension, the binaries and the wheel data files. After standalone `uv sync`, run `cargo develop` yourself.
230
+ Use `fastws.build_backend` as the build backend of a mixed Rust/Python project (with `fastws-cli>=0.0.29` alongside `maturin>=1.13,<2.0` in `[build-system].requires`) or a `bindings = "bin"` Rust CLI project (`fastws-cli>=0.0.39`). Inside a fastws workspace, `ws-sync` writes `[tool.uv.config-settings-package]` with `metadata-only = "1"` into the workspace `pyproject.toml`, so editable builds through `uv sync` install only Python metadata (and the source path when `python-source` is set) and leave Rust compilation to `cargo develop`, which installs the extension, binaries, and wheel data files. Outside the workspace, including `pip install -e .` in CI and standalone installs, editable builds receive no `metadata-only` setting, stage any `native-binaries`, and delegate to maturin so they compile normally.
218
231
 
219
232
  For distribution wheels containing the binaries, also set `[tool.maturin].data` to a generated wheel-data directory. With `native-binaries = true`, wheel builds through the backend replace its `scripts/` subdirectory with the current Python-free binaries, then delegate packaging to maturin. Explicit profile, target and feature arguments from maturin's build settings also apply to the binaries. Without `native-binaries`, wheel builds go straight to maturin, and `[tool.maturin].data` is optional.
220
233
 
@@ -309,7 +322,7 @@ Sync also defaults `[term] quiet = true` in that file to suppress routine Cargo
309
322
 
310
323
  Do not commit a `Cargo.lock` generated under these patches. Its source-less local entries cannot be resolved on another machine.
311
324
 
312
- Sync writes `.cargo/rustc-lock` and makes it Cargo's `rustc-wrapper`. The script runs each rustc call holding the timing lock shared (see `cargo develop` above). Inside the lock it runs the wrapper that the config named before sync first wrote the script, where another tool set one, and otherwise `sccache` when it's installed, so unchanged compilation units are reused across the workspace's otherwise-independent Cargo target directories. Later syncs keep that inner wrapper. The script costs about 9 ms a rustc call, mostly the Python interpreter's start. If `sccache` isn't installed, sync warns with the install command (`cargo install sccache --locked`) and continues; rerun `ws-sync` after installing to enable it. On Windows, where the lock does nothing, the config keeps another tool's wrapper, or else names `sccache`.
325
+ Sync writes `.cargo/rustc-lock` and makes it Cargo's `rustc-wrapper`. The script runs each rustc call holding the timing lock shared (see `cargo develop` above). Inside the lock it runs the wrapper that the config named before sync first wrote the script, where another tool set one, and otherwise `sccache` when it's installed, so unchanged compilation units are reused across the workspace's otherwise-independent Cargo target directories. When `ws-setup` has configured an isolated `r2-sccache` AWS credentials profile for a shared R2 cache, the script passes `AWS_PROFILE=r2-sccache` to `sccache` (clearing ambient `AWS_*` keys in that child process) so it never collides with AWS CLI or `boto3`. Later syncs keep that inner wrapper. The script costs about 9 ms a rustc call, mostly the Python interpreter's start. If `sccache` isn't installed—or `SCCACHE_R2` is set without matching `sccache` config—sync warns and tells you to run `ws-setup`. On Windows, where the lock does nothing, the config keeps another tool's wrapper, or else names `sccache`.
313
326
 
314
327
  For an isolated build workspace, `fastws.core.cargo_setup(root)` regenerates these Cargo patches and the same compiler wrapper without pulling, syncing Python or building.
315
328
 
@@ -319,11 +332,11 @@ Each sync updates `packages` in the root `pnpm-workspace.yaml` (creating it with
319
332
 
320
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.
321
334
 
322
- Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` 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`. Leave global build isolation enabled for other projects.
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.
323
336
 
324
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=""`).
325
338
 
326
- After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python 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. Maturin packages with `bindings = "bin"` keep their existing uv installation path.
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.
327
340
 
328
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.
329
342
 
@@ -333,11 +346,9 @@ After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N
333
346
 
334
347
  `--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.
335
348
 
336
- When JavaScript workspaces are present, fastws requires Vite+ (`vp`) on `PATH` with managed `node` and `pnpm` shims active (`curl -fsSL https://vite.plus | bash`, with Vite+'s bin directory ahead of Homebrew on `PATH`). When WebAssembly packages (`[tool.fastws].wasm-package`) are present, fastws also requires rustup's `rustc`/`cargo` proxies and the `wasm32-unknown-unknown` target (`rustup target add wasm32-unknown-unknown`).
337
-
338
- At most once per day, sync upgrades dependencies with `uv sync -U` and a parallel `cargo update` in every member with a `Cargo.toml`. It prints the changes and records the run in a stamp file inside the workspace's `.git` directory. Pass `--upgrade` to force an upgrade regardless of the last run time.
349
+ 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.
339
350
 
340
- Before every uv sync, `ws-sync` writes `.git/fastws-cargo-key` for each member crate. The key hashes `Cargo.lock` contents and the workspace Cargo patch configuration. For Git dependencies redirected to local paths by `[patch."<url>"]`, it also hashes each patched crate's `Cargo.toml`, `build.rs`, and `src` tree, recursively. The file is rewritten only when that content changes, so projects can use `{ file = ".git/fastws-cargo-key" }` in `tool.uv.cache-keys` without rebuilding after a timestamp-only `Cargo.lock` write.
351
+ At most once per day, sync upgrades Python dependencies with `uv sync -U`. At most once every seven days, when Rust crates are present, it updates the stable toolchain with `rustup update stable` (if `rustup` is on `PATH` and no `rust-toolchain.toml` or `rust-toolchain` exists at the workspace root) and runs a parallel `cargo update` in every member with a `Cargo.toml`. It prints the changes and records each run in its own stamp file inside the workspace's `.git` directory (`fastws-upgraded` and `fastws-cargo-upgraded`). Pass `--upgrade` to force both upgrades regardless of the last run time.
341
352
 
342
353
  ```bash
343
354
  ws-sync
@@ -1,4 +1,6 @@
1
- __version__ = "0.0.38"
1
+ __version__ = "0.0.40"
2
+
3
+
2
4
 
3
5
 
4
6
 
@@ -1,4 +1,4 @@
1
- r"Maturin build backend whose editable installs compile no Rust, and whose wheels can include Cargo binaries."
1
+ r"Maturin build backend whose editable installs skip Rust when configured with `metadata-only`, and whose wheels can include Cargo binaries."
2
2
  import argparse, base64, csv, hashlib, io
3
3
  from pathlib import Path
4
4
  from tempfile import TemporaryDirectory
@@ -6,8 +6,10 @@ from zipfile import ZipFile, ZIP_DEFLATED
6
6
  import maturin
7
7
  from .cargo import settings, stage_binaries
8
8
 
9
+ METADATA_ONLY = 'metadata-only' # PEP 660 config setting set by workspace `pyproject.toml` so editable installs leave Rust builds to `cargo develop`
9
10
 
10
- def _stage(config_settings):
11
+
12
+ def _stage(config_settings, default_profile='release'):
11
13
  root = Path.cwd()
12
14
  tool = settings(root)
13
15
  if not tool.get('fastws', {}).get('native-binaries'): return
@@ -19,7 +21,7 @@ def _stage(config_settings):
19
21
  parser.add_argument('--all-features', action='store_true')
20
22
  parser.add_argument('--no-default-features', action='store_true')
21
23
  args, _ = parser.parse_known_args(maturin.get_maturin_pep517_args(config_settings))
22
- profile = args.profile or ('release' if args.release else tool['maturin'].get('profile', 'release'))
24
+ profile = args.profile or ('release' if args.release else tool['maturin'].get('profile', default_profile))
23
25
  stage_binaries(root, profile, args.target, args.features, args.all_features, args.no_default_features)
24
26
 
25
27
 
@@ -29,15 +31,18 @@ def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
29
31
 
30
32
 
31
33
  def build_editable(wheel_directory, config_settings=None, metadata_directory=None):
32
- r"Build an editable wheel containing metadata and the Python source path, without compiling Rust."
34
+ r"Build a metadata-only editable wheel when `config_settings` sets `metadata-only`; delegate to maturin otherwise."
35
+ if str((config_settings or {}).get(METADATA_ONLY, '')).lower() in ('', '0', 'false'):
36
+ _stage(config_settings, default_profile='dev')
37
+ return maturin.build_editable(wheel_directory, config_settings, metadata_directory)
33
38
  with TemporaryDirectory() as tmp:
34
39
  info = Path(metadata_directory) if metadata_directory else Path(tmp)/prepare_metadata_for_build_editable(tmp, config_settings)
35
40
  name = info.name.removesuffix('.dist-info')
36
41
  tag = next(line.removeprefix('Tag: ') for line in (info/'WHEEL').read_text().splitlines() if line.startswith('Tag: '))
37
42
  files = {p.relative_to(info.parent).as_posix(): p.read_bytes() for p in info.rglob('*') if p.is_file() and p != info/'RECORD'}
38
43
  root = Path.cwd()
39
- source = (root/settings(root)['maturin']['python-source']).resolve()
40
- files[f'{name}.pth'] = f'{source}\n'.encode()
44
+ if py_src := settings(root)['maturin'].get('python-source'):
45
+ files[f'{name}.pth'] = f'{(root/py_src).resolve()}\n'.encode()
41
46
  record = f'{info.name}/RECORD'
42
47
  rows = [(path, 'sha256=' + base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b'=').decode(), len(data))
43
48
  for path, data in files.items()]
@@ -375,24 +375,31 @@ def develop(root, *, profile=None):
375
375
  with store.building(root) as started:
376
376
  tool = settings(root)
377
377
  cfg = tool['maturin']
378
- if 'python-source' not in cfg: raise ConfigError(r'cargo develop requires tool.maturin.python-source')
379
- binaries = tool.get('fastws', {}).get('native-binaries', False)
380
- artifacts = build(root, binaries=binaries, profile=profile or _dev_profile(root))
381
- artifact, = [m for m in artifacts if 'cdylib' in m['target']['crate_types']]
382
- lib, = [Path(f) for f in artifact['filenames'] if Path(f).suffix in ('.dylib', '.so', '.dll')]
383
- module = cfg.get('module-name', artifact['target']['name'])
384
- src = root/cfg['python-source']
385
- ext = src/Path(*module.split('.'))
386
- ext = ext.with_name(ext.name + sysconfig.get_config_var('EXT_SUFFIX'))
378
+ bin_only = cfg.get('bindings') == 'bin'
379
+ if not bin_only and 'python-source' not in cfg: raise ConfigError(r'cargo develop requires tool.maturin.python-source')
380
+ 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))
387
382
  env = Path(os.environ.get('VIRTUAL_ENV', sys.prefix))
388
383
  scripts = env/('Scripts' if os.name == 'nt' else 'bin')
389
384
  exes = [Path(m['executable']) for m in artifacts if binaries and m.get('executable')]
390
- package = src/module.split('.')[0]
391
- files = {f'python/{f.relative_to(src)}': f for f in package.rglob('*') if f.is_file() and f != ext and '__pycache__' not in f.parts}
392
- files |= {f'python/{ext.relative_to(src)}': lib} | {f'bin/{e.name}': e for e in exes}
385
+ files = {f'bin/{e.name}': e for e in exes}
386
+ paths = {scripts/e.name: f'bin/{e.name}' for e in exes}
387
+ built = list(exes)
388
+ if not bin_only:
389
+ artifact, = [m for m in artifacts if 'cdylib' in m['target']['crate_types']]
390
+ lib, = [Path(f) for f in artifact['filenames'] if Path(f).suffix in ('.dylib', '.so', '.dll')]
391
+ module = cfg.get('module-name', artifact['target']['name'])
392
+ src = root/cfg['python-source']
393
+ ext = src/Path(*module.split('.'))
394
+ ext = ext.with_name(ext.name + sysconfig.get_config_var('EXT_SUFFIX'))
395
+ package = src/module.split('.')[0]
396
+ files |= {f'python/{f.relative_to(src)}': f for f in package.rglob('*') if f.is_file() and f != ext and '__pycache__' not in f.parts}
397
+ files[f'python/{ext.relative_to(src)}'] = lib
398
+ paths[ext] = f'python/{ext.relative_to(src)}'
399
+ built.insert(0, lib)
393
400
  with store.access():
394
- kept = store.keep(root, files, dict.fromkeys(f for a in [lib, *exes] for f in store.dep_files(a)), started)
395
- store.install(root, kept, {ext: f'python/{ext.relative_to(src)}'} | {scripts/e.name: f'bin/{e.name}' for e in exes})
401
+ kept = store.keep(root, files, dict.fromkeys(f for a in built for f in store.dep_files(a)), started)
402
+ store.install(root, kept, paths)
396
403
  store.collect()
397
404
  if generator := tool.get('fastws', {}).get('post-develop-module'):
398
405
  subprocess.run([sys.executable, '-m', generator], cwd=root, check=True)