diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f3c63b1..7e74b7a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: platform: [ubuntu-latest, windows-latest, macos-latest] - python-version: [3.8, 3.9, "3.10"] + python-version: [3.9, "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 diff --git a/tests/test_create_template.py b/tests/test_create_template.py index 1e01a50..09005fb 100644 --- a/tests/test_create_template.py +++ b/tests/test_create_template.py @@ -51,7 +51,7 @@ def test_run_cookiecutter_and_plugin_tests(cookies, capsys, include_reader_plugi if include_widget_plugin == "y": assert (test_path / "test_widget.py").is_file() - # if all are `n` there are no modules or tests + # if all are `n` there are no modules or tests if "y" in {include_reader_plugin, include_writer_plugin, include_sample_data_plugin, include_widget_plugin}: run_tox(str(result.project_path)) diff --git a/tox.ini b/tox.ini index b32070a..1ffa866 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,12 @@ [tox] recreate = true skipsdist = true -envlist = py{38,39,310} +envlist = py{39,310,311,312} toxworkdir = /tmp/.tox [testenv] -deps = pytest +deps = npe2 + pytest pytest-cookies tox commands = pytest -v {posargs:tests} diff --git a/{{cookiecutter.plugin_name}}/pyproject.toml b/{{cookiecutter.plugin_name}}/pyproject.toml index 0f527d3..bf1b877 100644 --- a/{{cookiecutter.plugin_name}}/pyproject.toml +++ b/{{cookiecutter.plugin_name}}/pyproject.toml @@ -1,3 +1,69 @@ +[project] +name = "{{cookiecutter.plugin_name}}" +dynamic = ["version"] +description = "{{cookiecutter.short_description}}" +readme = "README.md" +license = {file = "LICENSE"} +authors = [ + {name = "{{cookiecutter.full_name}}"}, + {email = "{{cookiecutter.email}}"}, +] +classifiers = [ + "Development Status :: 2 - Pre-Alpha", + "Framework :: napari", + "Intended Audience :: Developers", + {% if cookiecutter.license == "MIT" -%} + "License :: OSI Approved :: MIT License", + {%- elif cookiecutter.license == "BSD-3" -%} + "License :: OSI Approved :: BSD License", + {%- elif cookiecutter.license == "GNU GPL v3.0" -%} + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + {%- elif cookiecutter.license == "GNU LGPL v3.0" -%} + "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", + {%- elif cookiecutter.license == "Apache Software License 2.0" -%} + "License :: OSI Approved :: Apache Software License", + {%- elif cookiecutter.license == "Mozilla Public License 2.0" -%} + "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", + {%- endif %} + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Image Processing", +] +requires-python = ">=3.9" +dependencies = [ + "numpy", +{% if cookiecutter.include_widget_plugin == 'y' %} "magicgui", + "qtpy", + "scikit-image", +{% endif %}] + +[project.optional-dependencies] +testing = [ + "tox", + "pytest", # https://docs.pytest.org/en/latest/contents.html + "pytest-cov", # https://pytest-cov.readthedocs.io/en/latest/ +{% if cookiecutter.include_widget_plugin == 'y' %} "pytest-qt", # https://pytest-qt.readthedocs.io/en/latest/ + "napari", + "pyqt5", +{% endif %}] + +[project.entry-points."napari.manifest"] +{{cookiecutter.plugin_name}} = "{{cookiecutter.module_name}}:napari.yaml" + +{% if cookiecutter.github_repository_url != 'provide later' -%} +[project.urls] +"Bug Tracker" = "https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.plugin_name}}/issues" +"Documentation" = "https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.plugin_name}}#README.md" +"Source Code" = "https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.plugin_name}}" +"User Support" = "https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.plugin_name}}/issues" +{%- endif %} + [build-system] {% if cookiecutter.use_git_tags_for_versioning == 'y' and cookiecutter.plugin_name != "foo-bar" -%} requires = ["setuptools>=42.0.0", "wheel", "setuptools_scm"] @@ -6,6 +72,18 @@ requires = ["setuptools>=42.0.0", "wheel"] {%- endif %} build-backend = "setuptools.build_meta" +[tool.setuptools] +include-package-data = true + +[tool.setuptools.dynamic] +version = {attr = "{{cookiecutter.module_name}}.__init__.__version__"} + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.package-data] +"*" = ["*.yaml"] + {% if cookiecutter.use_git_tags_for_versioning == 'y' and cookiecutter.plugin_name != "foo-bar" %} [tool.setuptools_scm] write_to = "src/{{cookiecutter.module_name}}/_version.py" @@ -15,7 +93,6 @@ write_to = "src/{{cookiecutter.module_name}}/_version.py" line-length = 79 target-version = ['py38', 'py39', 'py310'] - [tool.ruff] line-length = 79 lint.select = [ diff --git a/{{cookiecutter.plugin_name}}/setup.cfg b/{{cookiecutter.plugin_name}}/setup.cfg deleted file mode 100644 index 30b7f33..0000000 --- a/{{cookiecutter.plugin_name}}/setup.cfg +++ /dev/null @@ -1,96 +0,0 @@ -[metadata] -name = {{cookiecutter.plugin_name}} -{% if cookiecutter.use_git_tags_for_versioning != 'y' -%} -version = attr: {{cookiecutter.module_name}}.__version__ -{%- endif %} -description = {{cookiecutter.short_description}} -long_description = file: README.md -long_description_content_type = text/markdown -{% if cookiecutter.github_repository_url != 'provide later' -%} -url = {{ cookiecutter.github_repository_url }} -{%- endif %} -author = {{cookiecutter.full_name}} -author_email = {{cookiecutter.email}} -{% if cookiecutter.license == "MIT" -%} -license = {{cookiecutter.license}} -{%- elif cookiecutter.license == "BSD-3" -%} -license = BSD-3-Clause -{%- elif cookiecutter.license == "GNU GPL v3.0" -%} -license = GPL-3.0-only -{%- elif cookiecutter.license == "GNU LGPL v3.0" -%} -license = LGPL-3.0-only -{%- elif cookiecutter.license == "Apache Software License 2.0" -%} -license = Apache-2.0 -{%- elif cookiecutter.license == "Mozilla Public License 2.0" -%} -license = MPL-2.0 -{%- endif %} -license_files = LICENSE -classifiers = - Development Status :: 2 - Pre-Alpha - Framework :: napari - Intended Audience :: Developers - {% if cookiecutter.license == "MIT" -%} - License :: OSI Approved :: MIT License - {%- elif cookiecutter.license == "BSD-3" -%} - License :: OSI Approved :: BSD License - {%- elif cookiecutter.license == "GNU GPL v3.0" -%} - License :: OSI Approved :: GNU General Public License v3 (GPLv3) - {%- elif cookiecutter.license == "GNU LGPL v3.0" -%} - License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3) - {%- elif cookiecutter.license == "Apache Software License 2.0" -%} - License :: OSI Approved :: Apache Software License - {%- elif cookiecutter.license == "Mozilla Public License 2.0" -%} - License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) - {%- endif %} - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Topic :: Scientific/Engineering :: Image Processing -{% if cookiecutter.github_repository_url != 'provide later' -%} -project_urls = - Bug Tracker = https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.plugin_name}}/issues - Documentation = https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.plugin_name}}#README.md - Source Code = https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.plugin_name}} - User Support = https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.plugin_name}}/issues -{%- endif %} - -[options] -packages = find: -install_requires = - numpy -{% if cookiecutter.include_widget_plugin == 'y' %} magicgui - qtpy - scikit-image -{% endif %} -python_requires = >=3.8 -include_package_data = True -package_dir = - =src -{% if cookiecutter.use_git_tags_for_versioning == 'y' -%} -setup_requires = setuptools_scm -{%- endif %} -# add your package requirements here - -[options.packages.find] -where = src - -[options.entry_points] -napari.manifest = - {{cookiecutter.plugin_name}} = {{cookiecutter.module_name}}:napari.yaml - -[options.extras_require] -testing = - tox - pytest # https://docs.pytest.org/en/latest/contents.html - pytest-cov # https://pytest-cov.readthedocs.io/en/latest/ -{% if cookiecutter.include_widget_plugin == 'y' %} pytest-qt # https://pytest-qt.readthedocs.io/en/latest/ - napari - pyqt5 -{% endif %} - -[options.package_data] -* = *.yaml diff --git a/{{cookiecutter.plugin_name}}/tox.ini b/{{cookiecutter.plugin_name}}/tox.ini index 1e7e0f1..9d5b1ac 100644 --- a/{{cookiecutter.plugin_name}}/tox.ini +++ b/{{cookiecutter.plugin_name}}/tox.ini @@ -1,13 +1,14 @@ # For more information about tox, see https://tox.readthedocs.io/en/latest/ [tox] -envlist = py{38,39,310}-{linux,macos,windows} +envlist = py{39,310,311,312}-{linux,macos,windows} isolated_build=true [gh-actions] python = - 3.8: py38 3.9: py39 3.10: py310 + 3.11: py311 + 3.12: py312 [gh-actions:env] PLATFORM =