Migrate to uv, add CI and minimal test suite - #1
Open
dgegen wants to merge 2 commits into
Open
Conversation
Move package code into src/exomdn, replace requirements.txt/setup.py with pyproject.toml and uv.lock, add a minimal tests/ suite, update the README installation instructions to use uv sync/uv run. Relax some package constraints. Document why tensorflow/tensorflow-probability and scikit-learn are pinned: newer TF defaults to Keras 3 and can't load the shipped SavedModel-format models, and scikit-learn gives no pickle compatibility guarantee across versions, which would break the bundled preprocessor.pkl files.
There was a problem hiding this comment.
Pull request overview
This PR migrates ExoMDN to a uv-managed, lockfile-pinned Python environment and modernizes packaging to a pyproject.toml + src/exomdn layout, while introducing a minimal pytest suite and GitHub Actions CI to validate the shipped models/plotting.
Changes:
- Replace legacy packaging (
setup.py,requirements.txt, conda env) withpyproject.toml+uv.lockand updated README install docs. - Move runtime code into
src/exomdnand add core modules (model loading/prediction, plotting, widgets). - Add pytest smoke tests and a GitHub Actions workflow to run them in CI.
Reviewed changes
Copilot reviewed 7 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/conftest.py |
Adds shared fixtures for loading shipped models and providing sample inputs/errors. |
tests/test_model.py |
Adds smoke tests exercising predict() and predict_with_error() across both shipped models. |
tests/test_plotting.py |
Adds smoke tests for cornerplot functions using prediction outputs. |
src/exomdn/__init__.py |
Exposes ExoMDN from the package root. |
src/exomdn/exomdn.py |
Introduces the ExoMDN facade around model loading/prediction and widgets. |
src/exomdn/log_ratio.py |
Adds log-ratio transform helpers used by model output postprocessing. |
src/exomdn/mdn_layer.py |
Adds the Keras MDN layer + loss used to load shipped models. |
src/exomdn/mdn_model.py |
Adds model loading, mixture construction, sampling, and prediction APIs. |
src/exomdn/plotting.py |
Adds plotting utilities (cornerplot, cornerplot_logratios) used by notebooks/tests. |
src/exomdn/widgets.py |
Adds ipywidgets-based UI for selecting models and running predictions. |
.github/workflows/ci.yml |
Adds CI workflow running pytest under uv on Python 3.9/3.10. |
pyproject.toml |
Defines project metadata, Python range, runtime deps, and pytest dev deps for uv. |
README.md |
Updates installation instructions to use uv sync / uv run and documents pin rationale. |
requirements.txt |
Removed in favor of pyproject.toml + uv.lock. |
setup.py |
Removed in favor of pyproject.toml packaging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3
to
+10
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths-ignore: | ||
| - "__pycache__" | ||
| - ".pytest_cache" | ||
|
|
Comment on lines
+1
to
+24
| import matplotlib | ||
|
|
||
| matplotlib.use("Agg") | ||
|
|
||
| import pytest | ||
|
|
||
| from exomdn import ExoMDN | ||
|
|
||
| MODEL_INPUTS = { | ||
| "mass_radius_Teq": [1.0, 1.0, 500], | ||
| "mass_radius_k2_Teq": [1.0, 1.0, 0.3, 500], | ||
| } | ||
| MODEL_ERRORS = { | ||
| "mass_radius_Teq": [0.1, 0.1, 50], | ||
| "mass_radius_k2_Teq": [0.1, 0.1, 0.05, 50], | ||
| } | ||
|
|
||
|
|
||
| @pytest.fixture(scope="module", params=sorted(MODEL_INPUTS)) | ||
| def exo(request): | ||
| exo = ExoMDN(model_path="./models", data_path="./data") | ||
| exo.load_model(exo.model_path / request.param) | ||
| exo.model_name = request.param | ||
| return exo |
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.
Motivation
A colleague trying to install ExoMDN on macOS hit a wall: pip does not ships the pinned TensorFlow/TFP versions this project depends on for Apple Silicon (arm64), and they need the package installed to build on top of it. Rather than patch around pip's wheel availability, this switches the project to uv, which resolves and pins a working environment (including Python itself) regardless of what's available via pip on the host.
Changes
requirements.txt/setup.py/environment.ymlwithpyproject.toml+uv.lockfor reproducible installs viauv sync.src/exomdnlayout (standard practice for installable packages, avoids accidentally importing the local source tree instead of the installed package).tests/suite covering the model and plotting code.uv sync,uv run ...), and document why tensorflow/tensorflow-probability and scikit-learn versions are pinned (newer TF defaults to Keras 3 and can't load the shipped SavedModel-format models; scikit-learn gives no pickle-compatibility guarantee across versions, which would break the bundledpreprocessor.pklfiles).Compatibility
No source code behaviour changes. This is purely packaging/tooling.
pip install .still works, but pip has no equivalent touv.lock: it resolves dependencies fresh against whatever's available at install time so everyone gets the exact same resolved versions reproducibly. The conda-based install path (environment.yml) has been removed in favor of uv.