axm-ingot — Shared helper library for the AXM forge
axm-ingot is the AXM forge's shared helper library: the single home for
small, general-purpose functions that more than one package needs. Instead of
copy-pasting the same logic into axm-ast, axm-audit, axm-init and
axm-anvil — and testing it N times, inconsistently — the logic lives here
once, is tested once, and is imported as a normal workspace dependency.
It is a pure library: no CLI, no MCP tool, no side effects. Just typed, import-ready helpers.
Why it exists
A monorepo accumulates duplication: the same "walk up to the project root",
"read [tool.uv.workspace].members", "resolve the workspace members" snippets
reappear in package after package, each with its own subtle bugs and its own
half-tested copy. axm-ingot is the deliberate counter-move — a thin,
dependency-light ingot of common code that downstream packages melt into
their own logic:
- Factor once, fix once — a bug fixed here is fixed everywhere.
- Test once, trust everywhere — helpers are covered in this package, so consumers don't re-test the same primitive.
- Stable public surface — consumers import from
axm_ingot, not from each other, keeping the dependency graph a tree (no cross-tool coupling).
Today the shared surface is uv-workspace resolution; the library grows by promotion — when a helper proves useful to a second package, it moves here.
What belongs here (the light-leaf invariant)
axm-ingot is a dependency-graph leaf imported across the whole galaxy. Its
value depends on staying light: every consumer that imports it for one small
helper inherits all of its dependencies. A fat leaf is no longer a leaf.
Hard rule — a helper may be promoted into axm-ingot only if its dependencies
are stdlib + the universal base (pydantic) — i.e. it adds no dependency the
consumer doesn't already have. dependencies here stays effectively empty.
| Belongs in ingot ✅ | Does not belong ❌ |
|---|---|
stdlib-only (pathlib, tomllib, re, dataclasses, json…) |
pulls httpx, pandas, torch, a DB driver, an SDK… |
pydantic models (already a universal AXM dep) |
anything adding a new external dependency |
e.g. resolve_workspace (tomllib + pathlib) |
e.g. request_with_retry (needs httpx) |
A reusable-but-heavy helper does not come here even when it has several
consumers: keep it reuse_in_place (import it from the package that owns it), or
give it a thematic light lib of its own (e.g. an axm-net for resilient
HTTP) — never the generic leaf. The Rule of Three (≥ 2 consumers) is necessary
for promotion but not sufficient; the dependency gate is the second lock.
Features
- uv-workspace resolution —
resolve_workspace()parses[tool.uv.workspace], expands member globs, subtractsexclude, keeps only directories carrying apyproject.toml, and returns members sorted by name. - Project-root discovery —
find_project_root()walks parents to the first ancestor holding anypyproject.toml(never returnsNone);find_workspace_root()finds the nearest uv-workspace root specifically. - Pure parsing primitive —
parse_workspace_members()returns the raw, unexpanded member strings from pyproject text, with no filesystem access. - Typed value objects — frozen
ResolvedWorkspaceandMemberdataclasses describe the resolved result. - Defensive by design — malformed TOML or a missing
[tool.uv.workspace]table yields empty/Noneresults rather than raising. - Modern Python — 3.12+ with strict typing, zero runtime dependencies beyond the standard library.
Installation
uv add axm-ingot
Or, as a sibling package inside the workspace, declare it as a workspace
dependency in your pyproject.toml:
[project]
dependencies = ["axm-ingot"]
[tool.uv.sources]
axm-ingot = { workspace = true }
Quick Start
axm-ingot is a library — you import its helpers, there is no command to run.
from pathlib import Path
from axm_ingot import (
find_project_root,
find_workspace_root,
resolve_workspace,
)
# Walk up to the nearest project root (any pyproject.toml ancestor).
root = find_project_root(Path("packages/axm-ast/src/axm_ast/core"))
# Resolve a uv workspace into its sorted members.
workspace = resolve_workspace(root)
if workspace is not None:
for member in workspace.members:
print(member.name, "->", member.path)
# Or just locate the nearest uv-workspace root.
ws_root = find_workspace_root(Path.cwd())
The pure parsing primitive is available from the uv subpackage when you only
have pyproject text (no filesystem):
from axm_ingot.uv import parse_workspace_members
members = parse_workspace_members('[tool.uv.workspace]\nmembers = ["packages/*"]\n')
# ['packages/*'] — raw, unexpanded
Public API
| Symbol | Kind | Description |
|---|---|---|
resolve_workspace(dir) |
function | Resolve a uv workspace → ResolvedWorkspace | None |
find_project_root(start) |
function | Nearest ancestor with any pyproject.toml (never None) |
find_workspace_root(start) |
function | Nearest uv-workspace root → Path | None |
parse_workspace_members(text) |
function | Raw members from pyproject text (axm_ingot.uv) |
ResolvedWorkspace |
dataclass | {root, members} — a resolved workspace |
Member |
dataclass | {name, path} — one workspace member |
Development
This package is part of the axm-forge workspace.
git clone https://github.com/axm-protocols/axm-forge.git
cd axm-forge
uv sync --all-groups
uv run --package axm-ingot --directory packages/axm-ingot pytest -x -q
License
Apache-2.0 — © 2026 axm-protocols
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 axm_ingot-0.1.0.tar.gz.
File metadata
- Download URL: axm_ingot-0.1.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60977dbcaa0c29991872c61e2840b7da3239f89ae8f5e6a5149c53d3a544af2a
|
|
| MD5 |
dc90a7b35b5e159cfe6c14c981bc4057
|
|
| BLAKE2b-256 |
6ca1b3eb5f4e78fe1899479c8b3cd73e4f0911959cf54f151ce0d33ca9069f90
|
Provenance
The following attestation bundles were made for axm_ingot-0.1.0.tar.gz:
Publisher:
publish.yml on axm-protocols/axm-forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axm_ingot-0.1.0.tar.gz -
Subject digest:
60977dbcaa0c29991872c61e2840b7da3239f89ae8f5e6a5149c53d3a544af2a - Sigstore transparency entry: 1916053994
- Sigstore integration time:
-
Permalink:
axm-protocols/axm-forge@11f61ab48e5680f84a51ee4cdc0bc21ab7fd4901 -
Branch / Tag:
refs/tags/ingot/v0.1.0 - Owner: https://github.com/axm-protocols
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@11f61ab48e5680f84a51ee4cdc0bc21ab7fd4901 -
Trigger Event:
push
-
Statement type:
File details
Details for the file axm_ingot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: axm_ingot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ab1b42bf5368f229a59a81ada154248a6499b6c84972d7bf790139a8739f60f
|
|
| MD5 |
99c0f38b9ccd09013c69468e34e7a074
|
|
| BLAKE2b-256 |
2b34d32637d3d7b1ec0c2f0d1a52f80dcf1f6c7eb5f74859c8853ec7f1ef99bc
|
Provenance
The following attestation bundles were made for axm_ingot-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on axm-protocols/axm-forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axm_ingot-0.1.0-py3-none-any.whl -
Subject digest:
5ab1b42bf5368f229a59a81ada154248a6499b6c84972d7bf790139a8739f60f - Sigstore transparency entry: 1916054130
- Sigstore integration time:
-
Permalink:
axm-protocols/axm-forge@11f61ab48e5680f84a51ee4cdc0bc21ab7fd4901 -
Branch / Tag:
refs/tags/ingot/v0.1.0 - Owner: https://github.com/axm-protocols
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@11f61ab48e5680f84a51ee4cdc0bc21ab7fd4901 -
Trigger Event:
push
-
Statement type: