Modernize packaging, drop strict pins, add tests and CI#2
Merged
Conversation
Resolves the dependency-resolver failure reported by users on Python 3.10+.
The 1.1.1 release pinned numpy==1.19.1, scipy==1.5.3, matplotlib==3.3.2 and
iteround==1.0.2; those have no wheels for modern CPython and conflict with
any environment that already requires numpy>=2.
Changes
-------
* Replace setup.py / setup.cfg with PEP 621 pyproject.toml using the
hatchling backend. Dependencies are declared with lower bounds only
(matplotlib>=3.5, numpy>=1.21, scipy>=1.7); upper bounds are deliberately
omitted to avoid the same trap going forward — CI catches breakage.
* Move the package to src/ layout (src/baycomp_plotting/) so tests run
against the installed wheel instead of the source tree.
* Drop iteround as a runtime dependency by inlining a small
largest-remainder _safe_round helper.
* Bump to 1.2.0. No public API changes:
- Color, dens, tern keep the same signatures and behaviour.
- dens() figure still exposes add_posterior(); it now defaults ls and
color (was already the documented behaviour in README).
- __version__ added.
* Add a pytest suite (tests/) covering the pure helpers and image-
regression tests for dens / tern with pytest-mpl baselines.
* Add GitHub Actions workflows:
- test.yml: matrix on python 3.9-3.13 + ubuntu / macOS / windows,
run on push, PR and weekly cron.
- release.yml: builds sdist and wheel on tag push, publishes via PyPI
trusted publishing. Pre-release tags (-rc, -a, -b) go to TestPyPI;
stable tags go to PyPI with a manual approval gate.
* Forward-compat checks: tests pass with -W error::DeprecationWarning
-W error::FutureWarning under numpy 2.4, scipy 1.17, matplotlib 3.10.
Switched the two-step set_yticks + set_yticklabels to the single-call
ax.set_yticks(ticks, labels=...) form (matplotlib 3.5+).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI failed on Python 3.9 because matplotlib 3.9.x (the last line that supports 3.9 since matplotlib 3.10 dropped it) emits PyparsingDeprecationWarning during its own initialisation. With -W error::DeprecationWarning that aborted pytest before any test ran. Move the strict-warning filters from the workflow command to filterwarnings in pyproject.toml — that's the canonical place and benefits local runs too — and silence the pyparsing category so the noise from matplotlib's internals doesn't gate our suite. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Fixes the dependency-resolver failure reported by users (
The conflict is caused by: baycomp-plotting 1.1.1 depends on numpy==1.19.1 / 1.1 depends on scipy==1.5.3 / ...) and modernizes the project for long-term maintenance. No public API changes —import baycomp_plotting,Color,dens,ternall keep the same signatures and behaviour, so existing users are unaffected onpip install -U baycomp_plotting.What changed
Packaging
setup.py/setup.cfg→ PEP 621pyproject.toml(hatchling backend).matplotlib>=3.5,numpy>=1.21,scipy>=1.7). Upper bounds deliberately omitted; CI catches future breakage instead of declaring it preemptively.iterounddropped as a runtime dep — small_safe_round(largest-remainder) helper inlined.src/layout (src/baycomp_plotting/) so tests run against the installed wheel, not the source tree.__version__attribute.Tests (
tests/)_safe_round,_project,_process_names,Colorpalette).dens/tern(number of axes, lines, labels).dens/ternviapytest-mplagainst baselines intests/baseline_images/.-W error::DeprecationWarning -W error::FutureWarningagainst the latest numpy 2.4, scipy 1.17 and matplotlib 3.10.CI (
.github/workflows/)test.yml: matrixpython 3.9 / 3.10 / 3.11 / 3.12 / 3.13on Ubuntu, plus one job each on macOS and Windows. Runs on push, PR, and weekly cron (Mondays 06:00) so we get notified when a new transitive dep breaks the lib.release.yml: triggered by tag pushes. Builds sdist + wheel and publishes via PyPI trusted publishing.vX.Y.Z-rc1,-a1,-b1) → TestPyPI.vX.Y.Z) → PyPI, gated by thepypienvironment for manual approval.Code cleanup
setup.py == None→is None, type hints, modern f-string-style formatting._add_posteriorto module level (was a triple-nested closure insidedens).ax.set_yticks(ticks); ax.set_yticklabels(labels)→ax.set_yticks(ticks, labels=...)(matplotlib 3.5+ recommended single call).Forward-compat notes
I audited
plotting.pyfor deprecated APIs across numpy 2.x, scipy 1.17 and matplotlib 3.10. None used:np.amax,np.float_,np.int_scipy.interpolate.interp2d(removed in scipy 1.14)interpnplt.cm.register_cmap(deprecated mpl 3.7)ListedColormapdirectlyTest plan
pytest --mpl— 19/19 passing locally.pytest --mpl -W error::DeprecationWarning -W error::FutureWarning— clean.python -m build— produces wheel + sdist.twine check dist/*— PASSED.__version__ == "1.2.0".v1.2.0-rc1→ verify TestPyPI publish path.v1.2.0→ publish to PyPI.🤖 Generated with Claude Code