refactor: move modules into core/ sub-package, normalize naming

Phase 1 of package refactor. Moves all source modules into pm3py/core/
with file renames (hf_14a→hf_iso14a, hf_15→hf_iso15, hf_mf→hf_mfc)
and client attribute normalization (hf.a14→hf.iso14a, hf.mf→hf.mfc).
pm3py/__init__.py re-exports from core for backward compat.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
michael
2026-03-18 19:24:05 -07:00
parent ab3d37e7b3
commit 42e6b54f29
21 changed files with 108 additions and 46 deletions

View File

@@ -0,0 +1,52 @@
# pm3py Refactor Progress
**Design:** [2026-03-18-refactor-design.md](2026-03-18-refactor-design.md)
**Branch:** `refactor/core-package`
**Started:** 2026-03-18
## Phase 1 — Create `core/`, normalize names, fix imports
**Status: Complete**
### What was done
- Created `pm3py/core/` sub-package
- Moved all source modules into `core/`:
- `protocol.py`, `transport.py`, `client.py`, `hw.py`, `hf.py`, `lf.py` — moved as-is
- `hf_14a.py``hf_iso14a.py` (renamed)
- `hf_15.py``hf_iso15.py` (renamed)
- `hf_mf.py``hf_mfc.py` (renamed)
- Normalized client attributes:
- `hf.a14``hf.iso14a`
- `hf.mf``hf.mfc`
- `hf.iso15` — unchanged
- Created `core/__init__.py` re-exporting: `Proxmark3`, `FirmwareInfo`, `PM3Transport`, `PM3Error`, `PM3Response`, `PM3Status`, `Cmd`
- Updated `pm3py/__init__.py` to import from `.core.*`
- Updated all 10 test files (imports + attribute references)
- **30/30 tests passing**
### Backward compatibility
- `from pm3py import Proxmark3` still works (re-exported)
- **Breaking:** `hf.a14``hf.iso14a`, `hf.mf``hf.mfc`
- **Breaking:** Direct imports like `from pm3py.hf_14a import ...``from pm3py.core.hf_iso14a import ...`
## Phase 2 — Extract `sniff/`
**Status: Deferred — no sniff infrastructure exists yet**
`hf_iso15.py` is 94 lines of clean reader commands + thin `sniff()` firmware call. The trace parsing, 15693 decoders, NDEF annotation, and ANSI formatting described in the design doc haven't been written yet. Nothing to extract.
Will revisit when sniff infrastructure is implemented.
## Phase 3 — Scaffold `transponders/`
**Status: Not started — models live in sim worktree**
Transponder models exist in `.worktrees/sim-framework/` but haven't been merged to master. Scaffold when ready to migrate.
## Phase 4 — Scaffold `reader/` and `sim/`
**Status: Not started**
Depends on Phase 3 and sim worktree merge.