Skip to content

Commit

Permalink
Move to pyproject.toml for setuptools data (#572)
Browse files Browse the repository at this point in the history
This requires more modern versions of setuptools to build, but results
in declarative metadata with fewer pieces of disparate config.

The setup.py stub is kept for now to reduce the number of steps
redistributors of nose2 will have to take to adapt. It can be removed
in a subsequent release.

Also, remove a defunct `graft` rule from `MANIFEST.in`.
Apply a fix from pre-commit hooks.
  • Loading branch information
sirosen authored Apr 25, 2023
1 parent 9e2977e commit e76cd4e
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 63 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ include README.rst
include license.txt
recursive-include nose2/tests/functional/support *.py *.txt *.cfg *.rst *.json *.egg .coveragerc
recursive-include docs *.inc *.py *.rst Makefile
graft bin
global-exclude __pycache__
global-exclude *~
global-exclude *.pyc
7 changes: 6 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ testsuites.

* Remove support for python2 and older python3 versions

* Fix support for python3.12 to avoid warnings about `addDuration`.
* Fix support for python3.12 to avoid warnings about ``addDuration``.
Thanks to :user:`cclauss` for the fix!

* ``nose2`` package metadata is converted to pyproject.toml format, using
``setuptools``. Building ``nose2`` packages from source now requires
``setuptools>=61.0.0`` or a PEP 517 compatible build frontend
(e.g. ``build``).

0.12.0 (2022-07-16)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion nose2/tests/functional/test_junitxml_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def run_with_junitxml_loaded(self, scenario, *args, **kwargs):
"-s%s" % test_dir,
"--plugin=nose2.plugins.junitxml",
"-v",
*(config_args + args)
*(config_args + args),
)
return junit_report, proc

Expand Down
59 changes: 59 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,62 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools",
]

[project]
name = "nose2"
description = "unittest with plugins"
readme = "README.rst"
keywords= [
"testing",
"tests",
"unittest",
]
authors = [
{ name = "Stephen Rosen", email = "[email protected]" },
]
requires-python = ">=3.6"
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Testing",
]
dynamic = [
"version",
]
[project.optional-dependencies]
coverage_plugin = [
"coverage",
]
dev = [
"Sphinx",
"sphinx-issues",
"sphinx_rtd_theme",
]
[project.urls]
changelog = "https://docs.nose2.io/en/latest/changelog.html"
documentation = "https://docs.nose2.io/"
repository = "https://github.com/nose-devs/nose2"
[project.scripts]
nose2 = "nose2:discover"

[tool.setuptools.dynamic]
version = {attr = "nose2.__version__"}

[tool.ruff]
select = [
"B", # flake8-bugbear
Expand Down
62 changes: 2 additions & 60 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,61 +1,3 @@
import os
import re
from setuptools import setup

from setuptools import find_packages, setup


def read_version(filename):
# use of " over ' will be enforced by "black"
version_pattern = re.compile(r'__version__ = "([^"]*)"')
with open(filename) as fp:
for line in fp:
m = version_pattern.match(line)
if m:
return m.group(1)
raise Exception(f"could not parse version from {filename}")


MAINTAINER = "Stephen Rosen"
MAINTAINER_EMAIL = "[email protected]"

LONG_DESCRIPTION = open(os.path.join(os.path.dirname(__file__), "README.rst")).read()

setup(
name="nose2",
version=read_version("nose2/__init__.py"),
packages=find_packages(),
extras_require={
"coverage_plugin": ["coverage"],
"dev": [
"Sphinx",
"sphinx_rtd_theme",
"sphinx-issues",
],
},
entry_points={"console_scripts": ["nose2 = nose2:discover"]},
# descriptive package info below
description="unittest2 with plugins, the successor to nose",
long_description=LONG_DESCRIPTION,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
url="https://github.com/nose-devs/nose2",
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Testing",
],
keywords=["unittest", "testing", "tests"],
)
setup()

0 comments on commit e76cd4e

Please sign in to comment.