Skip to main content

Workspace commands

Fast workspace tools for multi-repo management.

Each command is exposed both as a ws-* or cargo-* CLI entry point and as a Python function re-exported at top-level fastws. Commands locate the workspace root from workspace, the active virtual environment’s parent, or the current directory, and raise SystemExit on invalid arguments or repository state.

Setup, cloning, and status

ws_setup

def ws_setup(
    repo:str='', # Workspace repository (owner/repo or GitHub URL) to clone; omit to check/configure an existing workspace
    dest:str='', # New workspace directory (must not exist when `repo` is given)
    workspace:str='', # Existing workspace root when `repo` is omitted; defaults to active venv parent
    repos_file:str='repos.txt', # Repo list used to detect workspace requirements
    python:str='3.13', # Python version for a new workspace environment
    workers:int=None, # Parallel workers for cloning and initial ws-sync; omit to use defaults
):

Bootstrap a new workspace, or check and complete missing toolchain and sccache setup on an existing workspace.

ws_clone

async def ws_clone(
    repos_file:str='repos.txt', # File containing repo list (one per line: owner/repo, plus an optional checkout location)
    workers:int=16, # Number of parallel workers
    workspace:str='', # Workspace root; defaults to active venv parent when available
):

Clone missing repos from the shared and local repo lists.

ws_pull

async def ws_pull(
    repos_file:str='repos.txt', # File containing repo list
    workers:int=64, # Number of parallel workers
    workspace:str='', # Workspace root; defaults to active venv parent when available
):

Pull updates for repos whose GitHub origin has moved (all repos when that can’t be checked).

ws_status

async def ws_status(
    repos_file:str='repos.txt', # File containing repo list
    branches:bool=False, # Show unpushed commit details
    stat:bool=False, # Show per-file line counts, including untracked files
    summary:bool=False, # Show one-line-per-repo summary sorted by changed lines
    dirs:bool=False, # Show line counts grouped by top-level folder
    workspace:str='', # Workspace root; defaults to active venv parent when available
):

Show uncommitted changes and optionally unpushed commit details across repos.

ws_branches

async def ws_branches(
    repos_file:str='repos.txt', # File containing repo list
    expected:str='main', # Expected branch name
    workspace:str='', # Workspace root; defaults to active venv parent when available
):

Check if all repos are on the expected branch.

Building and Cargo

cargo_develop

def cargo_develop(
    command:str='develop', # Subcommand name supplied by Cargo
    path:str='.', # Rust/Python project directory
    profile:str=None, # Cargo profile; default: tool.fastws.dev-profile, or release
    local:bool=False, # Install extension in-tree without modifying the active venv
):

Build and install a mixed Rust/Python project’s extension and opted-in binaries.

cargo_stage

def cargo_stage(
    command:str='stage', # Subcommand name supplied by Cargo
    path:str='.', # Rust/Python project directory
    profile:str='', # Cargo profile; defaults to the maturin profile or dev
    target:str='', # Cargo target triple
    features:str='', # Space or comma separated Cargo features
    all_features:bool=False, # Enable all Cargo features
    no_default_features:bool=False, # Disable default Cargo features
    zig:bool=False, # Build via `cargo zigbuild` for Linux glibc targeting
    manylinux:str='', # Target glibc version for `--zig`, e.g. `2_31` or `manylinux_2_31`
):

Stage Python-free native binaries for maturin wheel builds.

ws_build

def ws_build(
    workspace:str='', # Workspace root; defaults to active venv parent when available
    out:str='.dists', # Output directory for Python sdists and npm tarballs, relative to the workspace root
    repos_file:str='repos.txt', # Repo list, for checkouts outside the workspace root
    force:bool=False, # Rebuild every selected distribution, ignoring existing artifacts
    workers:int=16, # Number of parallel workers
    project:str=None, # Build only this package and its transitive workspace dependencies
):

Build Python sdists and npm tarballs, preparing generated JS assets first; unchanged artifacts are skipped and superseded versions pruned.

cargo_setup

def cargo_setup(
    root:str | pathlib._local.Path, # Workspace root directory (expands `~`)
    *, root_dir:bool=False, # Write `[unstable] root-dir` so Cargo uses a common source root
)->tuple[list[str], list[str]]: # `(added, removed)` patch crate names

Regenerate local Cargo patches and the compile-lock wrapper without pulling or building.

Syncing and membership

ws_sync

async def ws_sync(
    workspace:str='', # Workspace root; defaults to active venv parent when available
    repos_file:str='repos.txt', # Repo list to update from local git remotes
    pyproject_file:str='pyproject.toml', # Workspace pyproject to update
    template_file:str='pyproject.tmpl', # Template copied when pyproject.toml is missing
    workers:int=64, # Number of parallel clone, pull and dependency-update workers
    upgrade:bool=False, # Force the once-daily dependency upgrade pass
    build_workers:int=4, # Concurrent projects per build phase; defaults to CPU count
):

Pull the workspace baseline, clone missing shared/local repos, then pull projects and sync; upgrade Python deps daily and Rust toolchain/Cargo deps weekly.

ws_add

async def ws_add(
    repo:str, # Repo to add (owner/repo to clone), or an existing local folder (a path outside the workspace stays where it is)
    workspace:str='', # Workspace root; defaults to active venv parent when available
    repos_file:str='repos.txt', # Repo list to update
    pyproject_file:str='pyproject.toml', # Workspace pyproject to update
    template_file:str='pyproject.tmpl', # Template copied when pyproject.toml is missing
    workers:int=64, # Number of parallel workers
):

Add a personal repo to the local list (a local folder resolves via its origin remote), then run ws-sync.

ws_remove

def ws_remove(
    repo:str, # Repo to remove, e.g. owner/repo or a local folder name
    *repos:str, # Additional repos to remove
    workspace:str='', # Workspace root; defaults to active venv parent when available
    repos_file:str='repos.txt', # Repo list to update
    pyproject_file:str='pyproject.toml', # Workspace pyproject to update
    template_file:str='pyproject.tmpl', # Template copied when pyproject.toml is missing
):

Remove personal repos and their local metadata; shared baseline members cannot be removed.