parley/__init__.py is empty, so nothing is importable from the package root: from parley import run_consensus fails today. Every user has to know the internal module layout (from parley.consensus import run_consensus, from parley.spec import DecisionSpec, …) before they can write their first line. The layout is an implementation detail; the public surface should be one import away.
What is wanted
Re-export the public names in parley/__init__.py and declare __all__:
- from
parley.agent: Agent, Verdict
- from
parley.preferences: PreferenceSheet, HardConstraint, Evaluation
- from
parley.consensus: run_consensus, ConsensusResult, AgentLike, verify_outcome
- from
parley.transcript: Transcript
- from
parley.spec: DecisionSpec, PartySpec, Constraint, UtilityTerm
Leave parley.net out — it stays an explicit opt-in because its signing path depends on the optional crypto extra, and the core package import must stay pure-stdlib.
Re-exports only: no logic in __init__.py, no behaviour change anywhere, and the existing deep imports keep working.
How to verify
Add a small test (e.g. tests/test_public_api.py) that imports every name in __all__ from parley directly, and asserts parley.net is not pulled in by a bare import parley ("parley.net" not in sys.modules). Then:
All existing tests must stay green.
parley/__init__.pyis empty, so nothing is importable from the package root:from parley import run_consensusfails today. Every user has to know the internal module layout (from parley.consensus import run_consensus,from parley.spec import DecisionSpec, …) before they can write their first line. The layout is an implementation detail; the public surface should be one import away.What is wanted
Re-export the public names in
parley/__init__.pyand declare__all__:parley.agent:Agent,Verdictparley.preferences:PreferenceSheet,HardConstraint,Evaluationparley.consensus:run_consensus,ConsensusResult,AgentLike,verify_outcomeparley.transcript:Transcriptparley.spec:DecisionSpec,PartySpec,Constraint,UtilityTermLeave
parley.netout — it stays an explicit opt-in because its signing path depends on the optionalcryptoextra, and the core package import must stay pure-stdlib.Re-exports only: no logic in
__init__.py, no behaviour change anywhere, and the existing deep imports keep working.How to verify
Add a small test (e.g.
tests/test_public_api.py) that imports every name in__all__fromparleydirectly, and assertsparley.netis not pulled in by a bareimport parley("parley.net" not in sys.modules). Then:All existing tests must stay green.