Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: CI

on:
push:
branches: [main]
Expand All @@ -10,27 +11,25 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
- uses: actions/checkout@v6

- name: Install uv and Python 3.10
uses: astral-sh/setup-uv@v7
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install poetry
poetry install -v

enable-cache: true

- name: Sync dependencies
run: uv sync --locked

- name: Run isort
run: poetry run isort --profile=black --check-only .
run: uv run isort --profile=black --check-only .

- name: Run black
run: poetry run black --check .
run: uv run black --check .

- name: Check formatting
run: |
poetry run ruff check .
run: uv run ruff check .

- name: Run tests
run: |
poetry run pytest -sv cmonge
run: uv run pytest -sv cmonge
33 changes: 10 additions & 23 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,22 @@ jobs:
if: ${{ !github.event.release.prerelease }}

runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v4
- name: Install uv and Python 3.10
uses: astral-sh/setup-uv@v7
with:
python-version: '3.10'

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Configure Poetry
run: |
poetry config virtualenvs.create false

- name: Install Dependencies
run: |
poetry install --no-interaction --no-ansi
python-version: "3.10"

- name: Build Package
run: |
poetry build
run: uv build

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry publish --username $TWINE_USERNAME --password $TWINE_PASSWORD
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_PASSWORD }}
run: uv publish
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ celerybeat-schedule
# Environments
.env
.venv
.uv-cache/
env/
venv/
ENV/
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
An extension of the [Monge Gap](https://proceedings.mlr.press/v202/uscidda23a.html), an approach to estimate transport maps conditionally on arbitrary context vectors. It is based on a two-step training procedure combining an encoder-decoder architecture with an OT estimator. The model is applied to [4i](https://pubmed.ncbi.nlm.nih.gov/30072512/) and [scRNA-seq](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7289078/) datasets.

## Systems and software requirements
Software package requirements and version information can be found in `requirements.txt` and/or the `pyproject.toml`. This package has been tested on Python versions 3.10 and 3.11.
Software package requirements and version information are defined in `pyproject.toml` and locked in `uv.lock`. This package has been tested on Python versions 3.10 and 3.11.
Hardware requirements enough memory (RAM) to process the data and batches. GPU is not needed but does accelerate computation. This software has been tested on HPCs and local machines (iOS).

## Installation from PyPI
Expand All @@ -33,18 +33,17 @@ pip install cmonge
which should take about two minutes on a laptop.

## Development setup & installation
The package environment is managed by [poetry](https://python-poetry.org/docs/managing-environments/).
The package environment is managed by [uv](https://docs.astral.sh/uv/).
```sh
pip install poetry
git clone git@github.com:AI4SCR/conditional-monge.git
cd cmonge
poetry install -v
curl -LsSf https://astral.sh/uv/install.sh | sh
git clone https://github.com/AI4SCR/conditional-monge.git
cd conditional-monge
uv sync --frozen
```

If the installation was successful you can run the tests using pytest
```sh
poetry shell # activate env
pytest
uv run pytest
```

## Data
Expand Down
2,850 changes: 0 additions & 2,850 deletions poetry.lock

This file was deleted.

104 changes: 58 additions & 46 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
[tool.poetry]
[build-system]
requires = ["hatchling>=1.27.0"]
build-backend = "hatchling.build"

[project]
name = "cmonge"
version = "0.1.3"
description = "Extension of the Monge Gap to learn conditional optimal transport maps"
authors = ["Alice Driessen <adr@zurich.ibm.com>", "Benedek Harsanyi <hben.0204@gmail.com>", "Jannis Born <jab@zurich.ibm.com>"]
readme = "README.md"
requires-python = ">=3.10,<3.12"
license = { file = "LICENSE" }
authors = [
{ name = "Alice Driessen", email = "adr@zurich.ibm.com" },
{ name = "Benedek Harsanyi", email = "hben.0204@gmail.com" },
{ name = "Jannis Born", email = "jab@zurich.ibm.com" },
]
keywords = [
"Machine Learning",
"Optimal Transport",
"Neural OT",
"Monge Gap",
"Conditional Distribution Learning"
"Conditional Distribution Learning",
]
homepage = "https://github.com/AI4SCR/conditional-monge"
repository = "https://github.com/AI4SCR/conditional-monge"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
Expand All @@ -21,53 +29,57 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Artificial Intelligence"
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dependencies = [
"anndata>=0.10.5.post1,<0.11",
"chex>=0.1.85,<0.2",
"dotmap>=1.3.30,<2",
"flax>=0.10.2,<0.11",
"jax>=0.4.36,<0.5",
"jaxlib>=0.4.36,<0.5",
"loguru>=0.7.2,<0.8",
"optax>=0.2.4,<0.3",
"optuna>=3.5.0,<4",
"ott-jax>=0.5.0,<0.6",
"pandas>=2.0.0,<3",
"pyyaml>=6.0",
"rdkit>=2023.9.5,<2024",
"scanpy>=1.9.8,<2",
"scikit-learn>=1.4.0,<2",
"scipy==1.12.0",
"seaborn>=0.13.2,<0.14",
"typer>=0.9.0,<1",
"umap-learn>=0.5.5,<0.6",
]

[project.urls]
Homepage = "https://github.com/AI4SCR/conditional-monge"
Repository = "https://github.com/AI4SCR/conditional-monge"

[tool.poetry.group.dev.dependencies]
ruff = "*"
pytest = "*"
pre-commit = "*"

[tool.poetry.dependencies]
python = ">=3.10,<3.12"
flax = "^0.10.2"
optax = "^0.2.4"
ott-jax = "^0.5.0"
scikit-learn = "^1.4.0"
typer = "^0.9.0"
loguru = "^0.7.2"
optuna = "^3.5.0"
pandas = "^2.0.0"
seaborn = "^0.13.2"
dotmap = "^1.3.30"
umap-learn = "^0.5.5"
jaxlib = "^0.4.36"
anndata = "^0.10.5.post1"
scanpy = "^1.9.8"
chex = "^0.1.85"
rdkit = "^2023.9.5"
jax = "^0.4.36"
isort = "^5.13.2"
black = "^24.4.2"
ruff = "^0.5.4"
types-pyyaml = "^6.0.12.20240311"
scipy = "1.12.0"

[[tool.poetry.source]]
name = "jax"
url = "https://storage.googleapis.com/jax-releases/jax_releases.html"
priority = "primary"
[dependency-groups]
dev = [
"black>=24.4.2,<25",
"isort>=5.13.2,<6",
"pre-commit",
"pytest",
"ruff>=0.5.4,<0.6",
"types-pyyaml>=6.0.12.20240311",
]

[tool.hatch.build.targets.sdist]
include = [
"/cmonge",
"/LICENSE",
"/README.md",
"/pyproject.toml",
]

[[tool.poetry.source]]
name = "PyPI"
priority = "primary"
[tool.hatch.build.targets.wheel]
packages = ["cmonge"]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.uv]
find-links = ["https://storage.googleapis.com/jax-releases/jax_releases.html"]

[tool.ruff]
line-length = 88
Expand Down
21 changes: 0 additions & 21 deletions requirements.txt

This file was deleted.

Loading