fastws-cli 0.0.39__tar.gz → 0.0.41__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.
- {fastws_cli-0.0.39/fastws_cli.egg-info → fastws_cli-0.0.41}/PKG-INFO +27 -13
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/README.md +26 -12
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/__init__.py +3 -1
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/build_backend.py +11 -7
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/cargo.py +5 -8
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/core.py +299 -65
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/news.py +1 -2
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/procs.py +2 -2
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/store.py +1 -2
- {fastws_cli-0.0.39 → fastws_cli-0.0.41/fastws_cli.egg-info}/PKG-INFO +27 -13
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/tests/test_build.py +8 -51
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/tests/test_build_backend.py +2 -15
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/tests/test_integrate.py +5 -2
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/tests/test_procs.py +2 -2
- fastws_cli-0.0.41/tests/test_setup.py +36 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/tests/test_sync.py +65 -17
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/tests/test_timelock.py +2 -1
- fastws_cli-0.0.39/tests/test_setup.py +0 -15
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/LICENSE +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/_toml.py +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/integrate.py +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/releases.py +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws/timelock.py +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws_cli.egg-info/SOURCES.txt +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws_cli.egg-info/dependency_links.txt +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws_cli.egg-info/entry_points.txt +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws_cli.egg-info/requires.txt +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/fastws_cli.egg-info/top_level.txt +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/pyproject.toml +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/setup.cfg +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/tests/test_news.py +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/tests/test_releases.py +0 -0
- {fastws_cli-0.0.39 → fastws_cli-0.0.41}/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.
|
|
3
|
+
Version: 0.0.41
|
|
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,
|
|
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
|
|
@@ -140,16 +140,28 @@ echo source ~/aai-ws/.venv/bin/activate >> ~/.bashrc
|
|
|
140
140
|
|
|
141
141
|
### `ws-setup`
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
Bootstrap a new workspace, or check an existing workspace and complete any missing toolchain and `sccache` setup.
|
|
144
144
|
|
|
145
145
|
```bash
|
|
146
|
-
ws-setup
|
|
147
|
-
ws-setup
|
|
148
|
-
ws-setup
|
|
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
|
|
149
149
|
ws-setup AnswerDotAI/private-ws ~/aai-ws --workers 8
|
|
150
|
+
ws-setup owner/workspace ~/my-workspace --python 3.13
|
|
150
151
|
```
|
|
151
152
|
|
|
152
|
-
|
|
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`.
|
|
153
165
|
|
|
154
166
|
### `ws-clone`
|
|
155
167
|
|
|
@@ -244,7 +256,7 @@ On Unix, cooperating `cargo develop` runs take a per-project lock through compil
|
|
|
244
256
|
|
|
245
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.
|
|
246
258
|
|
|
247
|
-
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`).
|
|
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.
|
|
248
260
|
|
|
249
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.
|
|
250
262
|
|
|
@@ -339,7 +351,7 @@ Sync also defaults `[term] quiet = true` in that file to suppress routine Cargo
|
|
|
339
351
|
|
|
340
352
|
Do not commit a `Cargo.lock` generated under these patches. Its source-less local entries cannot be resolved on another machine.
|
|
341
353
|
|
|
342
|
-
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
|
|
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`.
|
|
343
355
|
|
|
344
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.
|
|
345
357
|
|
|
@@ -349,11 +361,11 @@ Each sync updates `packages` in the root `pnpm-workspace.yaml` (creating it with
|
|
|
349
361
|
|
|
350
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.
|
|
351
363
|
|
|
352
|
-
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
|
|
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.
|
|
353
365
|
|
|
354
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=""`).
|
|
355
367
|
|
|
356
|
-
After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects
|
|
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. 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.
|
|
357
369
|
|
|
358
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.
|
|
359
371
|
|
|
@@ -361,11 +373,13 @@ Fastws then runs `vp install` at the workspace root (driving pnpm underneath). N
|
|
|
361
373
|
|
|
362
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.
|
|
363
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
|
+
|
|
364
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.
|
|
365
379
|
|
|
366
|
-
When JavaScript workspaces are present, fastws requires Vite+ (`vp`) on `PATH` with managed `node` and `pnpm` shims active
|
|
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.
|
|
367
381
|
|
|
368
|
-
At most once per day, sync upgrades Python dependencies with `uv sync -U
|
|
382
|
+
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.
|
|
369
383
|
|
|
370
384
|
```bash
|
|
371
385
|
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,
|
|
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
|
|
@@ -111,16 +111,28 @@ echo source ~/aai-ws/.venv/bin/activate >> ~/.bashrc
|
|
|
111
111
|
|
|
112
112
|
### `ws-setup`
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
Bootstrap a new workspace, or check an existing workspace and complete any missing toolchain and `sccache` setup.
|
|
115
115
|
|
|
116
116
|
```bash
|
|
117
|
-
ws-setup
|
|
118
|
-
ws-setup
|
|
119
|
-
ws-setup
|
|
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
|
|
120
120
|
ws-setup AnswerDotAI/private-ws ~/aai-ws --workers 8
|
|
121
|
+
ws-setup owner/workspace ~/my-workspace --python 3.13
|
|
121
122
|
```
|
|
122
123
|
|
|
123
|
-
|
|
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`.
|
|
124
136
|
|
|
125
137
|
### `ws-clone`
|
|
126
138
|
|
|
@@ -215,7 +227,7 @@ On Unix, cooperating `cargo develop` runs take a per-project lock through compil
|
|
|
215
227
|
|
|
216
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.
|
|
217
229
|
|
|
218
|
-
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`).
|
|
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.
|
|
219
231
|
|
|
220
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.
|
|
221
233
|
|
|
@@ -310,7 +322,7 @@ Sync also defaults `[term] quiet = true` in that file to suppress routine Cargo
|
|
|
310
322
|
|
|
311
323
|
Do not commit a `Cargo.lock` generated under these patches. Its source-less local entries cannot be resolved on another machine.
|
|
312
324
|
|
|
313
|
-
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
|
|
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`.
|
|
314
326
|
|
|
315
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.
|
|
316
328
|
|
|
@@ -320,11 +332,11 @@ Each sync updates `packages` in the root `pnpm-workspace.yaml` (creating it with
|
|
|
320
332
|
|
|
321
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.
|
|
322
334
|
|
|
323
|
-
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
|
|
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.
|
|
324
336
|
|
|
325
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=""`).
|
|
326
338
|
|
|
327
|
-
After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects
|
|
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. 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.
|
|
328
340
|
|
|
329
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.
|
|
330
342
|
|
|
@@ -332,11 +344,13 @@ Fastws then runs `vp install` at the workspace root (driving pnpm underneath). N
|
|
|
332
344
|
|
|
333
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.
|
|
334
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
|
+
|
|
335
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.
|
|
336
350
|
|
|
337
|
-
When JavaScript workspaces are present, fastws requires Vite+ (`vp`) on `PATH` with managed `node` and `pnpm` shims active
|
|
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.
|
|
338
352
|
|
|
339
|
-
At most once per day, sync upgrades Python dependencies with `uv sync -U
|
|
353
|
+
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.
|
|
340
354
|
|
|
341
355
|
```bash
|
|
342
356
|
ws-sync
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
r"Maturin build backend whose editable installs
|
|
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
|
-
|
|
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',
|
|
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,18 +31,20 @@ 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
|
|
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
|
-
if py_src := settings(root)['maturin'].get('python-source'):
|
|
40
|
-
files[f'{name}.pth'] = f'{(root/py_src).resolve()}\n'.encode()
|
|
44
|
+
if py_src := settings(root)['maturin'].get('python-source'): files[f'{name}.pth'] = f'{(root/py_src).resolve()}\n'.encode()
|
|
41
45
|
record = f'{info.name}/RECORD'
|
|
42
46
|
rows = [(path, 'sha256=' + base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b'=').decode(), len(data))
|
|
43
|
-
|
|
47
|
+
for path, data in files.items()]
|
|
44
48
|
buffer = io.StringIO()
|
|
45
49
|
csv.writer(buffer).writerows([*rows, (record, '', '')])
|
|
46
50
|
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', 'test') if (root/'pyproject.toml').exists() else 'test'
|
|
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
|
-
|
|
113
|
-
|
|
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())
|
|
@@ -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)]
|
|
@@ -341,8 +339,7 @@ def build(
|
|
|
341
339
|
if binaries: cmd.append('--bins')
|
|
342
340
|
if profile := profile or cfg.get('profile'): cmd += ['--profile', profile]
|
|
343
341
|
if target: cmd += ['--target', target]
|
|
344
|
-
if features := features or cfg.get('features'):
|
|
345
|
-
cmd += ['--features', features if isinstance(features, str) else ','.join(features)]
|
|
342
|
+
if features := features or cfg.get('features'): cmd += ['--features', features if isinstance(features, str) else ','.join(features)]
|
|
346
343
|
for flag, active in [('all-features', all_features), ('no-default-features', no_default_features)]:
|
|
347
344
|
if active or cfg.get(flag): cmd.append('--' + flag)
|
|
348
345
|
extra, env = _maturin_flags(target, os.environ) if for_maturin else ([], None)
|