From 86b015ab5544f954eb3134dac5399ad5b7c337de Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:48:28 -0400 Subject: [PATCH] move to pyproject.toml --- MANIFEST.in | 4 ++- pyproject.toml | 62 ++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 67 +------------------------------------------------- 3 files changed, 66 insertions(+), 67 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index b328529..3f546e8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,7 @@ include README.rst include CHANGELOG.rst include LICENSE.rst -global-exclude *.pyc + +prune tests exclude .gitignore +global-exclude *.pyc diff --git a/pyproject.toml b/pyproject.toml index cc7eecb..a726594 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,61 @@ +[build-system] +requires = ["setuptools"] +build-backend="setuptools.build_meta" + +[project] +name = "sphinxcontrib-mermaid" +authors = [{name = "Martín Gaitán", email = "gaitan@gmail.com"}] +description="Mermaid diagrams in yours Sphinx powered docs" +readme = "README.rst" +license = { text = "BSD" } +version = "0.9.2" +requires-python = ">=3.9" +keywords = [] + +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Environment :: Web Environment", + "Framework :: Sphinx :: Extension", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Documentation", + "Topic :: Utilities", +] + +dependencies = [ + "sphinx", + "pyyaml", +] + +[project.urls] +Repository = "https://github.com/mgaitan/sphinxcontrib-mermaid" +Homepage = "https://github.com/mgaitan/sphinxcontrib-mermaid" + +[project.optional-dependencies] +test = [ + "defusedxml", + "myst-parser", + "pytest", + "ruff", + "sphinx" +] + +[project.scripts] + +[tool.pytest.ini_options] +asyncio_mode = "strict" +testpaths = "tests" + [tool.ruff] line-length = 150 @@ -18,3 +76,7 @@ section-order = [ [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401", "F403"] + +[tool.setuptools.packages.find] +where = ["./"] +include = ["sphinxcontrib.mermaid"] diff --git a/setup.py b/setup.py index 21e1ce7..aefdf20 100644 --- a/setup.py +++ b/setup.py @@ -1,66 +1 @@ -from setuptools import find_namespace_packages, setup - -readme = open("README.rst", encoding="utf-8").read() -changes = open("CHANGELOG.rst", encoding="utf-8").read() -version = "0.9.2" - - -def long_description(): - """ - return readme + changes, removing directive blocks that are only valid in the context - of sphinx doc""" - - def remove_block(text, token, margin=0): - input_lines = text.splitlines() - for i, l in enumerate(input_lines): - if l.startswith(token): - break - start = i - end = input_lines.index("", start + margin) - return "\n".join(input_lines[:start] + input_lines[end:]) - - readme_ = remove_block(readme, ".. mermaid::", margin=2) - readme_ = remove_block(readme_, ".. autoclasstree::") - readme_ = remove_block(readme_, ".. autoclasstree::") - readme_ = remove_block(readme_, ".. versionchanged::") - return f"{readme_}\n\n{changes}" - - -setup( - name="sphinxcontrib-mermaid", - version=version, - url="https://github.com/mgaitan/sphinxcontrib-mermaid", - download_url="https://pypi.python.org/pypi/sphinxcontrib-mermaid", - license="BSD", - author="Martín Gaitán", - author_email="gaitan@gmail.com", - description="Mermaid diagrams in yours Sphinx powered docs", - long_description=long_description(), - python_requires=">=3.7", - classifiers=[ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Environment :: Web Environment", - "Framework :: Sphinx :: Extension", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: Documentation", - "Topic :: Utilities", - ], - platforms="any", - packages=find_namespace_packages(where="./", include=["sphinxcontrib.mermaid"]), - package_dir={"": "./"}, - include_package_data=True, - install_requires=["sphinx", "pyyaml"], - extras_require={"test": ["defusedxml", "myst-parser", "pytest", "ruff", "sphinx"]}, -) +__import__("setuptools").setup()