Fix package structure and public imports (closes #9)#47
Conversation
PR Summary
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #47 +/- ##
==========================================
+ Coverage 96.35% 96.37% +0.01%
==========================================
Files 19 17 -2
Lines 494 496 +2
==========================================
+ Hits 476 478 +2
Misses 18 18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Use absolute imports in package __init__ files per PEP 8. - Replace star imports with explicit re-exports and __all__ on elsim, elections, strategies, and methods. - Rename elections/elections.py and strategies/strategies.py to _core.py so the implementation submodule is private and does not shadow the package name in dir(). - Use private NumPy/SciPy/numbers aliases in election and strategy core modules so implementation imports are not part of the public namespace. - Drop :imported-members: from Sphinx automodule configs now that the package modules no longer re-export third-party objects. Co-authored-by: endolith <endolith@gmail.com>
|
This renames |
b170d14 to
bf6353e
Compare
bf6353e to
7822157
Compare
Summary
Resolves issue #9 by tightening the public API of
elsim,elsim.elections, andelsim.strategies, switching subpackage__init__modules to absolute imports (PEP 8), and documenting subpackages without:imported-members:so Sphinx does not pull in unrelated third-party symbols.Changes
elsim:from elsim import elections, methods, strategiesand an explicit__all__listingelections,methods,strategies, and__version__.elsim.methods: absolute imports fromelsim.methods.<module>, plus__all__sodir(elsim.methods)matches the intended voting-method entry points.elsim.elections/elsim.strategies: stop usingimport *; re-export only the public callables from private implementation moduleselsim.elections._coreandelsim.strategies._core(files renamed fromelections.py/strategies.pyso the loaded submodule no longer appears as a same-named public attribute on the package)._np,_numbers, and existing_cdist/_honest_rankingsaliases so NumPy, SciPy, and stdlib imports are not public surface area onelsim.elections._coreorelsim.strategies._core.Note on
elections_rngIt remains on
elsim.elections._corefor internal use but is no longer re-exported fromelsim.elections; callers should passrandom_statewhere supported. No in-repo usages referenced the package-level name.Verification
pytest tests/(191 passed)pytest elsim/elections/_core.py elsim/strategies/_core.py --doctest-modules(7 passed)