Skip to content

Commit 358fba9

Browse files
committed
try to move to uv+hatch
1 parent 10e5e44 commit 358fba9

4 files changed

Lines changed: 109 additions & 20 deletions

File tree

.github/workflows/test.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,27 @@ jobs:
3434
UV_PRERELEASE: ${{ matrix.pre-release || 'disallow' }}
3535

3636
steps:
37-
- uses: actions/checkout@v5
37+
- uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
3841
- name: Set up Python ${{ matrix.python }}
39-
uses: astral-sh/setup-uv@v6
42+
uses: actions/setup-python@v5
4043
with:
4144
python-version: ${{ matrix.python }}
45+
46+
- name: Install uv
47+
uses: astral-sh/setup-uv@v3
48+
with:
4249
enable-cache: true
4350

51+
- name: Install hatch
52+
run: uv tool install hatch
53+
4454
- name: Install dependencies
4555
run: |
4656
./.scripts/ci/install_dependencies.sh
4757
48-
- name: Install pip dependencies
49-
run: uv tool install tox --with=tox-uv --with=tox-gh-actions
5058
5159
- name: Restore data cache
5260
id: data-cache
@@ -59,15 +67,7 @@ jobs:
5967
- name: Download datasets
6068
if: steps.data-cache.outputs.cache-hit != 'true'
6169
run: |
62-
tox -e download-data
63-
64-
# caching .tox is not encouraged, but since we're private and this shaves off ~1min from the step
65-
# if any problems occur and/or once the package is public, this can be removed
66-
- name: Restore tox cache
67-
uses: actions/cache@v4
68-
with:
69-
path: .tox
70-
key: tox-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('**/requirements.txt', '**/tox.ini') }}
70+
hatch run data:download
7171
7272
- name: Test
7373
timeout-minutes: 60
@@ -77,10 +77,7 @@ jobs:
7777
DISPLAY: :42
7878
PYTEST_ADDOPTS: "-n auto"
7979
run: |
80-
tox -vv
81-
# check if this can be deprecated
82-
#- name: List figures for potential debugging
83-
# ls -alh /home/runner/work/squidpy/squidpy/tests/figures
80+
hatch test --python ${{ matrix.python }} --randomize --parallel --cover --all
8481
8582
- name: Archive figures generated during testing
8683
if: always()
File renamed without changes.

hatch.toml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Default environment - what gets installed when you do "hatch shell"
2+
[envs.default]
3+
installer = "uv"
4+
features = ["dev"]
5+
6+
# Test environment - for running tests
7+
[envs.test]
8+
features = ["test"]
9+
extra-dependencies = [
10+
"pytest",
11+
"pytest-xdist",
12+
"pytest-cov",
13+
"pytest-mock",
14+
"pytest-timeout",
15+
]
16+
17+
# What you can run in the test environment
18+
[envs.test.scripts]
19+
test = "python -m pytest --color=yes --cov --cov-append --cov-report=xml --cov-config=pyproject.toml --ignore docs/ {args:-vv}"
20+
21+
# Coverage environment - for coverage reports
22+
[envs.coverage]
23+
extra-dependencies = [
24+
"coverage[toml]",
25+
"diff_cover",
26+
]
27+
28+
# What you can run in the coverage environment
29+
[envs.coverage.scripts]
30+
clean = "coverage erase"
31+
report = "coverage report --omit='tox/*'"
32+
xml = "coverage xml --omit='tox/*' -o coverage.xml"
33+
diff = "diff-cover --compare-branch origin/main coverage.xml"
34+
35+
# Docs environment - for building documentation
36+
[envs.docs]
37+
features = ["docs"]
38+
extra-dependencies = [
39+
"setuptools",
40+
]
41+
42+
# What you can run in the docs environment
43+
[envs.docs.scripts]
44+
build = "make -C docs html {args}"
45+
clean = "make -C docs clean"
46+
check = "make -C docs linkcheck {args}"
47+
48+
# Data environment - for downloading data
49+
[envs.data]
50+
[envs.data.scripts]
51+
download = "python ./.scripts/ci/download_data.py {args}"

pyproject.toml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ dependencies = [
7777
[project.optional-dependencies]
7878
dev = [
7979
"pre-commit>=3.0.0",
80-
"tox>=4.0.0",
80+
"hatch>=1.9.0",
8181
]
8282
test = [
8383
"scanpy[leiden]",
@@ -101,7 +101,6 @@ docs = [
101101
"myst-nb>=0.17.1",
102102
"sphinx_copybutton>=0.5.0",
103103
]
104-
105104
[project.urls]
106105
Homepage = "https://github.com/scverse/squidpy"
107106
"Bug Tracker" = "https://github.com/scverse/squidpy/issues"
@@ -120,6 +119,9 @@ source = "vcs"
120119
[tool.hatch.metadata]
121120
allow-direct-references = true
122121

122+
[tool.hatch.build.targets.wheel]
123+
packages = ["src/squidpy"]
124+
123125
[tool.hatch.metadata.hooks.fancy-pypi-readme]
124126
content-type = "text/x-rst"
125127
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
@@ -237,5 +239,44 @@ ban-relative-imports = "all"
237239

238240
[tool.pytest.ini_options]
239241
filterwarnings = [
240-
"error::numba.NumbaPerformanceWarning"
242+
"error::numba.NumbaPerformanceWarning",
243+
"ignore::UserWarning",
244+
"ignore::anndata.OldFormatWarning",
245+
"ignore:.*pkg_resources:DeprecationWarning",
246+
]
247+
python_files = "test_*.py"
248+
testpaths = ["tests/"]
249+
xfail_strict = true
250+
addopts = [
251+
"--ignore=tests/plotting/test_interactive.py",
252+
]
253+
254+
255+
[tool.coverage.run]
256+
branch = true
257+
parallel = true
258+
source = ["squidpy"]
259+
omit = [
260+
"*/__init__.py",
261+
"*/_version.py",
262+
"squidpy/pl/_interactive/*",
263+
]
264+
265+
[tool.coverage.paths]
266+
source = [
267+
"squidpy",
268+
"*/site-packages/squidpy",
269+
]
270+
271+
[tool.coverage.report]
272+
exclude_lines = [
273+
"\\#.*pragma:\\s*no.?cover",
274+
"^if __name__ == .__main__.:$",
275+
"^\\s*raise AssertionError\\b",
276+
"^\\s*raise NotImplementedError\\b",
277+
"^\\s*return NotImplemented\\b",
241278
]
279+
show_missing = true
280+
precision = 2
281+
skip_empty = true
282+
sort = "Miss"

0 commit comments

Comments
 (0)