From 792d9b56dbe15b2f11b2c517be4c6ed5636ca148 Mon Sep 17 00:00:00 2001 From: Sam Cunliffe Date: Tue, 4 Nov 2025 09:33:15 +0000 Subject: [PATCH 1/5] Tox to pyproject. --- pyproject.toml | 17 +++++++++++++++++ tox.ini | 14 -------------- 2 files changed, 17 insertions(+), 14 deletions(-) delete mode 100644 tox.ini diff --git a/pyproject.toml b/pyproject.toml index f76831a..ae502ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,3 +74,20 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] [[tool.mypy.overrides]] module = ["napari_matplotlib/tests/*"] disallow_untyped_defs = false + +[tool.tox] +requires = ["tox>=4.19"] +env_list = ["py311", "py312", "py313"] +isolate_build = true + +[tool.tox.gh-actions.python] +py311 = ["3.11"] +pt312 = ["3.12"] +py313 = ["3.13"] + +[tool.tox.env.test] +extras = ["testing"] +commands = [ + ["python", "-m", "pytest", "--mpl"]] + +# python -m pytest --mpl --mpl-generate-summary=html --mpl-results-path={toxinidir}/reports -v --color=yes --cov=napari_matplotlib --cov-report=xml diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 1ad69a4..0000000 --- a/tox.ini +++ /dev/null @@ -1,14 +0,0 @@ -[tox] -envlist = py{310,311,312} -isolated_build = true - -[gh-actions] -python = - 3.11: py311 - 3.12: py312 - 3.13: py313 - -[testenv] -extras = testing -commands = - python -m pytest --mpl --mpl-generate-summary=html --mpl-results-path={toxinidir}/reports -v --color=yes --cov=napari_matplotlib --cov-report=xml From 594f79de92d31ec8bded2288891aae26ddb144eb Mon Sep 17 00:00:00 2001 From: jaideepkathiresan Date: Fri, 31 Oct 2025 01:24:03 +0530 Subject: [PATCH 2/5] Merge setup.cfg into pyproject.toml and use dependency groups (#316) --- pyproject.toml | 114 +++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 70 ------------------------------ 2 files changed, 114 insertions(+), 70 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index ae502ba..2592df5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,9 +2,81 @@ requires = ["setuptools", "setuptools_scm"] build-backend = "setuptools.build_meta" +[project] +name = "napari-matplotlib" +description = "A plugin to use Matplotlib with napari" +readme = "README.md" +requires-python = ">=3.11" +license = { text = "BSD-3-Clause" } +authors = [ + { name = "David Stansby", email = "d.stansby@ucl.ac.uk" }, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Framework :: napari", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Software Development :: Testing", +] +dependencies = [ + "matplotlib", + "napari>=0.5", + "numpy>=1.23", + "tinycss2", +] +dynamic = ["version"] + +[project.urls] +"Bug Tracker" = "https://github.com/matplotlib/napari-matplotlib/issues" +Documentation = "https://napari-matplotlib.github.io" +"Source Code" = "https://github.com/matplotlib/napari-matplotlib" +"User Support" = "https://github.com/matplotlib/napari-matplotlib/issues" + +[project.entry-points."napari.manifest"] +"napari-matplotlib" = "napari_matplotlib:napari.yaml" + +[project.optional-dependencies] +docs = [ + "napari[all]", + "numpydoc", + "pydantic<2", + "pydata-sphinx-theme", + "sphinx", + "sphinx-automodapi", + "sphinx-gallery", +] +testing = [ + "napari[pyqt6_experimental]>=0.4.18", + "pooch", + "pyqt6", + "pytest", + "pytest-cov", + "pytest-mock", + "pytest-mpl", + "pytest-qt", + "tox", + "pytest-xvfb; sys_platform == 'linux'", +] + [tool.setuptools_scm] write_to = "src/napari_matplotlib/_version.py" +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.package-dir] +"" = "src" + +[tool.setuptools.package-data] +"*" = ["*.yaml"] + [tool.pytest.ini_options] filterwarnings = [ "error", @@ -75,6 +147,48 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] module = ["napari_matplotlib/tests/*"] disallow_untyped_defs = false +[dependency-groups] +docs = [ + "napari[all]", + "numpydoc", + "pydantic<2", + "pydata-sphinx-theme", + "sphinx", + "sphinx-automodapi", + "sphinx-gallery", +] +test = [ + "napari[pyqt6_experimental]>=0.4.18", + "pooch", + "pyqt6", + "pytest", + "pytest-cov", + "pytest-mock", + "pytest-mpl", + "pytest-qt", + "tox", + "pytest-xvfb; sys_platform == 'linux'", +] +dev = [ + "napari[all]", + "numpydoc", + "pydantic<2", + "pydata-sphinx-theme", + "sphinx", + "sphinx-automodapi", + "sphinx-gallery", + "napari[pyqt6_experimental]>=0.4.18", + "pooch", + "pyqt6", + "pytest", + "pytest-cov", + "pytest-mock", + "pytest-mpl", + "pytest-qt", + "tox", + "pytest-xvfb; sys_platform == 'linux'", +] + [tool.tox] requires = ["tox>=4.19"] env_list = ["py311", "py312", "py313"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 5ccef5c..0000000 --- a/setup.cfg +++ /dev/null @@ -1,70 +0,0 @@ -[metadata] -name = napari-matplotlib -description = A plugin to use Matplotlib with napari -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/matplotlib/napari-matplotlib -author = David Stansby -author_email = d.stansby@ucl.ac.uk -license = BSD-3-Clause -license_files = LICENSE -classifiers = - Development Status :: 5 - Production/Stable - Framework :: napari - Intended Audience :: Developers - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Topic :: Software Development :: Testing -project_urls = - Bug Tracker = https://github.com/matplotlib/napari-matplotlib/issues - Documentation = https://napari-matplotlib.github.io - Source Code = https://github.com/matplotlib/napari-matplotlib - User Support = https://github.com/matplotlib/napari-matplotlib/issues - -[options] -packages = find: -install_requires = - matplotlib - napari>=0.5 - numpy>=1.23 - tinycss2 -python_requires = >=3.11 -include_package_data = True -package_dir = - =src -setup_requires = - setuptools-scm - -[options.packages.find] -where = src - -[options.entry_points] -napari.manifest = - napari-matplotlib = napari_matplotlib:napari.yaml - -[options.extras_require] -docs = - napari[all] - numpydoc - pydantic<2 - pydata-sphinx-theme - sphinx - sphinx-automodapi - sphinx-gallery -testing = - napari[pyqt6_experimental]>=0.4.18 - pooch - pyqt6 - pytest - pytest-cov - pytest-mock - pytest-mpl - pytest-qt - tox - pytest-xvfb;sys_platform == 'linux' - -[options.package_data] -* = *.yaml From 4fd667e7188dc6233093459811d54fc692f09e14 Mon Sep 17 00:00:00 2001 From: Sam Cunliffe Date: Tue, 4 Nov 2025 09:45:24 +0000 Subject: [PATCH 3/5] Rest of the pytest command with MPL extensions. --- pyproject.toml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2592df5..6d4cc99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -201,7 +201,17 @@ py313 = ["3.13"] [tool.tox.env.test] extras = ["testing"] -commands = [ - ["python", "-m", "pytest", "--mpl"]] +commands = [[ + "python", + "-m", + "pytest", + "--mpl", + "--mpl-generate-summary=html", + "--mpl-results-path={toxinidir}/reports", + "-v", + "--color=yes", + "--cov=napari_matplotlib", + "--cov-report=xml" +]] # python -m pytest --mpl --mpl-generate-summary=html --mpl-results-path={toxinidir}/reports -v --color=yes --cov=napari_matplotlib --cov-report=xml From 73eb7fdc375d3d1fa80db80d71060d6be450fb45 Mon Sep 17 00:00:00 2001 From: Sam Cunliffe Date: Tue, 4 Nov 2025 10:00:56 +0000 Subject: [PATCH 4/5] `tox-gh` instead of `tox-gh-actions`. And add `tox-uv` for speed. --- .github/workflows/test_and_deploy.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index bd43879..eac6db3 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -64,7 +64,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install tox tox-gh-actions + python -m pip install tox tox-gh tox-uv # this runs the platform-specific tests declared in tox.ini - name: Test with tox diff --git a/pyproject.toml b/pyproject.toml index 6d4cc99..06e4bc1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -194,7 +194,7 @@ requires = ["tox>=4.19"] env_list = ["py311", "py312", "py313"] isolate_build = true -[tool.tox.gh-actions.python] +[tool.tox.gh.python] py311 = ["3.11"] pt312 = ["3.12"] py313 = ["3.13"] From 9926ae69ceadf7543435f12a5afd2eda62e9537e Mon Sep 17 00:00:00 2001 From: Sam Cunliffe Date: Tue, 4 Nov 2025 10:25:58 +0000 Subject: [PATCH 5/5] Fix reports dir for upload. --- pyproject.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 06e4bc1..6b54e14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -207,11 +207,9 @@ commands = [[ "pytest", "--mpl", "--mpl-generate-summary=html", - "--mpl-results-path={toxinidir}/reports", + "--mpl-results-path=./reports", "-v", "--color=yes", "--cov=napari_matplotlib", "--cov-report=xml" ]] - -# python -m pytest --mpl --mpl-generate-summary=html --mpl-results-path={toxinidir}/reports -v --color=yes --cov=napari_matplotlib --cov-report=xml