fastws-cli 0.0.37__tar.gz → 0.0.39__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.37/fastws_cli.egg-info → fastws_cli-0.0.39}/PKG-INFO +8 -8
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/README.md +7 -7
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/__init__.py +3 -1
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/build_backend.py +2 -2
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/cargo.py +21 -14
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/core.py +43 -80
- {fastws_cli-0.0.37 → fastws_cli-0.0.39/fastws_cli.egg-info}/PKG-INFO +8 -8
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/tests/test_build_backend.py +13 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/tests/test_sync.py +14 -37
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/LICENSE +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/_toml.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/integrate.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/news.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/procs.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/releases.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/store.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws/timelock.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws_cli.egg-info/SOURCES.txt +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws_cli.egg-info/dependency_links.txt +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws_cli.egg-info/entry_points.txt +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws_cli.egg-info/requires.txt +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/fastws_cli.egg-info/top_level.txt +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/pyproject.toml +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/setup.cfg +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/tests/test_build.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/tests/test_integrate.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/tests/test_news.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/tests/test_procs.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/tests/test_releases.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/tests/test_setup.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/tests/test_store.py +0 -0
- {fastws_cli-0.0.37 → fastws_cli-0.0.39}/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.
|
|
3
|
+
Version: 0.0.39
|
|
4
4
|
Summary: Fast workspace tools for multi-repo management
|
|
5
5
|
Author: Jeremy Howard
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -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.
|
|
@@ -145,6 +146,7 @@ Clone a workspace repo into a new directory, create its `.venv`, install fastws,
|
|
|
145
146
|
ws-setup AnswerDotAI/aai-ws ~/aai-ws
|
|
146
147
|
ws-setup AnswerDotAI/private-ws ~/aai-ws
|
|
147
148
|
ws-setup owner/workspace ~/my-workspace --python 3.13
|
|
149
|
+
ws-setup AnswerDotAI/private-ws ~/aai-ws --workers 8
|
|
148
150
|
```
|
|
149
151
|
|
|
150
152
|
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.
|
|
@@ -214,7 +216,7 @@ cargo develop --path /path/to/project
|
|
|
214
216
|
cargo develop --profile quick
|
|
215
217
|
```
|
|
216
218
|
|
|
217
|
-
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.
|
|
219
|
+
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.
|
|
218
220
|
|
|
219
221
|
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.
|
|
220
222
|
|
|
@@ -242,7 +244,7 @@ On Unix, cooperating `cargo develop` runs take a per-project lock through compil
|
|
|
242
244
|
|
|
243
245
|
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.
|
|
244
246
|
|
|
245
|
-
Use `fastws.build_backend` as the build backend of a mixed project
|
|
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`). Its editable builds install only Python metadata (and the source path when `python-source` is set) and compile no Rust. `ws-sync` then runs `cargo develop` to build and install the extension, binaries and wheel data files. After standalone `uv sync`, run `cargo develop` yourself.
|
|
246
248
|
|
|
247
249
|
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.
|
|
248
250
|
|
|
@@ -345,13 +347,13 @@ Fastws discovers JavaScript packages directly under the workspace root, explicit
|
|
|
345
347
|
|
|
346
348
|
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.
|
|
347
349
|
|
|
348
|
-
|
|
350
|
+
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.
|
|
349
351
|
|
|
350
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`. Leave global build isolation enabled for other projects.
|
|
351
353
|
|
|
352
354
|
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=""`).
|
|
353
355
|
|
|
354
|
-
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.
|
|
356
|
+
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.
|
|
355
357
|
|
|
356
358
|
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.
|
|
357
359
|
|
|
@@ -363,9 +365,7 @@ After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N
|
|
|
363
365
|
|
|
364
366
|
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`).
|
|
365
367
|
|
|
366
|
-
At most once per day, sync upgrades dependencies with `uv sync -U
|
|
367
|
-
|
|
368
|
-
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.
|
|
368
|
+
At most once per day, sync upgrades Python dependencies with `uv sync -U`, and at most once every seven days it 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
369
|
|
|
370
370
|
```bash
|
|
371
371
|
ws-sync
|
|
@@ -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.
|
|
@@ -116,6 +117,7 @@ Clone a workspace repo into a new directory, create its `.venv`, install fastws,
|
|
|
116
117
|
ws-setup AnswerDotAI/aai-ws ~/aai-ws
|
|
117
118
|
ws-setup AnswerDotAI/private-ws ~/aai-ws
|
|
118
119
|
ws-setup owner/workspace ~/my-workspace --python 3.13
|
|
120
|
+
ws-setup AnswerDotAI/private-ws ~/aai-ws --workers 8
|
|
119
121
|
```
|
|
120
122
|
|
|
121
123
|
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.
|
|
@@ -185,7 +187,7 @@ cargo develop --path /path/to/project
|
|
|
185
187
|
cargo develop --profile quick
|
|
186
188
|
```
|
|
187
189
|
|
|
188
|
-
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.
|
|
190
|
+
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.
|
|
189
191
|
|
|
190
192
|
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.
|
|
191
193
|
|
|
@@ -213,7 +215,7 @@ On Unix, cooperating `cargo develop` runs take a per-project lock through compil
|
|
|
213
215
|
|
|
214
216
|
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.
|
|
215
217
|
|
|
216
|
-
Use `fastws.build_backend` as the build backend of a mixed project
|
|
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`). Its editable builds install only Python metadata (and the source path when `python-source` is set) and compile no Rust. `ws-sync` then runs `cargo develop` to build and install the extension, binaries and wheel data files. After standalone `uv sync`, run `cargo develop` yourself.
|
|
217
219
|
|
|
218
220
|
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.
|
|
219
221
|
|
|
@@ -316,13 +318,13 @@ Fastws discovers JavaScript packages directly under the workspace root, explicit
|
|
|
316
318
|
|
|
317
319
|
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.
|
|
318
320
|
|
|
319
|
-
|
|
321
|
+
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.
|
|
320
322
|
|
|
321
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`. Leave global build isolation enabled for other projects.
|
|
322
324
|
|
|
323
325
|
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=""`).
|
|
324
326
|
|
|
325
|
-
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.
|
|
327
|
+
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.
|
|
326
328
|
|
|
327
329
|
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.
|
|
328
330
|
|
|
@@ -334,9 +336,7 @@ After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N
|
|
|
334
336
|
|
|
335
337
|
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`).
|
|
336
338
|
|
|
337
|
-
At most once per day, sync upgrades dependencies with `uv sync -U
|
|
338
|
-
|
|
339
|
-
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.
|
|
339
|
+
At most once per day, sync upgrades Python dependencies with `uv sync -U`, and at most once every seven days it 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
340
|
|
|
341
341
|
```bash
|
|
342
342
|
ws-sync
|
|
@@ -36,8 +36,8 @@ def build_editable(wheel_directory, config_settings=None, metadata_directory=Non
|
|
|
36
36
|
tag = next(line.removeprefix('Tag: ') for line in (info/'WHEEL').read_text().splitlines() if line.startswith('Tag: '))
|
|
37
37
|
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
38
|
root = Path.cwd()
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if py_src := settings(root)['maturin'].get('python-source'):
|
|
40
|
+
files[f'{name}.pth'] = f'{(root/py_src).resolve()}\n'.encode()
|
|
41
41
|
record = f'{info.name}/RECORD'
|
|
42
42
|
rows = [(path, 'sha256=' + base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b'=').decode(), len(data))
|
|
43
43
|
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
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
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
|
-
|
|
391
|
-
|
|
392
|
-
|
|
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
|
|
395
|
-
store.install(root, kept,
|
|
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)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
__all__ = ["ws_setup", "ws_clone", "ws_pull", "ws_status", "ws_branches", "ws_build", "ws_sync", "ws_add", "ws_remove", "cargo_develop", "cargo_stage", "cargo_wait", "cargo_setup"]
|
|
4
4
|
|
|
5
|
-
import ast, fnmatch,
|
|
5
|
+
import ast, fnmatch, json, os, re, shlex, shutil, subprocess, sys, tarfile, time
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from contextlib import contextmanager
|
|
8
8
|
from concurrent.futures import ThreadPoolExecutor
|
|
@@ -453,6 +453,7 @@ def ws_setup(
|
|
|
453
453
|
repo: str, # Workspace repository: owner/repo or GitHub URL
|
|
454
454
|
dest: str, # New workspace directory (must not exist)
|
|
455
455
|
python: str = "3.13", # Python version for the workspace environment
|
|
456
|
+
workers: int = None, # Parallel workers for the initial ws-sync; omit to use its default
|
|
456
457
|
):
|
|
457
458
|
"Clone a workspace, create its environment, install fastws, and sync without changing the caller's environment."
|
|
458
459
|
root = Path(dest).expanduser().absolute()
|
|
@@ -466,7 +467,9 @@ def ws_setup(
|
|
|
466
467
|
UV_PROJECT=str(root), UV_WORKING_DIR=str(root), PATH=f'{bindir}{os.pathsep}{os.environ["PATH"]}')
|
|
467
468
|
subprocess.run(['uv', 'venv', '--python', python, str(venv)], cwd=root, env=env, check=True)
|
|
468
469
|
subprocess.run(['uv', 'pip', 'install', '--python', str(bindir/'python'), 'fastws-cli>=0.0.14'], cwd=root, env=env, check=True)
|
|
469
|
-
|
|
470
|
+
sync = [str(bindir/'ws-sync'), '--workspace', str(root)]
|
|
471
|
+
if workers: sync += ['--workers', str(workers)]
|
|
472
|
+
subprocess.run(sync, cwd=root, env=env, check=True)
|
|
470
473
|
print(f'Workspace ready: {root}\n\nsource {shlex.quote(str(bindir/"activate"))}\ncd {shlex.quote(str(root))}')
|
|
471
474
|
if (root/'aai-coding/SETUP.md').exists(): print('Then ask your coding agent to follow aai-coding/SETUP.md.')
|
|
472
475
|
|
|
@@ -745,35 +748,20 @@ def ws_build(
|
|
|
745
748
|
print(f"{built} built, {len(artifacts)-len(todo)} up to date" + (f", {failed} failed" if failed else ""), file=sys.stderr)
|
|
746
749
|
if failed: raise SystemExit(1)
|
|
747
750
|
print(out_path)
|
|
748
|
-
def _upgrade_stamp(root: Path) -> Path:
|
|
751
|
+
def _upgrade_stamp(root: Path, name: str = "fastws-upgraded") -> Path:
|
|
749
752
|
"Stamp whose mtime records the last dependency upgrade; kept inside .git (never tracked) when the root is a git repo."
|
|
750
753
|
gitdir = root/".git"
|
|
751
|
-
return gitdir/
|
|
754
|
+
return gitdir/name if gitdir.is_dir() else root/f".{name}"
|
|
752
755
|
|
|
753
|
-
def _should_upgrade(root: Path, max_age: float = 86400) -> bool:
|
|
756
|
+
def _should_upgrade(root: Path, max_age: float = 86400, name: str = "fastws-upgraded") -> bool:
|
|
754
757
|
"True when this workspace hasn't upgraded dependencies within `max_age` seconds."
|
|
755
|
-
stamp = _upgrade_stamp(root)
|
|
758
|
+
stamp = _upgrade_stamp(root, name)
|
|
756
759
|
return not stamp.exists() or time.time() - stamp.stat().st_mtime > max_age
|
|
757
760
|
|
|
758
|
-
_CARGO_KEY = Path(".git/fastws-cargo-key")
|
|
759
|
-
|
|
760
761
|
def _crate_dirs(root: Path) -> list[Path]:
|
|
761
762
|
"Root dirs containing a Cargo.toml: the crate view of the workspace, independent of uv membership"
|
|
762
763
|
return [d for d in _project_dirs(root, "Cargo.toml") if not d.name.startswith((".", "_"))]
|
|
763
764
|
|
|
764
|
-
def _cargo_patches(root: Path):
|
|
765
|
-
"Local Cargo patches keyed by normalized Git URL and package name, plus their config file."
|
|
766
|
-
config = root/".cargo"/"config.toml"
|
|
767
|
-
if not config.exists(): return {}, None
|
|
768
|
-
data = tomllib.loads(config.read_text())
|
|
769
|
-
patches = {}
|
|
770
|
-
for url, entries in data.get("patch", {}).items():
|
|
771
|
-
for name, spec in entries.items():
|
|
772
|
-
if not isinstance(spec, dict) or not (path := spec.get("path")): continue
|
|
773
|
-
path = Path(path).expanduser()
|
|
774
|
-
patches[(_repo_key(url), name)] = path if path.is_absolute() else (config.parent/path).resolve()
|
|
775
|
-
return patches, config
|
|
776
|
-
|
|
777
765
|
def _crate_manifests(d: Path):
|
|
778
766
|
"(parsed `Cargo.toml`, dir) for the crate or workspace at `d` and each of its cargo workspace members"
|
|
779
767
|
try: data = tomllib.loads((d/"Cargo.toml").read_text())
|
|
@@ -932,54 +920,6 @@ def _cargo_dep_tables(data, every=False):
|
|
|
932
920
|
for name in names: yield target.get(name, {})
|
|
933
921
|
if every: yield data.get("workspace", {}).get("dependencies", {})
|
|
934
922
|
|
|
935
|
-
def _patched_cargo_deps(crate: Path, patches):
|
|
936
|
-
data = tomllib.loads((crate/"Cargo.toml").read_text())
|
|
937
|
-
for deps in _cargo_dep_tables(data):
|
|
938
|
-
for name, spec in deps.items():
|
|
939
|
-
if not isinstance(spec, dict) or not (url := spec.get("git")): continue
|
|
940
|
-
if path := patches.get((_repo_key(url), spec.get("package", name))): yield path
|
|
941
|
-
|
|
942
|
-
def _cargo_input_files(crate: Path):
|
|
943
|
-
for name in "Cargo.toml","build.rs":
|
|
944
|
-
if (path := crate/name).exists(): yield path
|
|
945
|
-
src = crate/"src"
|
|
946
|
-
if src.exists(): yield from sorted(path for path in src.rglob("*") if path.is_file())
|
|
947
|
-
|
|
948
|
-
def _cargo_lock_content(path: Path) -> bytes:
|
|
949
|
-
"Cargo.lock bytes without Cargo's order-unstable bookkeeping for unused patches"
|
|
950
|
-
if not path.exists(): return b""
|
|
951
|
-
return re.sub(r"(?ms)^\[\[patch\.unused\]\]\n.*?(?=^\[\[|\Z)", "", path.read_text()).encode()
|
|
952
|
-
|
|
953
|
-
def _cargo_key(crate: Path, patches, config):
|
|
954
|
-
h = hashlib.sha256()
|
|
955
|
-
def add_content(content, name):
|
|
956
|
-
h.update(name.encode())
|
|
957
|
-
h.update(b"\0")
|
|
958
|
-
h.update(content)
|
|
959
|
-
h.update(b"\0")
|
|
960
|
-
def add(path, name): add_content(path.read_bytes() if path.exists() else b"", name)
|
|
961
|
-
add_content(_cargo_lock_content(crate/"Cargo.lock"), "Cargo.lock")
|
|
962
|
-
if config: add(config, ".cargo/config.toml")
|
|
963
|
-
seen = set()
|
|
964
|
-
def add_dep(dep):
|
|
965
|
-
dep = dep.resolve()
|
|
966
|
-
if dep in seen: return
|
|
967
|
-
seen.add(dep)
|
|
968
|
-
for path in _cargo_input_files(dep): add(path, f"{dep.name}/{path.relative_to(dep)}")
|
|
969
|
-
for child in _patched_cargo_deps(dep, patches): add_dep(child)
|
|
970
|
-
for dep in _patched_cargo_deps(crate, patches): add_dep(dep)
|
|
971
|
-
return h.hexdigest()
|
|
972
|
-
|
|
973
|
-
def _sync_cargo_keys(root: Path):
|
|
974
|
-
"Update content-derived uv keys for workspace crates, without touching unchanged keys."
|
|
975
|
-
patches, config = _cargo_patches(root)
|
|
976
|
-
for crate in _crate_dirs(root):
|
|
977
|
-
key = crate/_CARGO_KEY
|
|
978
|
-
if not key.parent.is_dir(): continue
|
|
979
|
-
value = _cargo_key(crate, patches, config)
|
|
980
|
-
if key.exists() and key.read_text().strip() == value: continue
|
|
981
|
-
key.write_text(value + "\n")
|
|
982
|
-
|
|
983
923
|
def _cargo_update(root: Path, workers: int = 16):
|
|
984
924
|
"Float each member crate's Cargo.lock to latest matching versions, in parallel; prints what moved."
|
|
985
925
|
crates = _crate_dirs(root)
|
|
@@ -1014,7 +954,7 @@ def _rel_ws_path(root: Path, d: Path) -> str: return Path(os.path.relpath(d.reso
|
|
|
1014
954
|
def _is_maturin_native(d: Path) -> bool:
|
|
1015
955
|
if not (d/'pyproject.toml').exists(): return False
|
|
1016
956
|
cfg = tomllib.loads((d/'pyproject.toml').read_text()).get('tool', {}).get('maturin', {})
|
|
1017
|
-
return 'python-source' in cfg
|
|
957
|
+
return 'python-source' in cfg or cfg.get('bindings') == 'bin'
|
|
1018
958
|
|
|
1019
959
|
def _repo_roots(root: Path, repos_file="repos.txt") -> list[Path]:
|
|
1020
960
|
"Candidate top-level workspace directories plus registered external checkouts."
|
|
@@ -1073,8 +1013,8 @@ def _js_dirs(root: Path, repos_file="repos.txt") -> list[Path]:
|
|
|
1073
1013
|
else: res.append(spec[1])
|
|
1074
1014
|
return list(dict.fromkeys(d.resolve() for d in res if ok(d) and d.resolve() not in superseded_wasm))
|
|
1075
1015
|
|
|
1076
|
-
def _sync_ws_pnpm_workspace(root: Path, members: list[Path]) -> tuple[list[str], list[str]]:
|
|
1077
|
-
"Generate/update `pnpm-workspace.yaml`, merging `pnpm-workspace.shared.yaml`; return `(added, removed)` packages."
|
|
1016
|
+
def _sync_ws_pnpm_workspace(root: Path, members: list[Path], toolchain: dict[str, str] = None) -> tuple[list[str], list[str]]:
|
|
1017
|
+
"Generate/update `pnpm-workspace.yaml`, applying Vite+ toolchain overrides and merging `pnpm-workspace.shared.yaml`; return `(added, removed)` packages."
|
|
1078
1018
|
path = root/"pnpm-workspace.yaml"
|
|
1079
1019
|
before = path.read_text() if path.exists() else ""
|
|
1080
1020
|
data = _yaml_load(path) if path.exists() else {}
|
|
@@ -1083,7 +1023,20 @@ def _sync_ws_pnpm_workspace(root: Path, members: list[Path]) -> tuple[list[str],
|
|
|
1083
1023
|
data.setdefault("preferWorkspacePackages", True)
|
|
1084
1024
|
data.setdefault("minimumReleaseAge", 1440)
|
|
1085
1025
|
shared = root/"pnpm-workspace.shared.yaml"
|
|
1086
|
-
if shared.exists()
|
|
1026
|
+
shared_data = _yaml_load(shared) if shared.exists() else {}
|
|
1027
|
+
shared_ov = shared_data.get("overrides") if isinstance(shared_data.get("overrides"), dict) else {}
|
|
1028
|
+
if toolchain:
|
|
1029
|
+
ov = dict(data.get("overrides") or {})
|
|
1030
|
+
if core_v := toolchain.get("vite-plus-core"):
|
|
1031
|
+
ov.pop("vite", None)
|
|
1032
|
+
if "vite" not in shared_ov: ov["vite@*"] = f"npm:@voidzero-dev/vite-plus-core@{core_v}"
|
|
1033
|
+
else: ov.pop("vite@*", None)
|
|
1034
|
+
if vitest_v := toolchain.get("vitest"):
|
|
1035
|
+
ov.pop("vitest", None)
|
|
1036
|
+
if "vitest" not in shared_ov: ov["vitest@*"] = vitest_v
|
|
1037
|
+
else: ov.pop("vitest@*", None)
|
|
1038
|
+
if ov: data["overrides"] = ov
|
|
1039
|
+
if shared_data: _merge_shared(data, shared_data)
|
|
1087
1040
|
cur_after = list(data.get("packages") or [])
|
|
1088
1041
|
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())]
|
|
1089
1042
|
new = kept + [e for e in (_rel_ws_path(root, d) for d in members) if e not in kept]
|
|
@@ -1093,13 +1046,15 @@ def _sync_ws_pnpm_workspace(root: Path, members: list[Path]) -> tuple[list[str],
|
|
|
1093
1046
|
path.write_text(rendered)
|
|
1094
1047
|
return _entry_changes(cur, new)
|
|
1095
1048
|
|
|
1096
|
-
def _sync_ws_package_json(root: Path) -> bool:
|
|
1097
|
-
"Maintain root `package.json`, merging optional `package.json.shared`."
|
|
1049
|
+
def _sync_ws_package_json(root: Path, toolchain: dict[str, str] = None) -> bool:
|
|
1050
|
+
"Maintain root `package.json`, applying the global `vite-plus` version and merging optional `package.json.shared`."
|
|
1098
1051
|
path = root/"package.json"
|
|
1099
1052
|
data = json.loads(path.read_text()) if path.exists() else {}
|
|
1100
1053
|
before = json.dumps(data)
|
|
1101
1054
|
data["private"] = True
|
|
1102
1055
|
data.pop("workspaces", None)
|
|
1056
|
+
if toolchain and (vp_v := toolchain.get("vite-plus")):
|
|
1057
|
+
data["devDependencies"] = {**data.get("devDependencies", {}), "vite-plus": vp_v}
|
|
1103
1058
|
shared = root/"package.json.shared"
|
|
1104
1059
|
if shared.exists(): _merge_shared(data, json.loads(shared.read_text()))
|
|
1105
1060
|
if json.dumps(data) == before: return False
|
|
@@ -1149,6 +1104,12 @@ def _check_vp():
|
|
|
1149
1104
|
"Enable Vite+ managed mode (`vp env on`) and put Vite+'s bin directory first on PATH "
|
|
1150
1105
|
"(normally via `~/.config/vite-plus/env`), then open a new shell and rerun ws-sync.")
|
|
1151
1106
|
|
|
1107
|
+
def _vp_toolchain() -> dict[str, str]:
|
|
1108
|
+
"Versions of `vite-plus`, `vite-plus-core`, and `vitest` from the global `vp` CLI."
|
|
1109
|
+
if not shutil.which("vp"): return {}
|
|
1110
|
+
raw = subprocess.run(["vp", "toolchain", "--json", "-g"], capture_output=True, text=True, check=True).stdout
|
|
1111
|
+
return {n["id"]: n["version"] for n in json.loads(raw).get("nodes", []) if "id" in n and "version" in n}
|
|
1112
|
+
|
|
1152
1113
|
def _build_wasm(repo: Path):
|
|
1153
1114
|
"Run `cargo wasm` in `repo` through the workspace's configured Cargo."
|
|
1154
1115
|
from .cargo import _cargo_command
|
|
@@ -1186,7 +1147,7 @@ async def ws_sync(
|
|
|
1186
1147
|
upgrade: bool = False, # Force the once-daily dependency upgrade pass
|
|
1187
1148
|
build_workers: int = os.cpu_count() or 1, # Concurrent projects per build phase; defaults to CPU count
|
|
1188
1149
|
):
|
|
1189
|
-
"Pull the workspace baseline, clone missing shared/local repos, then pull projects and sync; upgrade
|
|
1150
|
+
"Pull the workspace baseline, clone missing shared/local repos, then pull projects and sync; upgrade Python deps daily and Cargo deps weekly."
|
|
1190
1151
|
with _cli_errors():
|
|
1191
1152
|
root = _ws_root(workspace, repos_file, pyproject_file, template_file)
|
|
1192
1153
|
repos_path = _resolve_path(root, repos_file)
|
|
@@ -1225,8 +1186,9 @@ async def ws_sync(
|
|
|
1225
1186
|
if wasm_pkgs: _check_rustup(wasm=True)
|
|
1226
1187
|
if js_members: _check_vp()
|
|
1227
1188
|
if js_members or any((root/f).exists() for f in ("pnpm-workspace.yaml", "pnpm-workspace.shared.yaml", "package.json.shared")):
|
|
1228
|
-
|
|
1229
|
-
|
|
1189
|
+
tc = _vp_toolchain() if js_members else {}
|
|
1190
|
+
added_j, removed_j = _sync_ws_pnpm_workspace(root, js_members, toolchain=tc)
|
|
1191
|
+
_sync_ws_package_json(root, toolchain=tc)
|
|
1230
1192
|
if added_j: print(f"JS workspace packages added: {', '.join(added_j)}")
|
|
1231
1193
|
if removed_j: print(f"JS workspace packages removed: {', '.join(removed_j)}")
|
|
1232
1194
|
|
|
@@ -1234,8 +1196,8 @@ async def ws_sync(
|
|
|
1234
1196
|
print(f"⚠️ Skipping uv sync, not Python projects yet (scaffold with e.g. nbdev-new or ship-new, or remove): {', '.join(bad)}")
|
|
1235
1197
|
return
|
|
1236
1198
|
up = upgrade or _should_upgrade(root)
|
|
1237
|
-
|
|
1238
|
-
|
|
1199
|
+
cargo_up = upgrade or _should_upgrade(root, max_age=7*86400, name="fastws-cargo-upgraded")
|
|
1200
|
+
if cargo_up: _cargo_update(root, workers=workers)
|
|
1239
1201
|
subprocess.run(["uv", "sync", "-U"] if up else ["uv", "sync"], check=True, cwd=root)
|
|
1240
1202
|
_write_pytest_pth(root)
|
|
1241
1203
|
from .cargo import develop
|
|
@@ -1244,6 +1206,7 @@ async def ws_sync(
|
|
|
1244
1206
|
if wasm_pkgs:
|
|
1245
1207
|
with ThreadPoolExecutor(max_workers=build_workers) as ex: list(ex.map(_build_wasm, wasm_pkgs))
|
|
1246
1208
|
if up: _upgrade_stamp(root).touch()
|
|
1209
|
+
if cargo_up: _upgrade_stamp(root, "fastws-cargo-upgraded").touch()
|
|
1247
1210
|
if js_members: _sync_js(root, build_workers)
|
|
1248
1211
|
|
|
1249
1212
|
@call_parse
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastws-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.39
|
|
4
4
|
Summary: Fast workspace tools for multi-repo management
|
|
5
5
|
Author: Jeremy Howard
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -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.
|
|
@@ -145,6 +146,7 @@ Clone a workspace repo into a new directory, create its `.venv`, install fastws,
|
|
|
145
146
|
ws-setup AnswerDotAI/aai-ws ~/aai-ws
|
|
146
147
|
ws-setup AnswerDotAI/private-ws ~/aai-ws
|
|
147
148
|
ws-setup owner/workspace ~/my-workspace --python 3.13
|
|
149
|
+
ws-setup AnswerDotAI/private-ws ~/aai-ws --workers 8
|
|
148
150
|
```
|
|
149
151
|
|
|
150
152
|
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.
|
|
@@ -214,7 +216,7 @@ cargo develop --path /path/to/project
|
|
|
214
216
|
cargo develop --profile quick
|
|
215
217
|
```
|
|
216
218
|
|
|
217
|
-
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.
|
|
219
|
+
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.
|
|
218
220
|
|
|
219
221
|
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.
|
|
220
222
|
|
|
@@ -242,7 +244,7 @@ On Unix, cooperating `cargo develop` runs take a per-project lock through compil
|
|
|
242
244
|
|
|
243
245
|
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.
|
|
244
246
|
|
|
245
|
-
Use `fastws.build_backend` as the build backend of a mixed project
|
|
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`). Its editable builds install only Python metadata (and the source path when `python-source` is set) and compile no Rust. `ws-sync` then runs `cargo develop` to build and install the extension, binaries and wheel data files. After standalone `uv sync`, run `cargo develop` yourself.
|
|
246
248
|
|
|
247
249
|
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.
|
|
248
250
|
|
|
@@ -345,13 +347,13 @@ Fastws discovers JavaScript packages directly under the workspace root, explicit
|
|
|
345
347
|
|
|
346
348
|
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.
|
|
347
349
|
|
|
348
|
-
|
|
350
|
+
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.
|
|
349
351
|
|
|
350
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`. Leave global build isolation enabled for other projects.
|
|
351
353
|
|
|
352
354
|
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=""`).
|
|
353
355
|
|
|
354
|
-
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.
|
|
356
|
+
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.
|
|
355
357
|
|
|
356
358
|
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.
|
|
357
359
|
|
|
@@ -363,9 +365,7 @@ After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N
|
|
|
363
365
|
|
|
364
366
|
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`).
|
|
365
367
|
|
|
366
|
-
At most once per day, sync upgrades dependencies with `uv sync -U
|
|
367
|
-
|
|
368
|
-
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.
|
|
368
|
+
At most once per day, sync upgrades Python dependencies with `uv sync -U`, and at most once every seven days it 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
369
|
|
|
370
370
|
```bash
|
|
371
371
|
ws-sync
|
|
@@ -24,3 +24,16 @@ data = "wheel"
|
|
|
24
24
|
assert digest == 'sha256=' + base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b'=').decode()
|
|
25
25
|
assert int(size) == len(data)
|
|
26
26
|
assert record[-1] == ['demo-1.0.dist-info/RECORD', '', '']
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_editable_wheel_bin(tmp_path, monkeypatch):
|
|
30
|
+
monkeypatch.chdir(tmp_path)
|
|
31
|
+
(tmp_path/'pyproject.toml').write_text('[tool.maturin]\nbindings = "bin"\n')
|
|
32
|
+
info = tmp_path/'demo-1.0.dist-info'
|
|
33
|
+
info.mkdir()
|
|
34
|
+
(info/'WHEEL').write_text('Wheel-Version: 1.0\nRoot-Is-Purelib: false\nTag: py3-none-any\n')
|
|
35
|
+
(info/'METADATA').write_text('Metadata-Version: 2.1\nName: demo\nVersion: 1.0\n')
|
|
36
|
+
with ZipFile(tmp_path/build_editable(tmp_path, metadata_directory=info)) as wheel:
|
|
37
|
+
assert 'demo-1.0.pth' not in wheel.namelist()
|
|
38
|
+
record = list(csv.reader(io.StringIO(wheel.read('demo-1.0.dist-info/RECORD').decode())))
|
|
39
|
+
assert {row[0] for row in record} == set(wheel.namelist())
|
|
@@ -135,37 +135,6 @@ def test_ws_remove_refuses_unsafe_repos(tmp_path):
|
|
|
135
135
|
assert (tmp_path/'repos.txt').read_text() == 'AnswerDotAI/keep\n'
|
|
136
136
|
|
|
137
137
|
|
|
138
|
-
def test_cargo_key_hashes_lock_and_patched_dependency_contents(tmp_path):
|
|
139
|
-
crate, dep = tmp_path/'crate', tmp_path/'dep'
|
|
140
|
-
for d in crate, dep: (d/'src').mkdir(parents=True)
|
|
141
|
-
(crate/'Cargo.toml').write_text(r'''[dependencies]
|
|
142
|
-
dep = { git = "https://example.com/dep" }
|
|
143
|
-
''')
|
|
144
|
-
(dep/'Cargo.toml').touch()
|
|
145
|
-
source, lock = dep/'src'/'lib.rs', crate/'Cargo.lock'
|
|
146
|
-
source.write_text('original')
|
|
147
|
-
lock.write_text('first lock')
|
|
148
|
-
patches = {('https://example.com/dep', 'dep'): dep}
|
|
149
|
-
first = core._cargo_key(crate, patches, None)
|
|
150
|
-
lock.write_text('second lock')
|
|
151
|
-
second = core._cargo_key(crate, patches, None)
|
|
152
|
-
assert second != first
|
|
153
|
-
source.write_text('changed')
|
|
154
|
-
assert core._cargo_key(crate, patches, None) != second
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
def test_cargo_lock_ignores_unused_patches(tmp_path):
|
|
158
|
-
lock = tmp_path/'Cargo.lock'
|
|
159
|
-
header = r'''version = 4
|
|
160
|
-
[[package]]
|
|
161
|
-
name = "crate"
|
|
162
|
-
'''
|
|
163
|
-
lock.write_text(header + r'''[[patch.unused]]
|
|
164
|
-
name = "unused"
|
|
165
|
-
''')
|
|
166
|
-
assert core._cargo_lock_content(lock) == header.encode()
|
|
167
|
-
|
|
168
|
-
|
|
169
138
|
def test_sync_cargo_patches_generates_and_preserves(tmp_path):
|
|
170
139
|
(tmp_path/'.cargo').mkdir()
|
|
171
140
|
config = tmp_path/'.cargo'/'config.toml'
|
|
@@ -209,16 +178,24 @@ def test_sync_ws_pnpm_workspace_and_package_json(tmp_path):
|
|
|
209
178
|
assert data['linkWorkspacePackages'] == 'deep' and data['preferWorkspacePackages'] is True and data['minimumReleaseAge'] == 1440
|
|
210
179
|
assert 'overrides' not in data
|
|
211
180
|
|
|
212
|
-
ws.write_text(ws.read_text() + 'overrides:\n keep: 1.0.0\n')
|
|
181
|
+
ws.write_text(ws.read_text() + 'overrides:\n keep: 1.0.0\n vite: npm:@voidzero-dev/vite-plus-core@8.0.0\n vitest: 4.0.0\n')
|
|
182
|
+
tc = {'vite-plus': '1.8.0', 'vite-plus-core': '8.4.0', 'vitest': '5.2.0'}
|
|
183
|
+
core._sync_ws_pnpm_workspace(tmp_path, [tmp_path/'app'], toolchain=tc)
|
|
184
|
+
assert core._yaml_load(ws)['overrides'] == {'keep': '1.0.0', 'vite@*': 'npm:@voidzero-dev/vite-plus-core@8.4.0', 'vitest@*': '5.2.0'}
|
|
185
|
+
|
|
213
186
|
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')
|
|
214
|
-
core._sync_ws_pnpm_workspace(tmp_path, [tmp_path/'app'])
|
|
187
|
+
core._sync_ws_pnpm_workspace(tmp_path, [tmp_path/'app'], toolchain=tc)
|
|
215
188
|
assert core._yaml_load(ws)['overrides'] == {'keep': '1.0.0', 'vite': 'npm:@voidzero-dev/vite-plus-core@8.3.8000', 'vitest': '5.1.0'}
|
|
216
189
|
|
|
217
190
|
pkg, pkg_shared = tmp_path/'package.json', tmp_path/'package.json.shared'
|
|
218
191
|
pkg.write_text(json.dumps({'name': 'local', 'workspaces': ['stale'], 'devDependencies': {'keep': '1'}}))
|
|
219
|
-
pkg_shared.write_text(json.dumps({'packageManager': 'pnpm@10.34.9'
|
|
220
|
-
assert core._sync_ws_package_json(tmp_path) is True
|
|
192
|
+
pkg_shared.write_text(json.dumps({'packageManager': 'pnpm@10.34.9'}))
|
|
193
|
+
assert core._sync_ws_package_json(tmp_path, toolchain=tc) is True
|
|
221
194
|
out = json.loads(pkg.read_text())
|
|
222
195
|
assert 'workspaces' not in out and out['private'] is True
|
|
223
|
-
assert out['devDependencies'] == {'keep': '1', 'vite-plus': '1.
|
|
224
|
-
assert out['packageManager'] == 'pnpm@10.34.9'
|
|
196
|
+
assert out['devDependencies'] == {'keep': '1', 'vite-plus': '1.8.0'}
|
|
197
|
+
assert out['packageManager'] == 'pnpm@10.34.9'
|
|
198
|
+
|
|
199
|
+
pkg_shared.write_text(json.dumps({'packageManager': 'pnpm@10.34.9', 'devDependencies': {'vite-plus': '1.7.0'}}))
|
|
200
|
+
assert core._sync_ws_package_json(tmp_path, toolchain=tc) is True
|
|
201
|
+
assert json.loads(pkg.read_text())['devDependencies'] == {'keep': '1', 'vite-plus': '1.7.0'}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|