Skip to content

Commit c7cacce

Browse files
committed
add github actions, format, lint, update version number
1 parent 16e993e commit c7cacce

File tree

10 files changed

+117
-18
lines changed

10 files changed

+117
-18
lines changed

.github/workflows/publish.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish
2+
3+
permissions:
4+
id-token: write
5+
6+
on:
7+
push:
8+
tags: "*"
9+
10+
jobs:
11+
build-n-publish:
12+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@master
16+
- name: Set up Python 3.11
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: "3.11"
20+
- name: Install pypa/build
21+
run: >-
22+
python -m
23+
pip install
24+
build
25+
--user
26+
- name: Build a binary wheel and a source tarball
27+
run: >-
28+
python -m
29+
build
30+
--sdist
31+
--wheel
32+
--outdir dist/
33+
- name: Publish distribution 📦 to PyPI
34+
if: startsWith(github.ref, 'refs/tags')
35+
uses: pypa/gh-action-pypi-publish@release/v1
36+
with:
37+
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/ruff.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Python Ruff
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
name: Python Lint
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Setup checkout
11+
uses: actions/checkout@master
12+
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v6
15+
16+
- name: Lint with ruff
17+
run: uvx ruff check src tests

.github/workflows/tests.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
python-version: ["3.11", "3.12", "3.13"]
13+
resolution: ["highest", "lowest-direct"]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v6
20+
21+
- name: pytest
22+
run: uv run --extra dev --resolution ${{ matrix.resolution }} --python ${{ matrix.python-version}} pytest --cov=src tests
23+
24+
- name: Upload coverage to Codecov
25+
uses: codecov/codecov-action@v2
26+
with:
27+
token: ${{ secrets.CODECOV_TOKEN }}
28+
fail_ci_if_error: false

.github/workflows/ty.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: ty
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
static-analysis:
7+
name: ty
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Setup checkout
11+
uses: actions/checkout@v2
12+
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v6
15+
16+
- name: ty
17+
run: uv run --extra dev ty check

pyproject.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,17 @@ requires-python = ">=3.11"
2121
dependencies = ["funlib.geometry>=0.3", "scipy>=1.15.3"]
2222

2323
[project.optional-dependencies]
24-
dev = ["pytest>=8.0", "pytest-cov>=5.0", "mypy>=1.0", "ruff>=0.6"]
25-
scratch = [
26-
"dacapo-toolbox>=1.0.0",
27-
"lsds",
28-
"matplotlib>=3.10.6",
24+
dev = [
25+
"pytest>=8.0",
26+
"pytest-cov>=5.0",
27+
"ruff>=0.6",
28+
"ty>=0.0.1a21",
2929
]
30+
scratch = ["dacapo-toolbox>=1.0.0", "lsds", "matplotlib>=3.10.6"]
3031

3132
[tool.setuptools.dynamic]
3233
version = { attr = "lsd_lite.__version__" }
3334

34-
[tool.setuptools.packages.find]
35-
include = ["lsd_lite*"]
36-
3735
[tool.ruff]
3836
lint.select = ["F", "W", "I001"]
3937

lsd_lite/__init__.py renamed to src/lsd_lite/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
__all__ = ["get_affs", "get_lsds"]
55

6-
__version__ = "0.0.0"
6+
__version__ = "1.0.0"
77
__version_info__ = tuple(int(i) for i in __version__.split("."))

lsd_lite/affs.py renamed to src/lsd_lite/affs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from numpy.typing import ArrayLike, NDArray
21
from typing import Callable, Sequence
2+
33
import numpy as np
4+
from numpy.typing import ArrayLike, NDArray
45

56

67
def eq(x: NDArray, y: NDArray) -> NDArray:

lsd_lite/lsds.py renamed to src/lsd_lite/lsds.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import functools
2+
import logging
13
from collections.abc import Sequence
4+
5+
import numpy as np
26
from funlib.geometry import Coordinate
37
from numpy.lib.stride_tricks import as_strided
48
from scipy.ndimage import convolve, gaussian_filter
5-
import functools
6-
import logging
7-
import numpy as np
89

910
logger = logging.getLogger(__name__)
1011

@@ -181,15 +182,13 @@ def get_lsds(
181182
variance[d] /= sigma[d] ** 2
182183

183184
# reset 0 mass regions (this was set to 1 above to avoid nans)
184-
mass = (mass * ~mass_mask)
185+
mass = mass * ~mass_mask
185186

186187
if dims == 3 and use_paper_ordering:
187188
# rearrange for backwards compatibility
188189
pearson = pearson[[0, 2, 1]]
189190

190-
descriptor = np.concatenate(
191-
(mean_offset, variance, pearson, mass[None, :])
192-
)
191+
descriptor = np.concatenate((mean_offset, variance, pearson, mass[None, :]))
193192
descriptor = upsample(descriptor, df)
194193
label_descriptors.append(descriptor * (segmentation == label)[None, ...])
195194

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
23
import numpy as np
34
import pytest
45

tests/test_affs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
from lsd_lite import get_affs
21
import numpy as np
32
import pytest
43

4+
from lsd_lite import get_affs
5+
56
NEIGHBORHOODS = {
67
"1d": [[1], [0]],
78
"2d": [[1, 0], [0, 1]],

0 commit comments

Comments
 (0)