diff --git a/setup.cfg b/.flake8 similarity index 70% rename from setup.cfg rename to .flake8 index dbdc61b9..b7510db2 100644 --- a/setup.cfg +++ b/.flake8 @@ -1,12 +1,6 @@ -[metadata] -license_file = LICENSE - [flake8] max-line-length = 100 exclude = compoundsuper.py,indexsuper.py extend-ignore = E203, E231 per-file-ignores = breathe/parser/index.py:E305 - -[bdist_wheel] -universal = 0 diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index e4ede026..c1d644d5 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/cache@v1 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- @@ -19,9 +19,9 @@ jobs: - name: install dependencies run: | - pip install -r requirements/development.txt sudo apt-get -y update sudo apt-get -y install graphviz libclang1-11 libclang-cpp11 + pip install -e .[dev] - name: install doxygen from SF binary archives env: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5134e533..34f645ff 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/cache@v1 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- - name: set up python @@ -18,7 +18,7 @@ jobs: - name: install dependencies run: | - pip install -r requirements/development.txt + pip install -e .[lint] - name: lint the source code run: make flake8 @@ -28,6 +28,3 @@ jobs: - name: type check the source code run: make type-check - - - name: check version numbers are in sync - run: make version-check diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 919d4450..070e5eed 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -36,7 +36,7 @@ jobs: - uses: actions/cache@v1 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- - name: set up python ${{ matrix.python-version }} @@ -54,7 +54,7 @@ jobs: - name: install dependencies run: | - pip install -r requirements/development.txt + pip install -e .[dev] - name: run the unit tests run: make dev-test diff --git a/Makefile b/Makefile index 8acedb7d..6e5957e8 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,3 @@ black: .PHONY: type-check type-check: mypy --warn-redundant-casts --warn-unused-ignores breathe tests - -.PHONY: version-check -version-check: - PYTHONPATH=../:$(PYTHONPATH) python3 scripts/version-check.py diff --git a/breathe-apidoc.py b/breathe-apidoc.py index a3437812..8aa276e5 100755 --- a/breathe-apidoc.py +++ b/breathe-apidoc.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- import sys diff --git a/breathe/__init__.py b/breathe/__init__.py index a53bb850..d834ab41 100644 --- a/breathe/__init__.py +++ b/breathe/__init__.py @@ -4,7 +4,7 @@ from sphinx.application import Sphinx -# Keep in sync with setup.py __version__ +# Keep version here __version__ = "4.34.0" diff --git a/breathe/apidoc.py b/breathe/apidoc.py index e7ff33eb..9775f6a6 100644 --- a/breathe/apidoc.py +++ b/breathe/apidoc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ breathe.apidoc ~~~~~~~~~~~~~~ diff --git a/documentation/environment.yaml b/documentation/environment.yaml index 9d1fb09d..f826c81f 100644 --- a/documentation/environment.yaml +++ b/documentation/environment.yaml @@ -11,4 +11,4 @@ dependencies: - doxygen - pip - pip: - - -r ../requirements/development.txt + - ..[dev] diff --git a/documentation/source/conf.py b/documentation/source/conf.py index c1cf8c34..2d928645 100644 --- a/documentation/source/conf.py +++ b/documentation/source/conf.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# # BreatheExample documentation build configuration file, created by # sphinx-quickstart on Tue Feb 3 18:20:48 2009. # @@ -123,9 +121,9 @@ release = "compare" # Only add spelling extension if it is available. We don't know if it is installed as we don't want -# to put it in the setup.py file as a dependency as we don't want Breathe to be dependent on it as -# people should be able to use Breathe without 'spelling'. There might be a better way to handle -# this. +# to put it in the pyproject.toml file as a dependency as we don't want Breathe to be dependent on +# it as people should be able to use Breathe without 'spelling'. There might be a better way to +# handle this. try: import sphinxcontrib.spelling diff --git a/mkrelease b/mkrelease index 545a75fa..c0a95c84 100755 --- a/mkrelease +++ b/mkrelease @@ -40,7 +40,7 @@ pack() tar -xf "breathe-$version.tar.gz" cd -- "breathe-$version" - python3 setup.py sdist bdist_wheel + python3 -m build mv -- dist .. cd -- .. @@ -66,6 +66,7 @@ upload() ( cd -- mkrelease_tmp + twine check --strict dist/* twine upload -- dist/* { diff --git a/pyproject.toml b/pyproject.toml index 15f421bb..65d8dddd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,76 @@ +[build-system] +requires = ["setuptools>=61"] +build-backend = "setuptools.build_meta" + +[project] +name = "breathe" +dynamic = ["version"] +authors = [ + {name = "Michael Jones", email = "m.pricejones@gmail.com"}, +] +description = "Sphinx Doxygen renderer" +license = {text = "BSD-3-Clause"} +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Environment :: Web Environment", + "Framework :: Sphinx :: Extension", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Topic :: Documentation", + "Topic :: Text Processing", + "Topic :: Utilities", +] +requires-python = ">=3.7" +dependencies = [ + "docutils>=0.12", + "Jinja2>=2.7.3", + "MarkupSafe>=0.23", + "Pygments>=1.6", + "Sphinx>=4.0,<6,!=5.0.0", +] + +[project.optional-dependencies] +lint = [ + "black==22.3.0", + "flake8", + "mypy>=0.900", +] +test = [ + "pytest", +] +dev = [ + "breathe[lint,test]", + "furo", + "pip-tools>=0.3.5", + "types-docutils>=0.14,<0.18", + "types-Pygments", + "sphinx-copybutton", +] + +[project.scripts] +breathe-apidoc = "breathe.apidoc:main" + +[project.readme] +text = """\ +Breathe is an extension to reStructuredText and Sphinx to be able to read and +render `Doxygen `__ xml output. +""" +content-type = "text/x-rst" + +[project.urls] +Home = "https://www.breathe-doc.org/" +Repository = "https://github.com/breathe-doc/breathe" + +[tool.setuptools.dynamic] +version = {attr = "breathe.__init__.__version__"} + +[tool.setuptools.packages.find] +include = ["breathe", "breathe.*"] + [tool.black] line-length = 100 extend-exclude = ''' diff --git a/requirements/development.txt b/requirements/development.txt deleted file mode 100644 index 35b1c56d..00000000 --- a/requirements/development.txt +++ /dev/null @@ -1,14 +0,0 @@ --r production.txt - -flake8 -pip-tools>=0.3.5 -pytest - -mypy>=0.900 -types-docutils>=0.14,<0.18 -types-Pygments - -black==22.3.0 - -sphinx-copybutton -furo \ No newline at end of file diff --git a/requirements/production.txt b/requirements/production.txt deleted file mode 100644 index 688298a3..00000000 --- a/requirements/production.txt +++ /dev/null @@ -1,5 +0,0 @@ -docutils>=0.12 -Jinja2>=2.7.3 -MarkupSafe>=0.23 -Pygments>=1.6 -Sphinx>=4.0,<6,!=5.0.0 diff --git a/scripts/version-check.py b/scripts/version-check.py deleted file mode 100644 index 2ad59ccb..00000000 --- a/scripts/version-check.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -This script is designed to check that the version numbers that we have in place stay in sync. The -script fails with exit code 1 if they are not the same and always prints the current status. -""" - -import sys -import re - -import breathe - -setup_version = "" -with open("setup.py") as setup: - for line in setup: - if line.startswith("__version__"): - match = re.search('"(?P[^"]*)"', line) - if match: - setup_version = match.group("version") - -if setup_version == breathe.__version__: - print("Versions match") - print(f" {setup_version}") - print(f" {breathe.__version__}") - sys.exit(0) -else: - print("Versions do not match") - print(f" {setup_version}") - print(f" {breathe.__version__}") - sys.exit(1) diff --git a/setup.py b/setup.py index fb7f73b0..a5dafd75 100644 --- a/setup.py +++ b/setup.py @@ -1,61 +1,4 @@ -# -*- coding: utf-8 -*- -try: - from setuptools import setup, find_packages -except ImportError: - import distribute_setup +from setuptools import setup - distribute_setup.use_setuptools() - from setuptools import setup, find_packages -import sys - -# Keep in sync with breathe/__init__.py __version__ -__version__ = "4.34.0" - -long_desc = """ -Breathe is an extension to reStructuredText and Sphinx to be able to read and - render `Doxygen `__ xml output. -""" - -requires = ["Sphinx>=4.0,<6,!=5.0.0", "docutils>=0.12"] - -if sys.version_info < (3, 7): - print("ERROR: Sphinx requires at least Python 3.7 to run.") - sys.exit(1) - - -setup( - name="breathe", - version=__version__, - url="https://github.com/michaeljones/breathe", - download_url="https://github.com/michaeljones/breathe", - license="BSD", - author="Michael Jones", - author_email="m.pricejones@gmail.com", - description="Sphinx Doxygen renderer", - long_description=long_desc, - zip_safe=False, - classifiers=[ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Environment :: Web Environment", - "Framework :: Sphinx :: Extension", - "Intended Audience :: Developers", - "Intended Audience :: Education", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", - "Topic :: Documentation", - "Topic :: Text Processing", - "Topic :: Utilities", - ], - platforms="any", - packages=find_packages(), - include_package_data=True, - entry_points={ - "console_scripts": [ - "breathe-apidoc = breathe.apidoc:main", - ], - }, - install_requires=requires, -) +setup(name="breathe") diff --git a/tests/warnings/source/conf.py b/tests/warnings/source/conf.py index 3dfc126d..7dde9c8b 100644 --- a/tests/warnings/source/conf.py +++ b/tests/warnings/source/conf.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# # Test Breathe Warnings documentation build configuration file, created by # sphinx-quickstart on Thu Jun 5 18:57:21 2014. #