Skip to content

Commit

Permalink
Merge branch 'main' into use_pymmcore_writers
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 authored Mar 4, 2024
2 parents da209b0 + c033f3b commit ca1f8e2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 26 deletions.
16 changes: 5 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@ ci:
autoupdate_commit_msg: "ci: [pre-commit.ci] autoupdate"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
- repo: https://github.com/crate-ci/typos
rev: v1.19.0
hooks:
- id: check-docstring-first
- id: end-of-file-fixer
- id: trailing-whitespace
- id: typos

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.3.0
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
- id: ruff-format

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
Expand Down
27 changes: 15 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pyqt5 = ["PyQt5"]
pyqt6 = ["PyQt6"]
pyside2 = ["PySide2"]
pyside6 = ["PySide6"]
dev = ["black", "isort", "mda-simulator", "mypy", "pre-commit", "ruff"]
dev = ["isort", "mda-simulator", "mypy", "pre-commit", "ruff"]

[project.urls]
Source = "https://github.com/pymmcore-plus/napari-micromanager"
Expand All @@ -77,34 +77,37 @@ include = ["/src", "/tests"]
[tool.ruff]
line-length = 88
target-version = "py38"

[tool.ruff.lint]
pydocstyle = { convention = "numpy" }
select = [
"E", # style errors
"W", # warnings
"F", # flakes
"D", # pydocstyle
"D417", # Missing argument descriptions in Docstrings
"I", # isort
"UP", # pyupgrade
"S", # bandit
"C", # flake8-comprehensions
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"A001", # flake8-builtins
"RUF", # ruff-specific rules
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
]
ignore = [
"D100", # Missing docstring in public module
"D107", # Missing docstring in __init__
"D203", # 1 blank line required before class docstring
"D212", # Multi-line docstring summary should start at the first line
"D213", # Multi-line docstring summary should start at the second line
"D400", # First line should end with a period
"D413", # Missing blank line after last section
"D416", # Section name should end with a colon
"C901", # Function is too complex
"D401", # First line should end with a period
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = ["D", "S"]

# https://docs.astral.sh/ruff/formatter/
[tool.ruff.format]
docstring-code-format = true

# https://docs.pytest.org/en/6.2.x/customize.html
[tool.pytest.ini_options]
minversion = "6.0"
Expand All @@ -116,7 +119,7 @@ filterwarnings = [
"ignore:<tifffile.TiffWriter.write> data with shape:DeprecationWarning:", # for napari
"ignore:`np.bool8` is a deprecated alias::skimage",
"ignore:Jupyter is migrating its paths to use standard platformdirs:",
"ignore:\\nPyarrow will become a required dependency"
"ignore:\\nPyarrow will become a required dependency",
]

# https://mypy.readthedocs.io/en/stable/config_file.html
Expand Down
2 changes: 1 addition & 1 deletion src/napari_micromanager/_mda_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def _watch_mda(
time.sleep(0.1)

def _on_mda_frame(self, image: np.ndarray, event: MDAEvent) -> None:
"""Called on the `frameReady` event from the core.""" # noqa: D401
"""Called on the `frameReady` event from the core."""
self._deck.append((image, event))

def _process_frame(
Expand Down
1 change: 1 addition & 0 deletions src/napari_micromanager/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

# this is very verbose
logging.getLogger("napari.loader").setLevel(logging.WARNING)
logging.getLogger("in_n_out").setLevel(logging.WARNING)


class MainWindow(MicroManagerToolbar):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[
[],
["--config", str(Path(__file__).parent / "test_config.cfg")],
["-c", "nonexistant"],
["-c", "nonexistent"],
],
)
def test_cli_main(argv: list) -> None:
Expand All @@ -20,7 +20,7 @@ def test_cli_main(argv: list) -> None:

with patch("napari.run") as mock_run:
with patch("qtpy.QtWidgets.QMainWindow.show") as mock_show:
if "nonexistant" in argv:
if "nonexistent" in argv:
with pytest.warns():
main(argv)
else:
Expand Down

0 comments on commit ca1f8e2

Please sign in to comment.