Skip to content

Commit

Permalink
Packaging: remove setup.cfg, move info into pyproject.toml (#171)
Browse files Browse the repository at this point in the history
* Move setup.cfg contents into pyproject.yaml

* Fixes for pyproject.toml changes

* Fix where to find version string when installing project

* Remove trailing whitespace

* Python 3.11 testing

* Drop python 3.8, add python 3.12

Co-authored-by: Grzegorz Bokota <[email protected]>

* Drop python 3.8, add python 3.12 in tox.ini

Co-authored-by: Grzegorz Bokota <[email protected]>

* Update tox.ini, drop python 3.8 & add python 3.12

Co-authored-by: Grzegorz Bokota <[email protected]>

* pyproject.toml, drop python 3.8 add python 3.12

Co-authored-by: Grzegorz Bokota <[email protected]>

* Bump minimum required python version to 3.9

Co-authored-by: Grzegorz Bokota <[email protected]>

* Fix typo

* Remove trailing whitespace

* Test matrix, add python 3.11 & 3.12, drop python 3.8

---------

Co-authored-by: Grzegorz Bokota <[email protected]>
  • Loading branch information
GenevieveBuckley and Czaki authored May 16, 2024
1 parent 9a22774 commit 04ec78f
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_create_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
79 changes: 78 additions & 1 deletion {{cookiecutter.plugin_name}}/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -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"
Expand All @@ -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 = [
Expand Down
96 changes: 0 additions & 96 deletions {{cookiecutter.plugin_name}}/setup.cfg

This file was deleted.

5 changes: 3 additions & 2 deletions {{cookiecutter.plugin_name}}/tox.ini
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down

0 comments on commit 04ec78f

Please sign in to comment.