1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
# pyproject.toml
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[tool.hatch.version]
source = "vcs"
# https://peps.python.org/pep-0621/
[project]
name = "npe2"
dynamic = ["version"]
description = "napari plugin engine v2"
readme = "README.md"
requires-python = ">=3.8"
license = { text = "BSD-3-Clause" }
authors = [
{ name = "Talley Lambert", email = "talley.lambert@gmail.com" },
{ name = "Nathan Clack" },
]
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Typing :: Typed",
]
dependencies = [
"PyYAML",
"platformdirs",
"build>=1",
"psygnal>=0.3.0",
"pydantic",
"tomli-w",
"tomli; python_version < '3.11'",
"rich",
"typer",
]
[project.urls]
homepage = "https://github.com/napari/npe2"
repository = "https://github.com/napari/npe2"
# https://peps.python.org/pep-0621/#dependencies-optional-dependencies
[project.optional-dependencies]
testing = [
"magicgui",
"napari-plugin-engine",
"napari-svg==0.1.5",
"numpy",
"pytest",
"pytest-cov",
"jsonschema",
"pytest-pretty",
]
dev = ["black", "ipython", "isort", "mypy", "pre-commit"]
docs = ["Jinja2", "magicgui>=0.3.3"]
json = ["jsonschema"]
# Entry points
# https://peps.python.org/pep-0621/#entry-points
# same as console_scripts entry point
[project.scripts]
npe2 = "npe2.cli:main"
[project.entry-points."distutils.commands"]
npe2_compile = "npe2._setuptools_plugin:npe2_compile"
[project.entry-points."pytest11"]
npe2 = "npe2._pytest_plugin"
[project.entry-points."setuptools.finalize_distribution_options"]
finalize_npe2 = "npe2._setuptools_plugin:finalize_npe2"
[tool.check-manifest]
ignore = []
[tool.pytest.ini_options]
filterwarnings = ["error:::npe2"]
addopts = "-m 'not github_main_only'"
markers = [
"github_main_only: Test to run only on github main (verify it does not break latest napari docs build)",
]
[tool.black]
target-version = ['py38', 'py39', 'py310']
line-length = 88
# https://github.com/charliermarsh/ruff
[tool.ruff]
line-length = 88
target-version = "py38"
fix = true
src = ["src/npe2", "tests"]
lint.select = [
"E",
"F",
"W", #flake8
"UP", # pyupgrade
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"TID", # flake8-tidy-imports
"RUF", # ruff-specific rules
]
[tool.ruff.lint.per-file-ignores]
"src/npe2/cli.py" = ["B008", "A00"]
"**/test_*.py" = ["RUF018"]
[tool.ruff.lint.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
keep-runtime-typing = true
[tool.ruff.lint.isort]
known-first-party = ['npe2']
# https://mypy.readthedocs.io/en/stable/config_file.html
[tool.mypy]
files = "src/**/*.py"
warn_unused_configs = true
warn_unused_ignores = true
check_untyped_defs = true
implicit_reexport = false
show_column_numbers = true
ignore_missing_imports = true
show_error_codes = true
pretty = true
[tool.coverage.run]
parallel = true
source = ["src"]
omit = [
"src/npe2/manifest/contributions/_keybindings.py",
"src/npe2/manifest/menus.py",
"src/npe2/__main__.py",
"src/npe2/manifest/package_metadata.py",
# due to all of the isolated sub-environments and sub-processes,
# it's really hard to get coverage on the setuptools plugin.
"src/npe2/_setuptools_plugin.py",
]
[tool.coverage.paths]
source = [
"src",
"/Users/runner/work/npe2/npe2/src",
"/home/runner/work/npe2/npe2/src",
"D:\\a\\npe2\\npe2\\src",
]
# https://coverage.readthedocs.io/en/6.4/config.html
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise AssertionError",
"@overload",
"@abstractmethod",
"except ImportError",
"\\.\\.\\.",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]
|