An extension of fabricatio
Project description
fabricatio-workspace
Git worktree management for Fabricatio, backed by Rust via PyO3 bindings.
Installation
pip install fabricatio[workspace]
# or: pip install fabricatio-workspace
Overview
fabricatio-workspace provides high-performance Git worktree operations — fork, commit, and prune — implemented in Rust and exposed to Python through PyO3 bindings. It is designed for agent-driven workflows that need to create isolated working branches, commit changes programmatically, and clean up stale worktrees.
The Rust layer uses git2 (libgit2) directly, avoiding subprocess overhead and providing structured error handling for every operation.
Key API
All core functions live in fabricatio_workspace.rust. A thin Python wrapper is available via fabricatio_workspace.capabilities.workspace.Workspace.
fork(repo_path, to, branch_name, base_branch=None, exist_ok=False) -> Path
Creates a new Git worktree linked to a branch. Creates the branch if it does not exist (optionally from base_branch). Returns the absolute path to the new worktree.
exist_ok=True: returns the existing worktree path instead of raising if the branch is already checked out.- On failure, partial directories are automatically cleaned up.
commit(worktree_path, msg, files=None) -> str
Stages and commits changes in a worktree. Returns the hex OID of the new commit.
files: optional list of relative paths to stage. IfNoneor empty, all modified tracked files are staged.- Author/committer identity is read from the worktree's Git config.
prune(repo_path) -> int
Prunes all stale worktree metadata from the repository. Returns the number of worktrees pruned. After pruning, branches previously locked by stale worktrees become available for checkout.
Workspace (Python wrapper)
from fabricatio_workspace.capabilities.workspace import Workspace
ws = Workspace()
path = ws.fork("/path/to/repo", "/tmp/feature-42", "feature/42", base_branch="main")
oid = ws.commit(path, "Add new feature", files=["src/module.py"])
WorkspaceConfig / workspace_config
Loaded from the Fabricatio config system (fabricatio_core.CONFIG.load("workspace", ...)). An extensible frozen dataclass for workspace-level configuration.
Usage Example
from pathlib import Path
from fabricatio_workspace.rust import fork, commit, prune
repo = Path("/home/user/my-project")
# Fork a new worktree from main
wt = fork(repo, Path("/tmp/worktrees/task-1"), "task/do-thing", base_branch="main")
# ... make changes to files in wt ...
# Commit all modified files
commit_oid = commit(wt, "Complete the task", files=None)
print(f"Committed: {commit_oid}")
# Clean up stale worktrees
removed = prune(repo)
print(f"Pruned {removed} stale worktree(s)")
Dependencies
fabricatio-core— configuration loading and core interfacesgit2(vendored, vialibgit2) — all Git operations run in-process through Rust, nogitCLI required
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fabricatio_workspace-0.1.4-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
237e55312ff23e05cdecb492477aa1d85024207c1a79d771b5b794899ced17b6
|
|
| MD5 |
c8506ce228d1e603741d463f8f32b84c
|
|
| BLAKE2b-256 |
520ffebe3b2d054f42297f971a61739cf61c7fc74029df5cdfe4311e4073bb70
|
File details
Details for the file fabricatio_workspace-0.1.4-cp314-cp314-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp314-cp314-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.14, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99480540ca08c4ab90d31408657cd2560fcae4bb1819bc30266e3ceb4f533e19
|
|
| MD5 |
f5dd344c6e86c591501106ba8318666d
|
|
| BLAKE2b-256 |
2820eb97a99a724afa7effa8e87a2c9439450883e76b7266386e3bad786a6040
|
File details
Details for the file fabricatio_workspace-0.1.4-cp314-cp314-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp314-cp314-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.14, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5fb4142052c827343a2a715b99cdc5beb85fd95021b2fc688d88333e108023f
|
|
| MD5 |
1412a5444e6298a78e0fd553949c65ee
|
|
| BLAKE2b-256 |
d195b7b91622e4b0da64863125d731be2ae3b40dbb8290566b53aa1d66425e4a
|
File details
Details for the file fabricatio_workspace-0.1.4-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afc8b7cf89fbb64aafdbe1aaefbaa69b48224f220725cfddff93b472d6282d67
|
|
| MD5 |
59ffb10aabc4e94c4a17fbeb6146862d
|
|
| BLAKE2b-256 |
a7843cae33cff3df01288611ae89c9aa6bfb41b98be2700bb744ae8b681e8944
|
File details
Details for the file fabricatio_workspace-0.1.4-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
debc870bcd4bd1b39d380bb75338f7824a10e89f3f358c905f2a0dbf64d966d1
|
|
| MD5 |
e010434a7e070dd4466312aff77773a8
|
|
| BLAKE2b-256 |
931e9666543cf851240e3d44ae023e6bc8a17da3b4e6c43b8a75545f7d67f2c2
|
File details
Details for the file fabricatio_workspace-0.1.4-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13f4fa9ba64ace95a42764d256e1906d3005f8a4fa81f95d3d73c6db65cfeb27
|
|
| MD5 |
7f03788128efd6083c615d2c0ec32161
|
|
| BLAKE2b-256 |
29455e399f45314dabb45cb11bc1b52e79b9b71f01e3421aa46bbaad6e1f5019
|
File details
Details for the file fabricatio_workspace-0.1.4-cp313-cp313-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp313-cp313-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af68502b9c20ab04544564b01797797c40ea68c6ae5427983b5d29d8f14249aa
|
|
| MD5 |
d00f11ec33621b9b5a17284cca95a4e5
|
|
| BLAKE2b-256 |
a7b9c4d0e8a21da207fe2994d6f432663c46587d76cf3b00015b153803cfd36f
|
File details
Details for the file fabricatio_workspace-0.1.4-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fef54f422f320598b4672dc62e8ce8aea40c3cea26b2c4fe2e6e8317978afbcd
|
|
| MD5 |
fc2f2f87dae18dd32ef667a5bdef8f70
|
|
| BLAKE2b-256 |
d25e35ccae880b47a24687cb149f58e92d9f918ee6390e10de46dbf1f3328223
|
File details
Details for the file fabricatio_workspace-0.1.4-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5da54ccf2a1a1802dbca8f6bd83132257c0f60eeedc08ef395bdf70ed9ac8615
|
|
| MD5 |
6eab59643fb77dba5e610e995c281079
|
|
| BLAKE2b-256 |
0f80da41b4362131267c29b0e4c76c3c617bd581241661d22c24616a5fa111b2
|
File details
Details for the file fabricatio_workspace-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c13c2ca4a868a69557b30fdb52c0d573e5ede3fe4ff73ba1e1e3ed9915e2966
|
|
| MD5 |
003d58b5078a9ef21fb6d4033f0e5dbd
|
|
| BLAKE2b-256 |
3bc1d78398c805a5fec8aafb819104f0afadf96d028b1864cbbec26cb2aeb176
|
File details
Details for the file fabricatio_workspace-0.1.4-cp312-cp312-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp312-cp312-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34b37f1ae853eb9dc527fcd81d6f4685d683b83b9fc071bf9f52108f50fa859c
|
|
| MD5 |
5a9f7cc5179a48a81bf925d33f21da95
|
|
| BLAKE2b-256 |
2bdc80ad2dba47b6d0a41d4d8814b961d5c4c99ae59c4dc3df6eabe545d3a1b4
|
File details
Details for the file fabricatio_workspace-0.1.4-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: fabricatio_workspace-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1246bc3eb24447ef4e2af034fb7d496ed740b1e73aabd424b5851ae43ac777a
|
|
| MD5 |
e5753bb775de1e57772764a358cc0b69
|
|
| BLAKE2b-256 |
a94e6dab1a5a2cc2f1bab2e6c745d7259efd70195c3f4a0e35bcadd782f3b76a
|