Skip to content

Commit 94bbab7

Browse files
committed
switch to Potry for build, pin Napari at 0.4.19.post1, and prep version 0.3.4 release
1 parent ad8c423 commit 94bbab7

File tree

10 files changed

+3806
-107
lines changed

10 files changed

+3806
-107
lines changed

.github/workflows/format.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@ jobs:
1717
uses: actions/setup-python@v4
1818
with:
1919
python-version: ${{ matrix.python-version }}
20+
- name: Set up Poetry
21+
uses: snok/install-poetry@v1 # v1.3.4 at time of adoption
22+
with:
23+
poetry-version: "1.7.1"
24+
- uses: actions/cache@v3
25+
with:
26+
path: |
27+
~/.cache/pypoetry/virtualenvs
28+
~/.cache/pytest
29+
key: ${{ runner.os }}-poetry-tests-${{ hashFiles('poetry.lock') }}
2030
- name: Install project
21-
run: pip install .[formatting]
31+
run: poetry sync --no-interaction --with formatting
2232
- name: Run codespell
23-
run: codespell --enable-colors
33+
run: poetry run codespell --enable-colors
2434
- name: Run ruff
25-
run: ruff format --diff .
35+
run: poetry run ruff format --diff .
36+

.github/workflows/lint.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@ jobs:
1717
uses: actions/setup-python@v4
1818
with:
1919
python-version: ${{ matrix.python-version }}
20+
- name: Set up Poetry
21+
uses: snok/install-poetry@v1 # v1.3.4 at time of adoption
22+
with:
23+
poetry-version: "1.7.1"
24+
- uses: actions/cache@v3
25+
with:
26+
path: |
27+
~/.cache/pypoetry/virtualenvs
28+
~/.cache/pytest
29+
key: ${{ runner.os }}-poetry-tests-${{ hashFiles('poetry.lock') }}
2030
- name: Install project
21-
run: pip install .[linting]
31+
run: poetry sync --no-interaction --with linting
2232
- name: Run mypy on Python ${{ matrix.python-version }} on ${{ matrix.os }}
23-
run: mypy
33+
run: poetry run mypy
2434
- name: Run ruff on Python ${{ matrix.python-version }} on ${{ matrix.os }}
25-
run: ruff check .
35+
run: poetry run ruff check .
36+

.github/workflows/tests.yaml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,27 @@ jobs:
1010
python-version: [ "3.10", "3.11", "3.12" ]
1111
os: [ ubuntu-latest, macos-latest, windows-latest, ubuntu-20.04 ]
1212
runs-on: ${{ matrix.os }}
13-
13+
defaults:
14+
run:
15+
shell: bash
1416
steps:
1517
- uses: actions/checkout@v3
16-
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
18+
- name: Set up Python ${{ matrix.python-version }}
1719
uses: actions/setup-python@v4
1820
with:
1921
python-version: ${{ matrix.python-version }}
22+
- name: Set up Poetry
23+
uses: snok/install-poetry@v1 # v1.3.4 at time of adoption
24+
with:
25+
poetry-version: "1.7.1"
26+
- uses: actions/cache@v3
27+
with:
28+
path: |
29+
~/.cache/pypoetry/virtualenvs
30+
~/.cache/pytest
31+
key: ${{ runner.os }}-poetry-tests-${{ hashFiles('poetry.lock') }}
2032
- name: Install project
21-
run: python -m pip install .[testsuite]
33+
run: poetry sync --no-interaction --with testsuite
2234
- name: Run unit tests on Python ${{ matrix.python-version }} on ${{ matrix.os }}
23-
run: pytest
35+
run: poetry run pytest -v
36+

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ 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.3.4] - 2025-04-01
8+
9+
### Changed
10+
* Pin Napari at 0.4.19.post1
11+
* Switch build to Poetry
12+
713
## [v0.3.3] - 2025-03-28
814

915
### Changed

looptrace_loci_vis/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Napari plugin for visualising locus-specific points from looptrace"""
22

3-
__version__ = "0.3.3"
3+
__version__ = "0.3.4"

looptrace_loci_vis/points_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ._types import PathLike, QCFailReasons
1313
from .point_record import PointRecord
1414

15-
Input = TypeVar("Input", contravariant=True)
15+
Input = TypeVar("Input", contravariant=True) # noqa: PLC0105
1616
I1 = TypeVar("I1")
1717
I2 = TypeVar("I2", bound=Sized)
1818

looptrace_loci_vis/reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def filename_extension(self) -> str: # noqa: D102
5555
raises=dict(RuntimeError="If collection of QC statuses inferred from files doesn't make sense"),
5656
returns="A function to create layers from folder path, if folder path is parsable",
5757
)
58-
def get_reader(path: PathOrPaths) -> Optional[Reader]: # noqa: D103
58+
def get_reader(path: PathOrPaths) -> Optional[Reader]: # noqa: D103, C901, PLR0911, PLR0912
5959
if isinstance(path, str):
6060
path: Path = Path(path) # type: ignore[no-redef]
6161
if not isinstance(path, Path):

poetry.lock

Lines changed: 3668 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: 69 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,87 @@
1-
[project]
1+
[tool.poetry]
22
name = "looptrace-loci-vis"
3-
dynamic = ["version"]
4-
requires-python = ">= 3.10, < 3.13"
5-
authors = [
6-
{name = "Vince Reuter"}
7-
]
3+
version = "0.3.4"
84
description = "This project facilitates viewing, in `napari`, locus-specific 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-loci-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-
"Operating System :: Microsoft :: Windows",
18-
"Programming Language :: Python :: 3.10",
19-
"Programming Language :: Python :: 3.11",
20-
"Programming Language :: Python :: 3.12",
21-
"Topic :: Scientific/Engineering :: Bio-Informatics",
22-
"Typing :: Typed",
23-
]
24-
dependencies = [
25-
"expression >= 5.0.2",
26-
"gertils @ git+https://github.com/gerlichlab/gertils.git@v0.6.0",
27-
"napari >= 0.4.19; sys_platform == 'darwin'",
28-
"napari[all] >= 0.4.19; sys_platform != 'darwin'",
29-
"numpy",
30-
"numpydoc_decorator >= 2.2.1",
31-
"pandas",
32-
"pyqt6 >= 6.5.0; sys_platform == 'darwin'",
33-
"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",
3421
]
3522

3623
[build-system]
37-
requires = ["setuptools", "wheel"]
38-
build-backend = "setuptools.build_meta"
24+
requires = ["poetry-core"]
25+
build-backend = "poetry.core.masonry.api"
3926

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

45-
[tool.setuptools.dynamic]
46-
version = { attr = "looptrace_loci_vis.__version__" }
30+
[tool.poetry.dependencies]
31+
python = ">=3.10,<3.13"
32+
expression = ">=5.0.2"
33+
gertils = { git = "https://github.com/gerlichlab/gertils.git", tag = "v0.6.0" }
34+
numpy = "*"
35+
numpydoc_decorator = ">=2.2.1"
36+
pandas = "*"
37+
zarr = ">=2.4.12"
4738

48-
[tool.setuptools.package-data]
49-
looptrace_loci_vis = [ "napari.yaml", "examples/*.csv" ]
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'" }
5042

51-
[project.entry-points."napari.manifest"]
52-
looptrace-loci-vis = "looptrace_loci_vis:napari.yaml"
43+
[tool.poetry.group.dev]
44+
optional = true
5345

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

7170
[tool.codespell]
72-
skip = ".git,.mypy_cache,.nox,.vscode,__pycache__,poetry.lock"
71+
skip = ".git,.mypy_cache,.nox,.vscode,__pycache__,pyproject.toml,poetry.lock"
7372
builtin = "clear,rare,informal,usage,code,names"
74-
ignore-words-list = "jupyter,iff"
73+
ignore-words-list = "jupyter,iff" # prevent jupyter -> jupiter, iff -> if
7574
check-filenames = true
76-
uri-ignore-words-list = "*"
75+
uri-ignore-words-list = "*" # prevent spelling correction in URL-like values.
7776

7877
[tool.mypy]
79-
files = ['looptrace_loci_vis/*.py']
78+
files = ['looptrace_loci_vis/*.py', 'tests/*.py']
79+
plugins = ["pydantic.mypy"]
8080
warn_redundant_casts = true
8181
warn_unused_ignores = true
8282
warn_return_any = true
8383
warn_unreachable = true
84+
enable_error_code = ["ignore-without-code"]
8485

8586
[[tool.mypy.overrides]]
8687
module = "looptrace_loci_vis.*"
@@ -95,15 +96,19 @@ disallow_subclassing_any = true
9596
implicit_optional = false
9697
strict_optional = true
9798

98-
[tool.pytest.ini_options]
99-
addopts = "-vv --cov looptrace_loci_vis --cov-report term-missing"
100-
10199
[tool.ruff]
102100
# Black uses line-length = 88, but allows exceptions when breaking the line
103101
# would lead to other rule violations. Use 100 as a maximum hard limit:
104102
line-length = 100
105103
target-version = "py310"
106104

105+
[tool.ruff.lint.per-file-ignores]
106+
"tests/*.py" = [
107+
"INP001", # part of an implicit namespace package
108+
"D103", # Missing docstring in public function
109+
"ANN201", # Missing return type annotation for public function
110+
]
111+
107112
[tool.ruff.lint]
108113
select = ["ALL"]
109114
ignore = [
@@ -115,19 +120,16 @@ ignore = [
115120
# Opinionated syntax
116121
"D203", # Ignore this to instead opt for class body or docstring to possibly start right away under class.
117122
"D213", # Ignore this to instead opt for summary part of docstring to be on first physical line.
123+
"D401", # First line of docstring should be in imperative mood
118124
"TRY003", # Avoid specifying long messages outside the exception class
119125
"C408", # Unnecessary `dict` call (rewrite as a literal)
120126
"EM", # Exception must not use a (f-)string literal, assign to variable first
121127
"FIX002", # Line contains TODO, consider resolving the issue
122128
"D400", # First line should end with a period
123129
"D415", # First line should end with a period, question mark, or exclamation point
124130
"N818", # Exception should be named with an Error suffix
125-
"PLR0913", # Too many arguments in function definition
126-
"D401", # First line of docstring should be in imperative mood
127-
"PLC0105", # This suggests suffixing a type variable with variance type (e.g., co/contra)
128131

129132
# Imports and type annotations
130-
"ANN003", # Missing type annotation for kwargs
131133
"FA100", # Missing `from __future__ import annotations`, but uses `typing.*`
132134
"TCH002", # Move third-party import `...` into a type-checking block
133135
"TCH003", # Move standard library import `...` into a type-checking block
@@ -152,25 +154,5 @@ ignore = [
152154
"ISC001", # single-line-implicit-string-concatenation
153155
"ISC002", # multi-line-implicit-string-concatenation
154156
"E501", # line-too-long
155-
156-
# Other
157-
"PLR0912", # too many branches (of a conditional)
158-
"TD002", # missing author in TODO
159-
"C901", # function too complex
160-
"PLR0911", # too many return statements
161-
"LOG015", # Use own logger instead
162-
]
163-
164-
[tool.ruff.lint.per-file-ignores]
165-
"tests/*" = [
166-
# Ignore some groups of checks in our test code.
167-
"ANN", # Type annotations
168-
"D10", # Missing docstrings
169-
"INP001", # File `...` is part of an implicit namespace package. Add an `__init__.py`.
170-
171-
# Ignore some more specific checks in our test code.
172-
"D401", # First line of docstring should be in imperative mood
173-
"N802", # Function name `...` should be lowercase
174-
"S101", # Use of `assert` detected
175157
]
176158

shell.nix

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,26 @@
55
}) {},
66
dev ? true,
77
}:
8-
let
9-
pyenv = pkgs.python311.withPackages (pp: with pp; [ pip wheel ]);
10-
pipInstallExtras = if dev then "\"[formatting,linting,testsuite]\"" else "";
8+
let py311 = pkgs.python311.withPackages (ps: with ps; [ numpy pandas ]);
9+
poetryExtras = if dev then [ "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 {
1316
name = "looptrace-loci-vis-env";
14-
buildInputs = [ pyenv ];
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
}
30+

0 commit comments

Comments
 (0)