diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0b91cef --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: Python Tests + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.10, 3.11, 3.12] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install UV + uses: astral-sh/setup-uv@v3 + with: + version: "0.5.0" + enable-cache: true + cache-dependency-glob: | + pyproject.toml + + - name: Install python deps + run: | + uv pip install --system -e ".[test]" + + - name: Python Tests + run: pytest \ No newline at end of file diff --git a/.gitignore b/.gitignore index ff5528e..175e455 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ wheels/ *.egg-info/ .installed.cfg *.egg +/generate_tiff_offsets/_version.py # PyInstaller # Usually these files are written by a python script from a template diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..009c948 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[build-system] +build-backend = "hatchling.build" +requires = ["hatchling", "hatch-vcs"] + +[project] +name = "generate-tiff-offsets" +description = "A package to generate TIFF offsets" +authors = [ + { name = "Ilan Gold", email = "ilan.gold@helmholtz-munich.de" } +] +readme = "README.md" +requires-python = ">=3.10" +classifiers = [ + "Environment :: Console", + "Framework :: Jupyter", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Natural Language :: English", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Bio-Informatics", + "Topic :: Scientific/Engineering :: Visualization", +] +license = { text = "MIT" } +dependencies = ["tifffile>=2023.9.26"] +dynamic = ["version"] +[project.optional-dependencies] +test = ["pytest"] + +[tool.hatch.version] +source = "vcs" +[tool.hatch.build.hooks.vcs] +version-file = "generate_tiff_offsets/_version.py" +[tool.hatch.build.targets.wheel] +packages = ["src/anndata", "src/testing"] \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index 4303a90..0000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,10 +0,0 @@ -pip==19.2.3 -bump2version==0.5.11 -wheel==0.33.6 -watchdog==0.9.0 -flake8==3.7.8 -tox==3.14.0 -coverage==4.5.4 -Sphinx==1.8.5 -twine==1.14.0 -tifffile==2023.9.26 diff --git a/tests/test_generate_tiff_offsets.py b/tests/test_generate_tiff_offsets.py index 20348ed..79f6efc 100644 --- a/tests/test_generate_tiff_offsets.py +++ b/tests/test_generate_tiff_offsets.py @@ -1,21 +1,14 @@ #!/usr/bin/env python """Tests for `generate_tiff_offsets` package.""" - - -import unittest import json from generate_tiff_offsets.generate_tiff_offsets import generate_tiff_offsets - -class TestGenerate_tiff_offsets(unittest.TestCase): - """Tests for `generate_tiff_offsets` package.""" - - def test_offsets(self): - generate_tiff_offsets('./tests/test-input/multi-channel.ome.tif') - with open('./tests/test-output-expected/multi-channel.offsets.json', 'r') as f: - expected = json.loads(f.read()) - with open('./tests/test-input/multi-channel.offsets.json', 'r') as f: - actual = json.loads(f.read()) - assert(actual == expected) +def test_offsets(): + generate_tiff_offsets('./tests/test-input/multi-channel.ome.tif') + with open('./tests/test-output-expected/multi-channel.offsets.json', 'r') as f: + expected = json.loads(f.read()) + with open('./tests/test-input/multi-channel.offsets.json', 'r') as f: + actual = json.loads(f.read()) + assert(actual == expected)