refactor!: layer the argumentation package into subpackages (0.3.0)#1
Merged
Conversation
Encodes the package's import-layer DAG as an executable contract: every module carries a layer rank, and no module may import a higher layer (bar two sanctioned function-local clingo-adapter edges). Makes the architecture CI-enforced rather than convention.
Create the empty core/, structured/{aspic,aba}/, frameworks/, dynamics/,
interop/, solving/ subpackages and the full tests/ mirror. Collapse
argumentation/__init__.py to a docstring (the 41-module eager re-export
and argumentation.__all__ are removed). Remove the superseded flat-layout
layer test. The gradual/, ranking/, probabilistic/ subpackage directories
are deferred to their layer commits (they collide with same-named flat
modules until those modules move). No modules move in this commit.
git mv dung, labelling, preference, solver_results, preprocessing, scc_recursive, bipolar, accrual into argumentation/core/. Rewrite every importer across src/, tests/, bench/, tools/. Move the core-layer test files into tests/core/. No behavior change.
git mv aspic, aspic_encoding, aspic_incomplete, subjective_aspic, datalog_grounding into argumentation/structured/aspic/. Rewrite every importer across src/ and tests/. Move the ASPIC+ test files into tests/structured/aspic/. No behavior change.
…rash decomposed_prefsat_extension subtracted only fixed_in from the required assumption set, so a required assumption forced OUT by simplify_aba leaked into the residual solver, which has no SAT variable for it -> KeyError. A fixed_out assumption is in no preferred extension (Bondarenko et al. 1997, Def 2.2 p.70 + Thm 6.4 p.90): every preferred set is conflict-free and contains the well-founded set, whose theory derives the assumption's contrary. So a query requiring a fixed_out assumption is unsatisfiable; short-circuit to that answer. Adds a focused regression test and a property test of the invariant.
git mv adf, setaf, setaf_io, caf, vaf, vaf_completion, partial_af, practical_reasoning into argumentation/frameworks/. Rewrite every importer across src/ and tests/. Move the framework test files into tests/frameworks/. Delete the vestigial test_adf export test C0 left as a pass-body. No behavior change.
git mv gradual, dfquad, equational, gradual_principles, llm_surface, sensitivity into argumentation/gradual/. Rewrite every importer across src/ and tests/. Move the gradual test files into tests/gradual/. Delete vestigial package-attribute export tests. No behavior change.
git mv ranking, ranking_axioms, weighted, matt_toni into argumentation/ranking/. Rewrite every importer across src/ and tests/. Move the ranking test files into tests/ranking/. No behavior change.
git mv aba, aba_sat, aba_asp, aba_decomposition, aba_incremental, aba_preprocessing, aba_route_policy, aba_telemetry into argumentation/structured/aba/. Rewrite every importer across src/ and tests/. Move the ABA test files into tests/structured/aba/. No behavior change.
…(C7/12) git mv probabilistic, probabilistic_components, probabilistic_treedecomp, epistemic into argumentation/probabilistic/. Rewrite every importer across src/ and tests/. Move the probabilistic test files into tests/probabilistic/. No behavior change.
git mv enforcement, dynamic, af_revision, approximate, optimization into argumentation/dynamics/. Rewrite every importer across src/ and tests/. Move the dynamics test files into tests/dynamics/. No behavior change.
git mv iccma into argumentation/interop/. Rewrite every importer across src/ (including solver_adapters/) and tests/. Move the ICCMA interop test files into tests/interop/, fixing repo-root path depth in the two manifest-reading tests. No behavior change.
git mv af_sat, sat_encoding, backends, solver, solver_differential, iccma_cli into argumentation/solving/. Rewrite every importer across src/ and tests/. Move the solving test files into tests/solving/. Update the iccma-cli console-script entry point to argumentation.solving.iccma_cli. No behavior change.
Add import-linter as a dev dependency and a [tool.importlinter] layered contract pinning the package import DAG: core < structured.aspic / frameworks / gradual / ranking < structured.aba / probabilistic / dynamics / interop < solver_adapters < solving < semantics. Two function-local clingo-adapter edges are the sanctioned ignore_imports. Add `uv run lint-imports` to CI. The architecture is now machine-checked.
Rewrite docs/architecture.md, README.md, and CONTRIBUTING.md to the layered import paths; add a layered-architecture section and a package -layout contributor note. Update tests/test_docs_surface.py expected paths to match. Add CHANGELOG.md with the 0.3.0 breaking-change entry and the full old->new path table. Bump version to 0.3.0.
The [tool.hatch.build.targets.wheel.force-include] entry mapping src/argumentation/encodings was double-covered by the recursive packages = ["src/argumentation"] inclusion, producing a "Duplicate name" warning on uv build. Remove the redundant block; the wheel still ships encodings/*.lp via the package inclusion.
src/argumentation/encodings/aba_com_incremental.lp shipped a comment naming the pre-reorg path argumentation.aba_asp.encode_aba_theory. The 0.3.0 layered path is argumentation.structured.aba.aba_asp.encode_aba_theory. Caught by Codex review of the reorg.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
The flat 56-module
argumentationpackage is reorganized into ten layered subpackages with the import-layer DAG enforced in CI byimport-linter. Breaking change — every import path is new (argumentation.dung→argumentation.core.dung, etc.); seeCHANGELOG.mdfor the full old→new table. Ships as 0.3.0.What changed
Structure
Breaking changes
CHANGELOG.md.argumentation.__all__removed;argumentation/__init__.pycollapsed to a one-line docstring.import argumentationno longer eagerly imports submodules — import what you need explicitly.iccma-cliconsole-script entry point moved toargumentation.solving.iccma_cli. No surface change for users runningiccma-cli; relevant if you invokedpython -m argumentation.iccma_cli— usepython -m argumentation.solving.iccma_cliinstead.Architecture is now machine-enforced
A
[tool.importlinter]layerscontract inpyproject.tomlpins the import DAG:CI runs
uv run lint-imports. Two function-localsolver_adapters.clingoedges (aspic_encodingandaba_asp, both conditional clingo-adapter loads) are the only sanctionedignore_imports. The architecture stopped being a story and became a contract.One pre-existing correctness fix included
Mid-reorg, a Hypothesis property test surfaced a latent
aba_satbug: a required assumption forced OUT bysimplify_abaKeyError'd at the residual solver. Fixed at commit5c53816per Bondarenko et al. 1997 (Def 2.2 p.70 + Thm 6.4 p.90): afixed_outassumption is in no preferred extension, so a query requiring one is unsatisfiable → returnsNone. Oracle-verified on 400 generated examples. Adds a focused regression test and a Hypothesis property test of the invariant.Commit chain (18 commits)
e79632c98e701588deb137833f6b5c53816fixed_outassumption is unsatisfiable8b81abe6a9d395913c3280d4b6ff601eb11d82c48468dda7e9ecdbda9644236bab4bac4c80f07d06a5ce59f3f91argumentation.aba_asppath in encodings commentEach layer commit was independently gated: full suite green,
pyright srcclean, no missing imports. Per-commit reports live underreports/reorg-c*.md.Verification
uv run pytest -q— 2824 passed, 3 skipped, 1 xfailed, 0 failed, 0 collection errorsuv run pyright src— 0 errorsuv run lint-imports— 2 contracts kept, 0 brokenuv build— wheelformal_argumentation-0.3.0+ sdist with all 12 subpackages, no warningsreports/codex-review-reorg.md) — verdict MERGE-READY after the one shipped-comment fix that is now appliedreports/reorg-verify-final.md) — verdict MERGE-READYsrc/ tests/ bench/ tools/— zero surviving flat-path importsDownstream impact
A precise migration plan for
propstore(the primary consumer) is atpropstore/notes/argumentation-0.3.0-migration.md: 296 import lines across 104 files, 2 files needing structural rewrites (theirfrom argumentation import <bare>patterns are affected by__all__removal). Not executed by this PR; awaits a separate propstore-side update.Migration recipe for users
Update imports per the
CHANGELOG.mdold→new table. Anything usingargumentation.__all__or theimport argumentation; argumentation.Xattribute-access pattern must be rewritten to explicit submodule imports.Not included / follow-ups
scripts/directory contains two files with old flat imports (probe_sensitivity_delta_sign.py,verify_sensitivity_expectations.py). Out of this PR's scope; untracked.0.3.0is not published to PyPI by this PR. Publishing is a separate explicit step.