fastws-cli 0.0.40__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.
Files changed (32) hide show
  1. {fastws_cli-0.0.40/fastws_cli.egg-info → fastws_cli-0.0.41}/PKG-INFO +4 -2
  2. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/README.md +3 -1
  3. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/__init__.py +2 -1
  4. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/build_backend.py +2 -3
  5. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/cargo.py +5 -8
  6. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/core.py +24 -24
  7. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/news.py +1 -2
  8. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/procs.py +2 -2
  9. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/store.py +1 -2
  10. {fastws_cli-0.0.40 → fastws_cli-0.0.41/fastws_cli.egg-info}/PKG-INFO +4 -2
  11. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/tests/test_build.py +8 -11
  12. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/tests/test_integrate.py +5 -2
  13. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/tests/test_procs.py +2 -2
  14. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/tests/test_setup.py +3 -2
  15. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/tests/test_sync.py +42 -13
  16. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/tests/test_timelock.py +2 -1
  17. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/LICENSE +0 -0
  18. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/_toml.py +0 -0
  19. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/integrate.py +0 -0
  20. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/releases.py +0 -0
  21. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws/timelock.py +0 -0
  22. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws_cli.egg-info/SOURCES.txt +0 -0
  23. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws_cli.egg-info/dependency_links.txt +0 -0
  24. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws_cli.egg-info/entry_points.txt +0 -0
  25. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws_cli.egg-info/requires.txt +0 -0
  26. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/fastws_cli.egg-info/top_level.txt +0 -0
  27. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/pyproject.toml +0 -0
  28. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/setup.cfg +0 -0
  29. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/tests/test_build_backend.py +0 -0
  30. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/tests/test_news.py +0 -0
  31. {fastws_cli-0.0.40 → fastws_cli-0.0.41}/tests/test_releases.py +0 -0
  32. {fastws_cli-0.0.40 → 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.40
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
@@ -365,7 +365,7 @@ Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` and `[
365
365
 
366
366
  After `uv sync`, fastws writes `_fastws_pytest.pth` into the workspace venv's `site-packages` to default `PYTEST_DISABLE_PLUGIN_AUTOLOAD=1`, keeping pytest plugins installed for one repo from leaking into others. Repos enable the plugins they need via `-p` in `addopts` (override for a run with `PYTEST_DISABLE_PLUGIN_AUTOLOAD=""`).
367
367
 
368
- After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects, with up to one project per CPU building concurrently by default. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
368
+ After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects without a `package.json`, with up to one project per CPU building concurrently by default. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
369
369
 
370
370
  Strictly after `cargo develop` finishes, fastws runs `cargo wasm` in parallel for every repo declaring `[tool.fastws].wasm-package`, so any `post-develop-module` generators have already produced their assets and each generated `wasm/pkg/package.json` exists before JavaScript installation.
371
371
 
@@ -373,6 +373,8 @@ Fastws then runs `vp install` at the workspace root (driving pnpm underneath). N
373
373
 
374
374
  After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N> run build` (through Vite+'s managed pnpm) so local dependencies build before their consumers and independent builds share the project-concurrency limit. Packages own their build commands: AnswerUI's is `nbdev-export`, for example. Python sync runs first, so a repo-list entry such as `AnswerDotAI/answerui[dev]` supplies its Python build tools through the normal extras mechanism. No additional install lifecycle hook is needed. Cargo and other build tools retain their own incremental behavior.
375
375
 
376
+ After the JavaScript builds finish, fastws runs `cargo develop` in `bindings = "bin"` Rust projects that also have a `package.json`, using the same concurrency limit. Binaries that embed built frontend assets then compile against the updated outputs.
377
+
376
378
  `--build-workers` sets the maximum concurrent projects within the Python-native, WebAssembly, and JavaScript build phases, defaulting to the CPU count; `--build-workers 1` runs each phase serially. It is separate from `--workers`, which controls cloning, pulling and dependency updates. Cargo keeps its own within-project parallelism, so increasing project concurrency also increases CPU and memory demand. Cargo may serialize builds that share a target directory.
377
379
 
378
380
  When JavaScript workspaces are present, fastws requires Vite+ (`vp`) on `PATH` with managed `node` and `pnpm` shims active. When WebAssembly packages (`[tool.fastws].wasm-package`) are present, fastws also requires rustup's `rustc`/`cargo` proxies and the `wasm32-unknown-unknown` target. Run `ws-setup` to install or configure any missing prerequisites.
@@ -336,7 +336,7 @@ Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` and `[
336
336
 
337
337
  After `uv sync`, fastws writes `_fastws_pytest.pth` into the workspace venv's `site-packages` to default `PYTEST_DISABLE_PLUGIN_AUTOLOAD=1`, keeping pytest plugins installed for one repo from leaking into others. Repos enable the plugins they need via `-p` in `addopts` (override for a run with `PYTEST_DISABLE_PLUGIN_AUTOLOAD=""`).
338
338
 
339
- After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects, with up to one project per CPU building concurrently by default. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
339
+ After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects without a `package.json`, with up to one project per CPU building concurrently by default. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
340
340
 
341
341
  Strictly after `cargo develop` finishes, fastws runs `cargo wasm` in parallel for every repo declaring `[tool.fastws].wasm-package`, so any `post-develop-module` generators have already produced their assets and each generated `wasm/pkg/package.json` exists before JavaScript installation.
342
342
 
@@ -344,6 +344,8 @@ Fastws then runs `vp install` at the workspace root (driving pnpm underneath). N
344
344
 
345
345
  After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N> run build` (through Vite+'s managed pnpm) so local dependencies build before their consumers and independent builds share the project-concurrency limit. Packages own their build commands: AnswerUI's is `nbdev-export`, for example. Python sync runs first, so a repo-list entry such as `AnswerDotAI/answerui[dev]` supplies its Python build tools through the normal extras mechanism. No additional install lifecycle hook is needed. Cargo and other build tools retain their own incremental behavior.
346
346
 
347
+ After the JavaScript builds finish, fastws runs `cargo develop` in `bindings = "bin"` Rust projects that also have a `package.json`, using the same concurrency limit. Binaries that embed built frontend assets then compile against the updated outputs.
348
+
347
349
  `--build-workers` sets the maximum concurrent projects within the Python-native, WebAssembly, and JavaScript build phases, defaulting to the CPU count; `--build-workers 1` runs each phase serially. It is separate from `--workers`, which controls cloning, pulling and dependency updates. Cargo keeps its own within-project parallelism, so increasing project concurrency also increases CPU and memory demand. Cargo may serialize builds that share a target directory.
348
350
 
349
351
  When JavaScript workspaces are present, fastws requires Vite+ (`vp`) on `PATH` with managed `node` and `pnpm` shims active. When WebAssembly packages (`[tool.fastws].wasm-package`) are present, fastws also requires rustup's `rustc`/`cargo` proxies and the `wasm32-unknown-unknown` target. Run `ws-setup` to install or configure any missing prerequisites.
@@ -1,4 +1,5 @@
1
- __version__ = "0.0.40"
1
+ __version__ = "0.0.41"
2
+
2
3
 
3
4
 
4
5
 
@@ -41,11 +41,10 @@ def build_editable(wheel_directory, config_settings=None, metadata_directory=Non
41
41
  tag = next(line.removeprefix('Tag: ') for line in (info/'WHEEL').read_text().splitlines() if line.startswith('Tag: '))
42
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'}
43
43
  root = Path.cwd()
44
- if py_src := settings(root)['maturin'].get('python-source'):
45
- files[f'{name}.pth'] = f'{(root/py_src).resolve()}\n'.encode()
44
+ if py_src := settings(root)['maturin'].get('python-source'): files[f'{name}.pth'] = f'{(root/py_src).resolve()}\n'.encode()
46
45
  record = f'{info.name}/RECORD'
47
46
  rows = [(path, 'sha256=' + base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b'=').decode(), len(data))
48
- for path, data in files.items()]
47
+ for path, data in files.items()]
49
48
  buffer = io.StringIO()
50
49
  csv.writer(buffer).writerows([*rows, (record, '', '')])
51
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
- {k: '\n'.join(v).strip('\n') for k,v in failures.items()},
113
- next((l for l in lines if l.startswith('test result: ')), ''), bool(returncode), timed_out)
111
+ {k: '\n'.join(v).strip('\n') for k,v in failures.items()},
112
+ next((l for l in lines if l.startswith('test result: ')), ''), bool(returncode), timed_out)
114
113
 
115
114
  def __str__(self):
116
115
  n = Counter(self.tests.values())
@@ -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)
@@ -317,7 +317,7 @@ members = ["./*"]
317
317
  return True
318
318
 
319
319
  def _sync_ws_pyproject(pyproject_path: Path, template_path: Path, projects: list[str], externals: list[tuple] = None,
320
- extras: dict[str, set[str]] = None) -> list[str]:
320
+ extras: dict[str, set] = None) -> list[str]:
321
321
  if not pyproject_path.exists():
322
322
  if template_path.exists(): shutil.copyfile(template_path, pyproject_path)
323
323
  else: _init_ws_pyproject(pyproject_path)
@@ -348,7 +348,7 @@ def _sync_ws_pyproject(pyproject_path: Path, template_path: Path, projects: list
348
348
  if content != original: pyproject_path.write_text(content)
349
349
  return missing + [n for n,_ in ext_missing]
350
350
 
351
- def _sync_build_backend(pyproject_path: Path, projects: list[tuple[str, Path]]):
351
+ def _sync_build_backend(pyproject_path: Path, projects: list[tuple]):
352
352
  "Regenerate uv's build-isolation and metadata-only config settings for projects using the fastws backend."
353
353
  from .build_backend import METADATA_ONLY
354
354
  content = pyproject_path.read_text()
@@ -373,8 +373,7 @@ def _sync_build_backend(pyproject_path: Path, projects: list[tuple[str, Path]]):
373
373
  if new_cfg:
374
374
  lines = "\n".join(f"{_toml_key(pkg)} = {_fmt_source(new_cfg[pkg])}" for pkg in sorted(new_cfg))
375
375
  content = _replace_table(content, 'tool.uv.config-settings-package', lines)
376
- elif span := _table_span(content, 'tool.uv.config-settings-package'):
377
- content = content[:span[0]] + content[span[1]:]
376
+ elif span := _table_span(content, 'tool.uv.config-settings-package'): content = content[:span[0]] + content[span[1]:]
378
377
  tomllib.loads(content)
379
378
  pyproject_path.write_text(content)
380
379
 
@@ -790,8 +789,7 @@ def ws_build(
790
789
  artifacts = [('sdist', n, d) for n,d in py]
791
790
  artifacts += [('npm', p['name'], d) for d,p in packages.items() if p.get('name') and p.get('version') and not p.get('private')]
792
791
  artifacts += [('npm', p['name'], d) for d,p in wasm_dists.items() if p.get('name') and p.get('version') and not p.get('private')]
793
- js_closure = {d: _dependency_dirs(d, js_graph)
794
- for d,p in packages.items() if p.get('scripts', {}).get('build')}
792
+ js_closure = {d: _dependency_dirs(d, js_graph) for d, p in packages.items() if p.get('scripts', {}).get('build')}
795
793
  for _, d in py:
796
794
  if nested := [j for j in _js_package_specs(d) if j in js_closure]: js_closure[d] = {d}.union(*(js_closure[j] for j in nested))
797
795
  lock = root/'pnpm-lock.yaml'
@@ -879,8 +877,8 @@ def _local_crates(root: Path) -> list[tuple[dict, Path]]:
879
877
  def _registry_requirements(root: Path) -> set[str]:
880
878
  "Packages that some manifest under `root` requires from crates.io: a version with no `path`, `git`, `registry` or `workspace` key"
881
879
  return {spec.get("package", name) if isinstance(spec, dict) else name
882
- for crate in _crate_dirs(root) for data, _ in _crate_manifests(crate) for deps in _cargo_dep_tables(data, every=True)
883
- for name, spec in deps.items() if isinstance(spec, str) or isinstance(spec, dict) and not {"path", "git", "registry", "workspace"} & spec.keys()}
880
+ for crate in _crate_dirs(root) for data, _ in _crate_manifests(crate) for deps in _cargo_dep_tables(data, every=True)
881
+ for name, spec in deps.items() if isinstance(spec, str) or isinstance(spec, dict) and not {"path", "git", "registry", "workspace"} & spec.keys()}
884
882
 
885
883
  def _git_dep_tables(root: Path, crates: dict[str, Path]) -> dict[str, dict[str, Path]]:
886
884
  "Git URL -> {package: local dir} for members' git deps that name a local crate"
@@ -985,8 +983,7 @@ def _sccache_disk_dir() -> Path:
985
983
  if os.name == "nt": return Path(os.environ.get("LOCALAPPDATA", Path.home()/"AppData/Local"))/"Mozilla/sccache"
986
984
  return Path(os.environ.get("XDG_CACHE_HOME", Path.home()/".cache"))/"sccache"
987
985
 
988
- def _aws_creds_path() -> Path:
989
- return Path(os.environ.get("AWS_SHARED_CREDENTIALS_FILE", Path.home()/".aws/credentials")).expanduser()
986
+ def _aws_creds_path() -> Path: return Path(os.environ.get("AWS_SHARED_CREDENTIALS_FILE", Path.home()/".aws/credentials")).expanduser()
990
987
 
991
988
  def _parse_sccache_r2(url: str) -> dict:
992
989
  "Parse `SCCACHE_R2` (`https://[key:secret@]<acct>.r2.cloudflarestorage.com/<bucket>[/prefix][?rw_mode=READ_ONLY]`)."
@@ -1187,11 +1184,16 @@ def _merge_shared(data: dict, shared: dict) -> dict:
1187
1184
 
1188
1185
  def _rel_ws_path(root: Path, d: Path) -> str: return Path(os.path.relpath(d.resolve(), root.resolve())).as_posix()
1189
1186
 
1187
+ def _maturin_cfg(d: Path) -> dict:
1188
+ p = d/'pyproject.toml'
1189
+ return tomllib.loads(p.read_text()).get('tool', {}).get('maturin', {}) if p.exists() else {}
1190
+
1190
1191
  def _is_maturin_native(d: Path) -> bool:
1191
- if not (d/'pyproject.toml').exists(): return False
1192
- cfg = tomllib.loads((d/'pyproject.toml').read_text()).get('tool', {}).get('maturin', {})
1192
+ cfg = _maturin_cfg(d)
1193
1193
  return 'python-source' in cfg or cfg.get('bindings') == 'bin'
1194
1194
 
1195
+ def _is_bin_with_js(d: Path) -> bool: return (d/'package.json').is_file() and _maturin_cfg(d).get('bindings') == 'bin'
1196
+
1195
1197
  def _repo_roots(root: Path, repos_file="repos.txt") -> list[Path]:
1196
1198
  "Candidate top-level workspace directories plus registered external checkouts."
1197
1199
  exclude = _fastws_cfg(root).get("exclude", [])
@@ -1289,8 +1291,7 @@ def _sync_ws_package_json(root: Path, toolchain: dict[str, str] = None) -> bool:
1289
1291
  before = json.dumps(data)
1290
1292
  data["private"] = True
1291
1293
  data.pop("workspaces", None)
1292
- if toolchain and (vp_v := toolchain.get("vite-plus")):
1293
- data["devDependencies"] = {**data.get("devDependencies", {}), "vite-plus": vp_v}
1294
+ if toolchain and (vp_v := toolchain.get("vite-plus")): data["devDependencies"] = {**data.get("devDependencies", {}), "vite-plus": vp_v}
1294
1295
  shared = root/"package.json.shared"
1295
1296
  if shared.exists(): _merge_shared(data, json.loads(shared.read_text()))
1296
1297
  if json.dumps(data) == before: return False
@@ -1316,10 +1317,7 @@ def _check_rustup(wasm: bool = False):
1316
1317
  for tool in "rustc","cargo":
1317
1318
  path = shutil.which(tool)
1318
1319
  if path and os.path.samefile(path, rustup): continue
1319
- raise SystemExit(f"Rust-backed WebAssembly builds require rustup-managed Rust, but {tool} resolves to {path or 'nothing'}. "
1320
- "Put rustup's bin directory first on PATH after Homebrew or other toolchain setup in your shell profile "
1321
- '(normally: export PATH="$HOME/.cargo/bin:$PATH"; use $CARGO_HOME/bin when customized). '
1322
- "Homebrew Rust can remain installed. Open a new shell and rerun ws-sync.")
1320
+ raise SystemExit(f"""Rust-backed WebAssembly builds require rustup-managed Rust, but {tool} resolves to {path or 'nothing'}. Put rustup's bin directory first on PATH after Homebrew or other toolchain setup in your shell profile (normally: export PATH="$HOME/.cargo/bin:$PATH"; use $CARGO_HOME/bin when customized). Homebrew Rust can remain installed. Open a new shell and rerun ws-sync.""")
1323
1321
  if wasm:
1324
1322
  installed = subprocess.run([rustup, "target", "list", "--installed"], capture_output=True, text=True, check=True).stdout.splitlines()
1325
1323
  if "wasm32-unknown-unknown" not in installed:
@@ -1327,14 +1325,11 @@ def _check_rustup(wasm: bool = False):
1327
1325
 
1328
1326
  def _check_vp():
1329
1327
  "Require Vite+ (`vp`) and its managed `node` and `pnpm` shims on PATH."
1330
- if not (vp := shutil.which("vp")):
1331
- raise SystemExit("JavaScript workspaces require Vite+ (vp). Run ws-setup to install it.")
1328
+ if not (vp := shutil.which("vp")): raise SystemExit("JavaScript workspaces require Vite+ (vp). Run ws-setup to install it.")
1332
1329
  for tool in "node", "pnpm":
1333
1330
  path = shutil.which(tool)
1334
1331
  if path and os.path.samefile(path, vp): continue
1335
- raise SystemExit(f"JavaScript workspaces require Vite+-managed {tool}, but {tool} resolves to {path or 'nothing'}. "
1336
- "Run ws-setup to enable Vite+ managed shims, and put Vite+'s bin directory first on PATH "
1337
- "(normally via `~/.config/vite-plus/env`), then open a new shell and rerun ws-sync.")
1332
+ raise SystemExit(f"JavaScript workspaces require Vite+-managed {tool}, but {tool} resolves to {path or 'nothing'}. Run ws-setup to enable Vite+ managed shims, and put Vite+'s bin directory first on PATH (normally via `~/.config/vite-plus/env`), then open a new shell and rerun ws-sync.")
1338
1333
 
1339
1334
  def _vp_toolchain() -> dict[str, str]:
1340
1335
  "Versions of `vite-plus`, `vite-plus-core`, and `vitest` from the global `vp` CLI."
@@ -1436,12 +1431,17 @@ async def ws_sync(
1436
1431
  _write_pytest_pth(root)
1437
1432
  from .cargo import develop
1438
1433
  native = [d.resolve() for _,d in projects if _is_maturin_native(d)]
1439
- with ThreadPoolExecutor(max_workers=build_workers) as ex: list(ex.map(develop, native))
1434
+ post_js = [d for d in native if _is_bin_with_js(d)]
1435
+ pre_js = [d for d in native if d not in post_js]
1436
+ if pre_js:
1437
+ with ThreadPoolExecutor(max_workers=build_workers) as ex: list(ex.map(develop, pre_js))
1440
1438
  if wasm_pkgs:
1441
1439
  with ThreadPoolExecutor(max_workers=build_workers) as ex: list(ex.map(_build_wasm, wasm_pkgs))
1442
1440
  if up: _upgrade_stamp(root).touch()
1443
1441
  if cargo_up: _upgrade_stamp(root, "fastws-cargo-upgraded").touch()
1444
1442
  if js_members: _sync_js(root, build_workers)
1443
+ if post_js:
1444
+ with ThreadPoolExecutor(max_workers=build_workers) as ex: list(ex.map(develop, post_js))
1445
1445
 
1446
1446
  @call_parse
1447
1447
  async def ws_add(
@@ -89,8 +89,7 @@ async def _repo_news(entry, since, until, commits, model, max_chars):
89
89
  return f'## {name}\n\n{info}\n\n{summary}\n'
90
90
 
91
91
  def _save_checkpoint(path, state):
92
- with tempfile.NamedTemporaryFile(mode='w', dir=path.parent, delete=False) as f:
93
- json.dump(state, f, indent=2)
92
+ with tempfile.NamedTemporaryFile(mode='w', dir=path.parent, delete=False) as f: json.dump(state, f, indent=2)
94
93
  Path(f.name).replace(path)
95
94
 
96
95
  @call_parse(pos=['project'])
@@ -25,7 +25,7 @@ def bounded(
25
25
  env = kwargs.pop('env', None)
26
26
  env = dict(os.environ if env is None else env) | {JOB_ENV: '1'}
27
27
  with subprocess.Popen(cmd, stdin=None if input is None else subprocess.PIPE, stdout=subprocess.PIPE,
28
- stderr=subprocess.STDOUT if merge else subprocess.PIPE, text=True, start_new_session=owner, env=env, **kwargs) as p:
28
+ stderr=subprocess.STDOUT if merge else subprocess.PIPE, text=True, start_new_session=owner, env=env, **kwargs) as p:
29
29
  try:
30
30
  try: out, err = p.communicate(input, timeout=seconds)
31
31
  except BaseException as e:
@@ -36,7 +36,7 @@ def bounded(
36
36
  p.kill()
37
37
  p.wait()
38
38
  out, err = (s.decode(errors='replace') if isinstance(s, bytes) else s or ''
39
- for s in (getattr(e, 'output', ''), getattr(e, 'stderr', '')))
39
+ for s in (getattr(e, 'output', ''), getattr(e, 'stderr', '')))
40
40
  if not isinstance(e, subprocess.TimeoutExpired): raise
41
41
  tail = '\n'.join(f' {line}' for line in (out + (err or '')).splitlines()[-20:])
42
42
  cleanup = 'its process group was killed' if owner else 'its child was killed; the job owner must clean up descendants'
@@ -55,8 +55,7 @@ def _blob(path):
55
55
  def dep_files(artifact):
56
56
  "The files that Cargo's dep-info lists for `artifact`, the `.d` file beside it, with the files under each directory it lists, such as one that a build script watches."
57
57
  deps = re.split(r'(?<!\\)\s+', Path(artifact).with_suffix('.d').read_text().split(': ', 1)[1].strip())
58
- for p in (Path(d.replace('\\ ', ' ')) for d in deps):
59
- yield from (sorted(f for f in p.rglob('*') if f.is_file()) if p.is_dir() else [p])
58
+ for p in (Path(d.replace('\\ ', ' ')) for d in deps): yield from (sorted(f for f in p.rglob('*') if f.is_file()) if p.is_dir() else [p])
60
59
 
61
60
 
62
61
  def _kept(d):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.40
3
+ Version: 0.0.41
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License-Expression: Apache-2.0
@@ -365,7 +365,7 @@ Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` and `[
365
365
 
366
366
  After `uv sync`, fastws writes `_fastws_pytest.pth` into the workspace venv's `site-packages` to default `PYTEST_DISABLE_PLUGIN_AUTOLOAD=1`, keeping pytest plugins installed for one repo from leaking into others. Repos enable the plugins they need via `-p` in `addopts` (override for a run with `PYTEST_DISABLE_PLUGIN_AUTOLOAD=""`).
367
367
 
368
- After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects, with up to one project per CPU building concurrently by default. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
368
+ After `uv sync`, fastws runs `cargo develop` in mixed Rust/Python projects and `bindings = "bin"` Rust CLI projects without a `package.json`, with up to one project per CPU building concurrently by default. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo.
369
369
 
370
370
  Strictly after `cargo develop` finishes, fastws runs `cargo wasm` in parallel for every repo declaring `[tool.fastws].wasm-package`, so any `post-develop-module` generators have already produced their assets and each generated `wasm/pkg/package.json` exists before JavaScript installation.
371
371
 
@@ -373,6 +373,8 @@ Fastws then runs `vp install` at the workspace root (driving pnpm underneath). N
373
373
 
374
374
  After installation, fastws runs `pnpm -r --if-present --workspace-concurrency=<N> run build` (through Vite+'s managed pnpm) so local dependencies build before their consumers and independent builds share the project-concurrency limit. Packages own their build commands: AnswerUI's is `nbdev-export`, for example. Python sync runs first, so a repo-list entry such as `AnswerDotAI/answerui[dev]` supplies its Python build tools through the normal extras mechanism. No additional install lifecycle hook is needed. Cargo and other build tools retain their own incremental behavior.
375
375
 
376
+ After the JavaScript builds finish, fastws runs `cargo develop` in `bindings = "bin"` Rust projects that also have a `package.json`, using the same concurrency limit. Binaries that embed built frontend assets then compile against the updated outputs.
377
+
376
378
  `--build-workers` sets the maximum concurrent projects within the Python-native, WebAssembly, and JavaScript build phases, defaulting to the CPU count; `--build-workers 1` runs each phase serially. It is separate from `--workers`, which controls cloning, pulling and dependency updates. Cargo keeps its own within-project parallelism, so increasing project concurrency also increases CPU and memory demand. Cargo may serialize builds that share a target directory.
377
379
 
378
380
  When JavaScript workspaces are present, fastws requires Vite+ (`vp`) on `PATH` with managed `node` and `pnpm` shims active. When WebAssembly packages (`[tool.fastws].wasm-package`) are present, fastws also requires rustup's `rustc`/`cargo` proxies and the `wasm32-unknown-unknown` target. Run `ws-setup` to install or configure any missing prerequisites.
@@ -8,7 +8,7 @@ def _mk_proj(root, name, extra=''):
8
8
  d.mkdir()
9
9
  (d/'pyproject.toml').write_text(fr'''[project]
10
10
  name = "{name}"
11
- {extra}
11
+ {extra}
12
12
  ''')
13
13
  return d
14
14
 
@@ -56,10 +56,8 @@ def _write_cached_vp_shared(root):
56
56
  vp = Path(shutil.which('vp')).resolve().parent.parent
57
57
  pm = json.loads((vp/'package.json').read_text())['packageManager']
58
58
  node_vers = sorted(p.name for p in (vp.parent/'js_runtime'/'node').iterdir() if p.is_dir())
59
- (root/'package.json.shared').write_text(json.dumps({
60
- 'packageManager': pm,
61
- 'devEngines': {'runtime': {'name': 'node', 'version': node_vers[-1]}},
62
- }))
59
+ (root / 'package.json.shared').write_text(json.dumps({'packageManager': pm,
60
+ 'devEngines': {'runtime': {'name': 'node', 'version': node_vers[-1]}}}))
63
61
 
64
62
 
65
63
 
@@ -101,13 +99,12 @@ const version = fs.readFileSync('../pnpm-lock.yaml', 'utf8').match(/theme@([^\s:
101
99
  fs.writeFileSync('dist/style.txt', fs.readFileSync('../styles/generated.txt', 'utf8') + ':' + version);
102
100
  console.log('bundled app');
103
101
  ''')
104
- style_pkg = {'name':'@example/styles', 'version':'0.1.0', 'files':['generated.txt'], 'scripts':{'build':'node build.js'}}
102
+ style_pkg = dict(name='@example/styles', version='0.1.0', files=['generated.txt'], scripts={'build':'node build.js'})
105
103
  (styles/'package.json').write_text(json.dumps(style_pkg))
106
- (app/'package.json').write_text(json.dumps({'name':'@example/app', 'version':'0.1.0', 'files':['dist'],
107
- 'dependencies':{'@example/styles':'^0.1.0'}, 'scripts':{'build':'node build.js'}}))
104
+ (app/'package.json').write_text(json.dumps(dict(name='@example/app', version='0.1.0', files=['dist'], dependencies={'@example/styles':'^0.1.0'}, scripts={'build':'node build.js'})))
108
105
  (app/'frontend').mkdir()
109
- (app/'frontend'/'package.json').write_text(json.dumps({'name':'priv-fe', 'version':'0.0.0', 'private':True,
110
- 'scripts':{'build': 'node -e "require(\'node:fs\').writeFileSync(\'built.txt\', \'ok\')"'}}))
106
+ (app/'frontend'/'package.json').write_text(json.dumps(dict(name='priv-fe', version='0.0.0', private=True,
107
+ scripts={'build': 'node -e "require(\'node:fs\').writeFileSync(\'built.txt\', \'ok\')"'})))
111
108
  _write_cached_vp_shared(tmp_path)
112
109
  core._sync_ws_pnpm_workspace(tmp_path, core._js_dirs(tmp_path))
113
110
  core._sync_ws_package_json(tmp_path)
@@ -264,7 +261,7 @@ default-filter = "rdeps(optional)"
264
261
  r = run_tests([a, b], profiles=('one', 'two'))
265
262
  tests = {s.name: s.tests for s in r.suites if s.tests}
266
263
  assert not r.ok and tests == {'a one: unittests src/lib.rs': {'t::passes': 'ok'}, 'a one: tests/more.rs': {'other': 'ok'},
267
- 'b one: tests/fine.rs': {'fine': 'ok'}, 'a two: unittests src/lib.rs': {'t::fails': 'FAILED'}}, r.text
264
+ 'b one: tests/fine.rs': {'fine': 'ok'}, 'a two: unittests src/lib.rs': {'t::fails': 'FAILED'}}, r.text
268
265
  first = run_tests([a, b], profiles=('two', 'one'))
269
266
  assert not first.ok and {s.name for s in first.suites if s.tests} == {'a two: unittests src/lib.rs'}
270
267
 
@@ -11,9 +11,12 @@ def test_snapshot_takes_the_working_tree_and_leaves_head_and_index(tmp_path):
11
11
  git(tmp_path, "init", "-q")
12
12
  (tmp_path/".gitignore").write_text("ignored\n")
13
13
  (tmp_path/"kept").write_text("old")
14
- git(tmp_path, "add", "-A"); git(tmp_path, "-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "base")
14
+ git(tmp_path, "add", "-A")
15
+ git(tmp_path, "-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "base")
15
16
  head = git(tmp_path, "rev-parse", "HEAD")
16
- (tmp_path/"kept").write_text("new"); (tmp_path/"untracked").write_text("u"); (tmp_path/"ignored").write_text("i")
17
+ (tmp_path/"kept").write_text("new")
18
+ (tmp_path/"untracked").write_text("u")
19
+ (tmp_path/"ignored").write_text("i")
17
20
  commit = snapshot(tmp_path)
18
21
  assert git(tmp_path, "show", f"{commit}:kept") == "new"
19
22
  assert git(tmp_path, "show", f"{commit}:untracked") == "u"
@@ -1,4 +1,4 @@
1
- import fcntl, os, subprocess, sys, threading, pytest
1
+ import fcntl, os, subprocess, sys, threading
2
2
  from fastws.procs import JOB_ENV, kill_group
3
3
 
4
4
 
@@ -24,7 +24,7 @@ print('job survived inner timeout', flush=True)
24
24
  time.sleep(60)
25
25
  '''
26
26
  with subprocess.Popen([sys.executable, '-c', job], start_new_session=True, env=os.environ | {JOB_ENV: '1'},
27
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) as p:
27
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) as p:
28
28
  lines, survived = [], threading.Event()
29
29
  def read():
30
30
  for line in p.stdout:
@@ -16,7 +16,8 @@ def test_setup_preserves_existing_destinations(tmp_path):
16
16
 
17
17
  def test_sccache_config_merge_and_schema(tmp_path):
18
18
  ws1, ws2 = tmp_path/'ws1', tmp_path/'ws2'
19
- ws1.mkdir(); ws2.mkdir()
19
+ ws1.mkdir()
20
+ ws2.mkdir()
20
21
  existing = 'server_startup_timeout_ms = 5000\n\n[dist]\nscheduler_url = "http://1.2.3.4:10600"\n'
21
22
  spec = core._parse_sccache_r2('https://r2id:r2sec@acct.r2.cloudflarestorage.com/aai-sccache')
22
23
  rendered = core._render_sccache_config(ws1, spec, existing)
@@ -27,7 +28,7 @@ def test_sccache_config_merge_and_schema(tmp_path):
27
28
  assert data['basedirs'] == [str(ws1.resolve()), str(ws2.resolve())]
28
29
  pub = core._render_sccache_config(ws1, core._parse_sccache_r2('https://acct.r2.cloudflarestorage.com/pub/pfx'), '')
29
30
  if os.name != 'nt' and (sc := shutil.which('sccache')):
30
- env = {'PATH': os.environ['PATH'], 'HOME': str(tmp_path), 'SCCACHE_SERVER_UDS': str(tmp_path/'sc.sock')}
31
+ env = dict(PATH=os.environ['PATH'], HOME=str(tmp_path), SCCACHE_SERVER_UDS=str(tmp_path/'sc.sock'))
31
32
  for name, text in (('auth', merged), ('pub', pub)):
32
33
  cfg = tmp_path/f'{name}.toml'
33
34
  cfg.write_text(text)
@@ -1,4 +1,4 @@
1
- import json, os, subprocess, sys, pytest
1
+ import json, os, subprocess, pytest
2
2
  from fastgit import Git
3
3
  import fastws.core as core
4
4
 
@@ -80,8 +80,12 @@ def test_invalid_repo_extras(entry):
80
80
 
81
81
  def test_sync_extras_preserves_constraints_markers_and_unrelated_settings(tmp_path):
82
82
  pyproject = tmp_path/'pyproject.toml'
83
- pyproject.write_text('[project]\nname = "ws"\ndependencies = [\'My_Pkg[old]>=1; python_version >= "3.10"\', "other[keep]"]\n'
84
- '[tool.uv.sources]\nMy_Pkg = { path = "../somewhere", editable = true }\n')
83
+ pyproject.write_text('''[project]
84
+ name = "ws"
85
+ dependencies = ['My_Pkg[old]>=1; python_version >= "3.10"', "other[keep]"]
86
+ [tool.uv.sources]
87
+ My_Pkg = { path = "../somewhere", editable = true }
88
+ ''')
85
89
  for extras in ({'dev', 'test'}, set()):
86
90
  core._sync_ws_pyproject(pyproject, tmp_path/'pyproject.tmpl', ['my-pkg'], extras={'my-pkg': extras})
87
91
  data = core.tomllib.loads(pyproject.read_text())
@@ -140,18 +144,42 @@ def test_ws_remove_refuses_unsafe_repos(tmp_path):
140
144
  def test_sync_cargo_patches_generates_and_preserves(tmp_path):
141
145
  (tmp_path/'.cargo').mkdir()
142
146
  config = tmp_path/'.cargo'/'config.toml'
143
- config.write_text('[term]\nquiet = true\n\n[patch.crates-io]\n'
144
- f'foreign = {{ path = "/elsewhere/foreign" }}\ngone = {{ path = "{tmp_path}/gone" }}\n')
147
+ config.write_text(f'''[term]
148
+ quiet = true
149
+
150
+ [patch.crates-io]
151
+ foreign = {{ path = "/elsewhere/foreign" }}
152
+ gone = {{ path = "{tmp_path}/gone" }}
153
+ ''')
145
154
  config.write_text(core._replace_table(config.read_text(), 'unstable', 'checksum-freshness = true'))
146
155
  crate1, helper = tmp_path/'crate1', tmp_path/'helper'
147
- crate1.mkdir(); helper.mkdir()
148
- (crate1/'Cargo.toml').write_text('[package]\nname = "crate1"\nversion = "0.1.0"\n\n[dependencies]\nfamily = { git = "https://example.com/family" }\n'
149
- '\n[dev-dependencies]\nfamily-sub = { version = "0.1" }\n')
156
+ crate1.mkdir()
157
+ helper.mkdir()
158
+ (crate1/'Cargo.toml').write_text('''[package]
159
+ name = "crate1"
160
+ version = "0.1.0"
161
+
162
+ [dependencies]
163
+ family = { git = "https://example.com/family" }
164
+
165
+ [dev-dependencies]
166
+ family-sub = { version = "0.1" }
167
+ ''')
150
168
  (helper/'Cargo.toml').write_text('[package]\nname = "helper"\nversion = "0.1.0"\n')
151
169
  family = tmp_path/'family'
152
170
  (family/'sub').mkdir(parents=True)
153
- (family/'Cargo.toml').write_text('[package]\nname = "family"\nversion = "0.1.0"\npublish = false\n\n[workspace]\nmembers = ["sub"]\n'
154
- '\n[workspace.dependencies]\nhelper = "0.1"\ncrate1 = { path = "../crate1", version = "0.1" }\n')
171
+ (family/'Cargo.toml').write_text('''[package]
172
+ name = "family"
173
+ version = "0.1.0"
174
+ publish = false
175
+
176
+ [workspace]
177
+ members = ["sub"]
178
+
179
+ [workspace.dependencies]
180
+ helper = "0.1"
181
+ crate1 = { path = "../crate1", version = "0.1" }
182
+ ''')
155
183
  (family/'sub'/'Cargo.toml').write_text('[package]\nname = "family-sub"\nversion = "0.1.0"\n')
156
184
 
157
185
  added, removed = core._sync_cargo_patches(tmp_path, root_dir=True)
@@ -186,10 +214,10 @@ def test_sync_ws_pnpm_workspace_and_package_json(tmp_path):
186
214
 
187
215
  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')
188
216
  core._sync_ws_pnpm_workspace(tmp_path, [tmp_path/'app'], toolchain=tc)
189
- assert core._yaml_load(ws)['overrides'] == {'keep': '1.0.0', 'vite': 'npm:@voidzero-dev/vite-plus-core@8.3.8000', 'vitest': '5.1.0'}
217
+ assert core._yaml_load(ws)['overrides'] == dict(keep='1.0.0', vite='npm:@voidzero-dev/vite-plus-core@8.3.8000', vitest='5.1.0')
190
218
 
191
219
  pkg, pkg_shared = tmp_path/'package.json', tmp_path/'package.json.shared'
192
- pkg.write_text(json.dumps({'name': 'local', 'workspaces': ['stale'], 'devDependencies': {'keep': '1'}}))
220
+ pkg.write_text(json.dumps(dict(name='local', workspaces=['stale'], devDependencies={'keep': '1'})))
193
221
  pkg_shared.write_text(json.dumps({'packageManager': 'pnpm@10.34.9'}))
194
222
  assert core._sync_ws_package_json(tmp_path, toolchain=tc) is True
195
223
  out = json.loads(pkg.read_text())
@@ -206,7 +234,8 @@ def test_sync_build_backend(tmp_path):
206
234
  ws = tmp_path/'pyproject.toml'
207
235
  ws.write_text('[project]\nname = "ws"\n\n[tool.uv.config-settings-package]\na = { "maturin.build-args" = ["--features", "x"] }\nb = { metadata-only = "1", custom = "yes" }\ngone = { metadata-only = "1" }\n')
208
236
  a, b = tmp_path/'a', tmp_path/'b'
209
- a.mkdir(); b.mkdir()
237
+ a.mkdir()
238
+ b.mkdir()
210
239
  (a/'pyproject.toml').write_text('[build-system]\nbuild-backend = "fastws.build_backend"\n[project]\nname = "a"\n')
211
240
  (b/'pyproject.toml').write_text('[build-system]\nbuild-backend = "maturin"\n[project]\nname = "b"\n')
212
241
  core._sync_build_backend(ws, [('a', a), ('b', b)])
@@ -13,7 +13,8 @@ def test_shared_hold_outlives_other_thread(tmp_path, monkeypatch):
13
13
  t = threading.Thread(target=hold, daemon=True)
14
14
  try:
15
15
  with timelock.timing_lock():
16
- t.start(); assert held.wait(3)
16
+ t.start()
17
+ assert held.wait(3)
17
18
  with open(timelock.LOCK) as f, pytest.raises(BlockingIOError): fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
18
19
  finally:
19
20
  release.set()
File without changes
File without changes
File without changes
File without changes