Skip to content
jurdabosPublic

About

Cross-platform dependency patch and CI baseline tooling for Python repositories (acidbase CLI + canonical templates).

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

acidbase

Safe scaffolding, shared workflow, dependency-patch, and CI-baseline tooling for Python repositories, packaged as a single acidbase CLI plus a set of canonical template files.

What this repository provides

1. The acidbase CLI — a small Click-based command group that wraps several project and owner-wide GitHub workflows so they behave identically on Windows (PowerShell 7+) and on Linux/WSL (bash):

  • acidbase alerts — list Dependabot alerts for one repo or every repo of an owner, with severity / state / package filters and ready-to-paste acidbase patch suggestions per affected package.
  • acidbase bump — advance a uv project's own static version by one or more uv bump kinds, or set an explicit PEP 440 version. It updates pyproject.toml and uv.lock without synchronizing the environment; see docs/guidelines/versioning.md.
  • acidbase clean — remove one fixed inventory of Python development caches (bytecode, pytest, Hypothesis, ruff and mypy caches, coverage output) from a project, never anything Git tracks; --dry-run lists them with sizes. Importable from consumer repos via from acidbase.clean import clean_command; see docs/guidelines/scaffolding.md.
  • acidbase dismiss-alert — dismiss selected alerts with a recorded reason; acidbase reopen-alert can reverse the decision.
  • acidbase enable-alerts / acidbase enable-fixes — idempotently toggle the per-repo Dependabot settings (vulnerability alerts and automated security fix PRs respectively). Each helper checks the current state first so it is safe to chain from repo-creation scaffolders.
  • acidbase fleet — keep a manifest of the repositories that consume acidbase (host, path, CLI): fleet add registers one and is safe to call from repo-creation scripts, fleet census compares the manifest with the disk in both directions, fleet list renders it as a table, JSON, TSV, or Markdown, fleet pin pins every member to an acidbase release tag, and fleet remove drops an entry. Paths are translated between Windows and WSL; see docs/guidelines/fleet.md.
  • acidbase hooks — report whether each repository's ruff pre-commit hook agrees with its uv.lock, the single source of truth for the ruff version (LOCAL, ALIGNED, DRIFT, NO-RUFF-HOOK, ...), list any remaining remote rev: pins, and exit non-zero on drift. Accepts repo paths or --all to sweep the roots in config/security_patch.toml.
  • acidbase keyring — move a repo's .env secrets into the OS keyring with plan, copy and strip, and back with restore, printing names and never values. A startup hook shipped with the package, acidbase_keyring.pth, then fills the environment of each Python process in that repo's venv, so nothing needs a launcher or a code change. A value already in the environment wins. WSL shares the Windows store through python.exe. A repo that keeps its secrets in .env is unaffected, and tools other than Python never see keyring values, so what Docker Compose needs stays in .env.
  • acidbase patch — scan every non-archived repo of a GitHub owner for a vulnerable dependency, bump it via uv add --no-sync <dep>>=<new> (the repo's virtual environment is never touched), publish the fix (direct push or PR), and verify Dependabot alerts close. Opt in with --sync-env to eagerly uv sync --frozen repos whose venv is native to the executing side. Profiles per repo are configured in config/security_patch.toml.
  • acidbase push — pre-commit-aware git add . && git commit && git push helper with automatic retry when hooks modify staged files. Importable from consumer repos via from acidbase.push import push_command. Supports a dual-publish flow (private remote + public mirror) with allowlist / gitleaks pre-flight gates and an interactive destination Q&A; see docs/guidelines/dual_push.md.
  • acidbase reopen-alert — reopen selected alerts that were previously dismissed.
  • acidbase scaffold — show a read-only adoption plan for an initialized Python repository, then add missing baseline files with --apply. Existing divergent CLI, CI, hook, lint, and secret-scan configuration is preserved; a verbatim copy of an older acidbase template is reported as stale and replaced only under --refresh-baseline; --wire-cli explicitly couples a new CLI to its dependency, entry point, initializer, and package metadata; see docs/guidelines/scaffolding.md.

Metarepo-to-children propagation (lockfile pin upgrades, config sweeps, per-repo verification, canonical uv run <cli> push close-out) is documented as a repeatable private runbook in docs/guidelines/metarepo_rollout.md.

2. Canonical CI / lint / secret-scan templates under templates/ — a single source of truth for the GitHub Actions lint workflow, the pre-commit hook set (uv-lock + ruff + gitleaks, all repo: local so the hook file pins no tool version and ruff resolves from uv.lock), the ruff configuration block, and the gitleaks configuration:

  • templates/.github/workflows/lint.yml
  • templates/.gitleaks.toml
  • templates/.pre-commit-config.yaml
  • templates/pyproject.lint.toml (the [tool.ruff] block to append)

Downstream repositories adopt these files through acidbase scaffold so the baseline stays consistent without overwriting local policy. See templates/README.md for the rationale behind each choice (why ruff over black+isort+flake8, why the gitleaks CLI instead of gitleaks/gitleaks-action@v2).

Installation

Requires Python 3.12+ and uv.

git clone https://github.com/jurdabos/acidbase.git
cd acidbase
uv sync
uv run acidbase --help

Or install directly from GitHub into another project:

uv add "acidbase @ git+https://github.com/jurdabos/acidbase.git@v0.4.0"

Pin the newest release tag, which git ls-remote --tags https://github.com/jurdabos/acidbase.git 'v*' lists. uv ignores a version specifier such as acidbase>=0.3.0 on a git source, so the tag is what fixes the version.

Usage at a glance

Full walkthroughs for the security patch flow (CLI reference, config schema, strategies, verification, worked examples) live in docs/guidelines/security_patching.md. Quick example:

# Triage owner-wide alerts and get suggested fix commands.
uv run acidbase alerts --owner <github-owner> --state open --severity high
# Apply a fix across every affected repo and verify the alerts close.
uv run acidbase patch \
    --owner <github-owner> \
    --dep GitPython \
    --new-version 3.1.50 \
    --cve CVE-2026-42215

Development

uv sync                       # install runtime + dev deps
uv run pytest                 # run the test suite
uv run ruff check .           # lint
uv run ruff format --check .  # formatting check

Pre-commit hooks (uv-lock + ruff + gitleaks via the system MIT-licensed binary):

uv tool install pre-commit --with pre-commit-uv
pre-commit install
pre-commit run --all-files

Repository structure

acidbase/
├── src/acidbase/             # Python package
│   ├── clean.py              # Reusable development-cache cleaner
│   ├── cli.py                # Click group and public command registration
│   ├── fleet.py              # Fleet manifest: register, census, list consumers
│   ├── push.py               # Reusable Git commit-and-push command
│   ├── scaffold.py           # Plan-first baseline adoption
│   ├── versioning.py         # Reusable uv project-version command
│   ├── workflow.py           # Root/tool/subprocess mechanics for child CLIs
│   └── security/             # patch + alert helpers, profile resolver, publishers
├── templates/                # Canonical CI / lint / secret-scan baseline
├── docs/guidelines/          # Public docs (security patching workflow)
├── tests/                    # pytest suite (security/* covers the patch flow)
├── config/security_patch.toml # Example profile config (placeholders only)
├── scripts/list_symbols.py   # Repo-wide function/class inventory utility
├── pyproject.toml            # uv-native project metadata + ruff config
└── PUBLIC_ALLOWLIST.txt      # CI guard: paths allowed to live in this repo

Contributing

See CONTRIBUTING.md and CODE_OF_CONDUCT.md. The CI lint baseline (.github/workflows/lint.yml) and the public allowlist guard (.github/workflows/public-allowlist.yml) must stay green before merge.

License

MIT — Copyright (c) 2024 Blai (Balázs Torda).

About

Cross-platform dependency patch and CI baseline tooling for Python repositories (acidbase CLI + canonical templates).

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages