Skip to content

Commit

Permalink
Relaxing dependencies and moving to Hatch and Pixi (#130)
Browse files Browse the repository at this point in the history
* added hatch pyproject.toml

* add pixi

* added cuda support

* organized pyproject

* added cuda feature

* fixed python mip

* updated pydantic and other minor packages

* added uv to CI and reduce upper version restriction

* added env

* Fix pydantic.v1 integration with fastapi; fix ome-zarr broken package

* updated pydantic

* bump higra version to 6.9

* removed [api] from github workflow

* higra version bump to 6.10

* updating runners

* bump python version

* fix python versions

* bumped version and skipping server test on macos

* Avoid server being killed while trying to remove dir

---------

Co-authored-by: Ilan F. S. Theodoro <[email protected]>
  • Loading branch information
JoOkuma and ilan-theodoro authored Jul 25, 2024
1 parent 1ad2619 commit 2d35e3e
Show file tree
Hide file tree
Showing 26 changed files with 250 additions and 123 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
24 changes: 13 additions & 11 deletions .github/workflows/test_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest]
python: ["3.9", "3.10"]
python: ["3.10", "3.12"]
backend: [pyqt5]
include:
- python: 3.9
- python: 3.11
platform: windows-latest
backend: pyqt5
- python: 3.9
platform: macos-latest
- python: 3.11
platform: macos-13 # latest not-arm version
backend: pyside2
- python: 3.9
- python: 3.11
platform: ubuntu-latest
backend: pyqt6
- python: 3.9
- python: 3.11
platform: ubuntu-latest
backend: pyside2
- python: 3.9 # only this run execute coverage
- python: 3.11 # only this run execute coverage
platform: ubuntu-latest
backend: pyside6
coverage: true
Expand All @@ -51,10 +51,13 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'

- uses: tlambert03/setup-qt-libs@v1

- uses: yezz123/setup-uv@v4
with:
uv-venv: "ultrack-env"

# strategy borrowed from vispy for installing opengl libs on windows
- name: Install Windows OpenGL
if: runner.os == 'Windows'
Expand All @@ -67,9 +70,8 @@ jobs:
# of python dependendencies into a virtualenv. see tox.ini for more
- name: Install dependencies
run: |
pip install --upgrade pip
pip install setuptools tox tox-gh-actions
pip install ".[api]"
uv pip install setuptools tox tox-gh-actions
uv pip install ".[test]"
# here we pass off control of environment creation and running of tests to tox
# tox-gh-actions, installed above, helps to convert environment variables into
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,6 @@ docs/source/examples
metadata.toml
data.db
*.lock
# pixi environments
.pixi
*.egg-info
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include README.md
include LICENSE
recursive-include ultrack/widgets/ultrackwidget/resources *.json
recursive-include ultrack/widgets/ultrackwidget/resources *.json
exclude examples/**
154 changes: 152 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,159 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "ultrack"
dynamic = ["version"]
description = "Large-scale multi-hypotheses cell tracking"
readme = "README.md"
license = ""
requires-python = ">=3.9,<3.13"
authors = [
{ name = "Jordao Bragantini", email = "[email protected]" },
]
dependencies = [
"blosc2 >=2.2.0",
"click >=8.1.3",
"cloudpickle >=3.0.0",
"edt >=2.3.2",
"fastapi >= 0.109.2",
"gurobipy >=9.0.0",
"higra >= 0.6.10",
"httpx >= 0.26.0",
"imagecodecs >=2023.3.16",
"imageio >=2.28.0",
"magicgui >=0.7.2",
"mip >=1.16rc0",
"napari >=0.4.18",
"numba >=0.57.0",
"ome-zarr >= 0.9.0",
"pandas >=2.0.1",
"pillow >=10.0.0",
"psycopg2-binary >=2.9.6",
"psygnal >=0.9.0",
"pydantic >= 2",
"pydot >= 2.0.0",
"qtawesome >= 1.3.1",
"rich >=13.3.5",
"scikit-image >=0.21.0",
"seaborn >=0.13.0",
"SQLAlchemy >=2.0.0",
"toml >=0.10.2",
"torch >=2.0.1",
"urllib3",
"uvicorn >= 0.27.0.post1",
"websocket >= 0.2.1",
"websockets >= 12.0",
"zarr >=2.15.0,<3.0.0",
"pyqt5 >=5.15.4",
]

[project.optional-dependencies]
docs = [
"autodoc_pydantic >= 2.0.0",
"furo",
"myst-parser >= 2.0.0",
"nbsphinx >= 0.9.3",
"sphinx-click >=5.0.1,<6.0.0",
"sphinx-copybutton",
"sphinx-gallery == 0.15.0",
"sphinxcontrib-applehelp == 1.0.8",
]
test = [
"asv >=0.5.1",
"pre-commit >=3.2.2",
"pytest >=7.3.1",
"pytest-qt >=4.2.0",
"pytrackmate @ git+https://github.com/hadim/pytrackmate.git",
"napari[testing] > 0.4.18",
]

[project.scripts]
ultrack = "ultrack.cli.main:main"

[project.entry-points."napari.manifest"]
ultrack = "ultrack:napari.yaml"

# pixi config
[tool.pixi.project]
channels = ["conda-forge", "nvidia", "pytorch", "numba", "gurobi"]
platforms = ["linux-64", "win-64", "osx-64"]

[tool.pixi.dependencies]
click = ">=8.1.3"
cloudpickle = ">=3.0.0"
edt = ">=2.3.2"
fastapi = ">= 0.109.2"
gurobi = ">=9.0.0"
higra = ">= 0.6.10"
httpx = ">= 0.26.0"
imagecodecs = ">=2023.3.16"
imageio = ">=2.28.0"
magicgui = ">=0.7.2"
# mip = ">=1.16.0" # TODO: change to python-mip for OSX is released and when available in conda-forge
napari = ">=0.4.18"
numba = {version = ">=0.57.0", channel = "numba"}
ome-zarr = ">= 0.9"
pandas = ">=2.0.1"
pillow = ">=10.0.0"
psycopg2-binary = ">=2.9.6"
psygnal = ">=0.9.0"
pydantic = ">=2"
pydot = ">= 2.0.0"
qtawesome = ">= 1.3.1"
rich = ">=13.3.5"
scikit-image = ">=0.21.0"
seaborn = ">=0.13.0"
SQLAlchemy = ">=2.0.0"
toml = ">=0.10.2"
pytorch = {version = ">=2.0.1", channel = "pytorch"}
urllib3 = "*"
uvicorn = ">= 0.27.0.post1"
websocket = ">= 0.2.1"
websockets = ">= 12.0"
zarr = ">=2.15.0,<3.0.0"
pyqt = ">=5.15.4"

[tool.pixi.feature.cuda]
channels = ["conda-forge", "rapidsai"]
platforms = ["linux-64"] # TODO: waiting for cucim to be available for windows , "win-64"]

[tool.pixi.feature.cuda.dependencies]
cupy = "*"
cucim = "*"
pytorch-cuda = "*"

[tool.pixi.feature.cuda.system-requirements]
cuda = "11"

[tool.pytest.ini_options]
filterwarnings = [
"ignore::DeprecationWarning:pkg_resources.*:",
]

[tool.pixi.pypi-dependencies]
ultrack = { path = ".", editable = true }

[tool.pixi.environments]
default = { solve-group = "default" }
cuda = { features = ["cuda"] }
docs = { features = ["docs"], solve-group = "default" }
test = { features = ["test"], solve-group = "default" }

[tool.pixi.tasks]

# Hatch config
[tool.hatch.version]
path = "ultrack/__init__.py"

[tool.hatch.build.targets.sdist]
only-include = [
"/ultrack",
]

[tool.hatch.metadata]
allow-direct-references = true

# TODO:
# - add `test` and `docs` feature to `pixi` config
77 changes: 0 additions & 77 deletions setup.cfg

This file was deleted.

2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ deps =
pytest-cov
pytest-qt
pyqt5
poetry
testing.postgresql
git+https://github.com/hadim/pytrackmate.git
commands =
pytest -v --color=yes --cov=ultrack --cov-report=xml --durations=15 --ignore=ultrack/widgets
Expand Down
4 changes: 1 addition & 3 deletions ultrack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
# ignoring small float32/64 zero flush warning
warnings.filterwarnings("ignore", message="The value of the smallest subnormal for")

from importlib.metadata import version as _version

__version__ = _version(__name__)
__version__ = "0.6.0"

from ultrack.config.config import MainConfig, load_config
from ultrack.core.export.ctc import to_ctc
Expand Down
2 changes: 1 addition & 1 deletion ultrack/api/_test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_config():
default_config = MainConfig()
default_config.data_config = None

assert MainConfig.parse_raw(response.text) == default_config
assert response.json() == default_config.dict()


def test_manual_segment(experiment_instance: Experiment):
Expand Down
6 changes: 3 additions & 3 deletions ultrack/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ async def root() -> Dict[str, str]:


@app.get("/config/default")
async def get_default_config() -> MainConfig:
async def get_default_config() -> Dict:
"""Gets the default ultrack configuration.
Returns
Expand All @@ -184,7 +184,7 @@ async def get_default_config() -> MainConfig:
"""
config = MainConfig()
config.data_config = None
return config
return config.dict()


@app.get("/config/available")
Expand All @@ -201,7 +201,7 @@ async def get_available_configs() -> Dict:

experiment = {
"name": "Unnamed Experiment",
"config": default_config,
"config": default_config.dict(),
}

auto_detect_config = {
Expand Down
Loading

0 comments on commit 2d35e3e

Please sign in to comment.