Acquisition Namespace
YAML-driven hierarchical path namespace builder for acquisition data pipelines.
Define your session directory layout once in a YAML spec; the library builds, parses, and validates paths at every level of the hierarchy — with zero hard-coded separators or string constants in your application code.
Installation
pip install acquisition-namespace
Or with uv:
uv add acquisition-namespace
Quick start
from acquisition_namespace import NamespaceBuilder
builder = NamespaceBuilder.from_yaml("my_namespace.yaml")
# Build the session basename from component values
name = builder.build_path("session", {
"subject": "mouse_01",
"datetime": "20260524_143022_123456",
"task": "sequence",
})
# → "mouse_01__20260524_143022_123456__sequence"
# Build the full directory path from root to the session level
path = builder.generate_path("session", {...})
# → "mouse_01/mouse_01__20260524_143022_123456__sequence"
# Parse an existing path back into its fields
parts = builder.extract_level_values("session", name)
# → {"subject": "mouse_01", "datetime": "...", "task": "sequence"}
Spec YAML format
version: "1.0"
description: "My acquisition namespace."
hierarchy:
- subject
- session
- file
optional_levels: []
levels:
subject:
template: "{subject}"
regex: "(?P<subject>[\\w\\-]+)"
optional_fields: []
session:
template: "{subject}__{datetime}__{task}"
regex: "(?P<subject>[\\w\\-]+)__(?P<datetime>\\d{8}_\\d{6}(?:_\\d{6})?)__(?P<task>[\\w\\-]+)"
optional_fields: []
file:
template: "{session}.{suffix}.{extension}"
regex: "(?P<session>.+)\\.(?P<suffix>\\w+)\\.(?P<extension>\\w+)"
optional_fields: []
Higher-level templates may reference lower-level names (e.g. {session} in
the file template); the builder resolves them automatically.
Development setup
git clone https://github.com/murineshiftwork/acquisition-namespace.git
cd acquisition-namespace
uv sync --group dev
uv run pre-commit install --hook-type pre-commit --hook-type commit-msg
uv run pytest
Release workflow
- Work on a
feature/orfix/branch, committing withcz commit - Open a PR — CI (lint + tests + secrets scan) must pass before merge
- Merge to main → version bump and tag are created automatically
- Tag triggers release: GitHub release + PyPI publish
License
See LICENSE.
Metadata
Release files for acquisition-namespace 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| acquisition_namespace-1.3.2.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| acquisition_namespace-1.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.1 kB
Release files / acquisition_namespace-1.3.2.tar.gz
| Download URL | acquisition_namespace-1.3.2.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e155f8823f744f2da3da0cc5d1dba27f03bc6850d686ac87c7d139c5d4f2936
|
|
BLAKE2b-256 checksum How to use checksums |
d643fbfd34e28d0358a2aa79bcd8dcd06dcf3c4678c707851eab6b4fbb9ac277
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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}
|
Release files / acquisition_namespace-1.3.2-py3-none-any.whl
| Download URL | acquisition_namespace-1.3.2-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
753d97ccd13e37b86d900410f3ed18e5dc0ce5de496fa68927982790f39a1acc
|
|
BLAKE2b-256 checksum How to use checksums |
221e42f45def6046a5a78b6fd6e3a81d5a57f11712172d8cdeac04c6dc306761
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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}
|