Skip to content

Commit db046d3

Browse files
committed
switch to Poetry for the project build and prep new release
1 parent 233c800 commit db046d3

10 files changed

Lines changed: 3836 additions & 86 deletions

File tree

.github/workflows/format.yaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,24 @@ jobs:
1717
runs-on: ${{ matrix.os }}
1818

1919
steps:
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v3
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v5
22+
uses: actions/setup-python@v4
2323
with:
2424
python-version: ${{ matrix.python-version }}
25+
- name: Set up Poetry
26+
uses: snok/install-poetry@v1 # v1.3.4 at time of adoption
27+
with:
28+
poetry-version: "1.7.1"
29+
- uses: actions/cache@v3
30+
with:
31+
path: |
32+
~/.cache/pypoetry/virtualenvs
33+
~/.cache/pytest
34+
key: ${{ runner.os }}-poetry-tests-${{ hashFiles('poetry.lock') }}
2535
- name: Install project
26-
run: pip install .[formatting]
36+
run: poetry sync --no-interaction --with formatting
2737
- name: Run codespell
28-
run: codespell --enable-colors
38+
run: poetry run codespell --enable-colors
2939
- name: Run ruff
30-
run: ruff format --diff .
40+
run: poetry run ruff format --diff .

.github/workflows/lint.yaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,24 @@ jobs:
1717
runs-on: ${{ matrix.os }}
1818

1919
steps:
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v3
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v5
22+
uses: actions/setup-python@v4
2323
with:
2424
python-version: ${{ matrix.python-version }}
25+
- name: Set up Poetry
26+
uses: snok/install-poetry@v1 # v1.3.4 at time of adoption
27+
with:
28+
poetry-version: "1.7.1"
29+
- uses: actions/cache@v3
30+
with:
31+
path: |
32+
~/.cache/pypoetry/virtualenvs
33+
~/.cache/pytest
34+
key: ${{ runner.os }}-poetry-tests-${{ hashFiles('poetry.lock') }}
2535
- name: Install project
26-
run: pip install .[linting]
36+
run: poetry sync --no-interaction --with linting
2737
- name: Run mypy on Python ${{ matrix.python-version }} on ${{ matrix.os }}
28-
run: mypy
38+
run: poetry run mypy
2939
- name: Run ruff on Python ${{ matrix.python-version }} on ${{ matrix.os }}
30-
run: ruff check .
40+
run: poetry run ruff check .

.github/workflows/tests.yaml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,28 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
python-version: [ "3.10", "3.11", "3.12" ]
16-
os: [ macos-latest, ubuntu-latest ]
16+
os: [ ubuntu-latest, macos-latest, windows-latest, ubuntu-20.04 ]
1717
runs-on: ${{ matrix.os }}
18+
defaults:
19+
run:
20+
shell: bash
1821
steps:
19-
- uses: actions/checkout@v4
20-
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
21-
uses: actions/setup-python@v5
22+
- uses: actions/checkout@v3
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v4
2225
with:
2326
python-version: ${{ matrix.python-version }}
27+
- name: Set up Poetry
28+
uses: snok/install-poetry@v1 # v1.3.4 at time of adoption
29+
with:
30+
poetry-version: "1.7.1"
31+
- uses: actions/cache@v3
32+
with:
33+
path: |
34+
~/.cache/pypoetry/virtualenvs
35+
~/.cache/pytest
36+
key: ${{ runner.os }}-poetry-tests-${{ hashFiles('poetry.lock') }}
2437
- name: Install project
25-
run: python -Im pip install .[testsuite]
38+
run: poetry sync --no-interaction --with testsuite
2639
- name: Run unit tests on Python ${{ matrix.python-version }} on ${{ matrix.os }}
27-
run: pytest -vv
40+
run: poetry run pytest -vv

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [v0.5.4] - 2025-04-01
8+
9+
### Changed
10+
* Switch to Poetry for project build system
11+
712
## [v0.5.3] - 2025-03-28
813

914
### Changed

looptrace_regionals_vis/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from numpydoc_decorator import doc # type: ignore[import-untyped]
1212

13-
__version__ = "0.5.3"
13+
__version__ = "0.5.4"
1414

1515
_PACKAGE_NAME = package = Path(__file__).parent.name
1616

poetry.lock

Lines changed: 3693 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 71 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,77 @@
1-
[project]
1+
[tool.poetry]
22
name = "looptrace-regionals-vis"
3-
dynamic = ["version"]
4-
requires-python = ">= 3.10, < 3.13"
5-
authors = [
6-
{name = "Vince Reuter"}
7-
]
8-
description = "This project facilitates viewing, in `napari`, locus-specific spots from `looptrace`."
3+
version = "0.5.4"
4+
description = "This project facilitates viewing, in `napari`, regional spots from `looptrace`."
5+
authors = ["Vince Reuter"]
6+
license = "MIT"
97
readme = "README.md"
10-
license = {file = "LICENSE"}
8+
repository = "https://github.com/gerlichlab/looptrace-regionals-vis.git"
119
keywords = ["visualisation", "bioinformatics", "chromatin", "napari", "FISH"]
1210
classifiers = [
13-
"Development Status :: 1 - Planning",
14-
"License :: OSI Approved :: MIT License",
15-
"Operating System :: POSIX :: Linux",
16-
"Operating System :: MacOS",
17-
"Programming Language :: Python :: 3.10",
18-
"Programming Language :: Python :: 3.11",
19-
"Programming Language :: Python :: 3.12",
20-
"Topic :: Scientific/Engineering :: Bio-Informatics",
21-
"Typing :: Typed",
22-
]
23-
dependencies = [
24-
"gertils @ git+https://github.com/gerlichlab/gertils.git@v0.6.0",
25-
"importlib_resources; python_version < '3.11'",
26-
"napari >= 0.4.19; sys_platform == 'darwin'",
27-
"napari[all] >= 0.4.19; sys_platform != 'darwin'",
28-
"numpy",
29-
"numpydoc_decorator >= 2.2.1",
30-
"pandas",
31-
"pyqt6 >= 6.5.0; sys_platform == 'darwin'",
32-
"zarr >= 2.4.12",
11+
"Development Status :: 1 - Planning",
12+
"License :: OSI Approved :: MIT License",
13+
"Operating System :: POSIX :: Linux",
14+
"Operating System :: MacOS",
15+
"Operating System :: Microsoft :: Windows",
16+
"Programming Language :: Python :: 3.10",
17+
"Programming Language :: Python :: 3.11",
18+
"Programming Language :: Python :: 3.12",
19+
"Topic :: Scientific/Engineering :: Bio-Informatics",
20+
"Typing :: Typed",
3321
]
3422

3523
[build-system]
36-
requires = ["setuptools", "setuptools-scm", "wheel"]
37-
build-backend = "setuptools.build_meta"
24+
requires = ["poetry-core"]
25+
build-backend = "poetry.core.masonry.api"
3826

39-
[project.urls]
40-
Homepage = "https://github.com/gerlichlab/looptrace-regionals-vis"
41-
Repository = "https://github.com/gerlichlab/looptrace-regionals-vis.git"
42-
Issues = "https://github.com/gerlichlab/looptrace-regionals-vis/issues"
27+
[tool.poetry.plugins."napari.manifest"]
28+
looptrace-regionals-vis = "looptrace_regionals_vis:napari.yaml"
4329

44-
[tool.setuptools.dynamic]
45-
version = { attr = "looptrace_regionals_vis.__version__" }
30+
[tool.poetry.dependencies]
31+
python = ">=3.10,<3.13"
32+
gertils = { git = "https://github.com/gerlichlab/gertils.git", tag = "v0.6.0" }
33+
importlib_resources = { version = "*", markers = "python_version < '3.11'" }
34+
numpy = "*"
35+
numpydoc_decorator = ">=2.2.1"
36+
pandas = "*"
37+
zarr = ">=2.4.12"
4638

47-
[project.entry-points."napari.manifest"]
48-
looptrace-regionals-vis = "looptrace_regionals_vis:napari.yaml"
39+
# OS-specific dependency declarations
40+
napari = { version = "==0.4.19.post1", markers = "sys_platform == 'darwin'" }
41+
pyqt6 = { version = ">=6.5.0", markers = "sys_platform == 'darwin'" }
4942

50-
[project.optional-dependencies]
51-
coverage = [
52-
"coverage >= 7.5.0",
53-
]
54-
formatting = [
55-
"codespell >= 2.2.4",
56-
"ruff == 0.7.4", # https://github.com/astral-sh/ruff/issues/14681
57-
]
58-
linting = [
59-
"mypy >= 1.0.1",
60-
"pandas-stubs",
61-
"ruff == 0.7.4", # https://github.com/astral-sh/ruff/issues/14681
62-
]
63-
testsuite = [
64-
"hypothesis >= 6.92.1",
65-
"npe2",
66-
"pytest >= 7.1.0",
67-
"typer",
68-
]
43+
[tool.poetry.group.coverage]
44+
optional = true
45+
46+
[tool.poetry.group.coverage.dependencies]
47+
coverage = ">=7.5.0"
48+
49+
[tool.poetry.group.dev]
50+
optional = true
51+
52+
[tool.poetry.group.dev.dependencies]
53+
pytest = "^7.2.0"
54+
55+
[tool.poetry.group.formatting]
56+
optional = true
57+
58+
[tool.poetry.group.formatting.dependencies]
59+
codespell = ">=2.2.4"
60+
ruff = "==0.7.4" # https://github.com/astral-sh/ruff/issues/14681
61+
62+
[tool.poetry.group.linting]
63+
optional = true
64+
65+
[tool.poetry.group.linting.dependencies]
66+
mypy = ">=1.0.1"
67+
pandas-stubs = "*"
68+
ruff = "==0.7.4" # https://github.com/astral-sh/ruff/issues/14681
69+
70+
[tool.poetry.group.testsuite.dependencies]
71+
hypothesis = ">=6.92.1"
72+
npe2 = "*"
73+
pytest = ">=7.1.0"
74+
typer = "*"
6975

7076
[tool.codespell]
7177
skip = ".git,.mypy_cache,.nox,.vscode,__pycache__,poetry.lock"
@@ -75,11 +81,18 @@ check-filenames = true
7581
uri-ignore-words-list = "*"
7682

7783
[tool.mypy]
78-
files = ['looptrace_regionals_vis/*.py']
84+
files = ['looptrace_regionals_vis/*.py', 'tests/*.py']
85+
plugins = ["pydantic.mypy"]
7986
warn_redundant_casts = true
8087
warn_unused_ignores = true
8188
warn_return_any = true
8289
warn_unreachable = true
90+
enable_error_code = ["ignore-without-code"]
91+
92+
[[tool.mypy.overrides]]
93+
module = "tests.*"
94+
disable_error_code = "annotation-unchecked"
95+
disallow_untyped_defs = false
8396

8497
[[tool.mypy.overrides]]
8598
module = "looptrace_regionals_vis.*"

shell.nix

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,25 @@
55
}) {},
66
dev ? true,
77
}:
8-
let
9-
pyenv = pkgs.python311.withPackages (pp: with pp; [ pip wheel ]);
10-
pipInstallExtras = if dev then "\"[coverage,formatting,linting,testsuite]\"" else "";
8+
let py311 = pkgs.python311.withPackages (ps: with ps; [ numpy pandas ]);
9+
poetryExtras = if dev then [ "coverage" "formatting" "linting" "testsuite" ] else [ ];
10+
poetryInstallExtras = (
11+
if poetryExtras == [] then ""
12+
else pkgs.lib.concatStrings [ " --with " (pkgs.lib.concatStringsSep "," poetryExtras) ]
13+
);
1114
in
1215
pkgs.mkShell {
13-
name = "looptrace-regionals-vis-env";
14-
buildInputs = [ pyenv ];
16+
name = "looptrace-loci-vis-env";
17+
buildInputs = [ pkgs.poetry ];
1518
shellHook = ''
16-
[[ -d .venv ]] || python3.11 -m venv .venv
17-
source .venv/bin/activate
18-
installcmd='pip install -e .${pipInstallExtras}'
19+
# To get this working on the lab machine, we need to modify Poetry's keyring interaction:
20+
# https://stackoverflow.com/questions/74438817/poetry-failed-to-unlock-the-collection
21+
# https://github.com/python-poetry/poetry/issues/1917
22+
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
23+
poetry env use "${py311}/bin/python"
24+
installcmd="poetry install -vvvv --sync${poetryInstallExtras}"
1925
echo "Running installation command: $installcmd"
2026
eval "$installcmd"
27+
source "$(poetry env info --path)/bin/activate"
2128
'';
2229
}

tests/test_file_type_inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import hypothesis as hyp
88
import pytest
99
from hypothesis import strategies as st
10-
from numpydoc_decorator import doc
10+
from numpydoc_decorator import doc # type: ignore[import-untyped]
1111

1212
from looptrace_regionals_vis import find_package_files
1313
from looptrace_regionals_vis.reader import InputFileContentType

tests/test_what_can_and_cannot_be_parsed.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@
1313
MergedRoi,
1414
NonNuclearRoi,
1515
ProximityRejectedRoi,
16-
RegionOfInterest,
1716
SingletonRoi,
1817
)
1918

2019
EXAMPLE_FILES: list[Path] = list_package_example_files()
21-
ROI_TYPES_BY_FILE_TYPE: dict[InputFileContentType, set[RegionOfInterest]] = {
20+
ROI_TYPES_BY_FILE_TYPE: dict[InputFileContentType, set[type]] = {
2221
InputFileContentType.MergeContributors: {MergeContributorRoi},
2322
InputFileContentType.ProximityRejects: {ProximityRejectedRoi},
2423
InputFileContentType.NucleiLabeled: {

0 commit comments

Comments
 (0)