Skip to content

axm-anvil

Deterministic CST-based refactoring toolkit for Python — move, rename, split, merge symbols atomically across files.

CI axm-init axm-audit Coverage Python 3.12+


Installation

Bash
uv add axm-anvil

Quick Start

Move a class and a private helper into another module, previewing first:

Bash
axm-anvil move src/mylib/models.py src/mylib/services.py \
    UserService,_validate_input --dry-run

Features

  • 🔨 Deterministic moves — Classes, functions, and constants moved with transitive dependency resolution (imports, constants, helpers), formatting preserved exactly via libcst
  • ✏️ Rename in flight--rename '{"Old": "New"}' rewrites the definition, every reference, __all__, and string forward-references
  • 📍 Placement control--insert-after splices moved blocks after a named symbol; --no-include-helpers skips copying local helpers
  • 🧭 Edge-case aware__all__ sync, conditional-import preservation, relative→absolute import conversion on cross-package moves, and warnings for side-effect decorators, string forward-refs, and pytest fixture-scope breaks
  • 🛡️ Atomic & safe — All edits computed in memory, validated, then written all-or-nothing; new import cycles are detected via --check