Skip to content

Migrate to uv, add CI and minimal test suite - #1

Open
dgegen wants to merge 2 commits into
philippbaumeister:mainfrom
dgegen:main
Open

Migrate to uv, add CI and minimal test suite#1
dgegen wants to merge 2 commits into
philippbaumeister:mainfrom
dgegen:main

Conversation

@dgegen

@dgegen dgegen commented Jun 24, 2026

Copy link
Copy Markdown

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

  • Replace requirements.txt/setup.py/environment.yml with pyproject.toml + uv.lock for reproducible installs via uv sync.
  • Move package code to a src/exomdn layout (standard practice for installable packages, avoids accidentally importing the local source tree instead of the installed package).
  • Add a minimal tests/ suite covering the model and plotting code.
  • Add a GitHub Actions CI workflow to run the test suite on push/PR.
  • Update the README installation instructions for uv (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 bundled preprocessor.pkl files).
  • Relax some package version constraints
  • Fix Python range to those where tests run successfully, i.e. Python 3.9 and Python 3.10.

Compatibility

No source code behaviour changes. This is purely packaging/tooling. pip install . still works, but pip has no equivalent to uv.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.

dgegen added 2 commits June 24, 2026 15:27
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.
Copilot AI review requested due to automatic review settings June 24, 2026 13:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) with pyproject.toml + uv.lock and updated README install docs.
  • Move runtime code into src/exomdn and 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 thread .github/workflows/ci.yml
Comment on lines +3 to +10
on:
pull_request:
branches:
- main
paths-ignore:
- "__pycache__"
- ".pytest_cache"

Comment thread tests/conftest.py
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants