From d4b7d0516feae4f71674601f60b2dc47cbcd886b Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Tue, 17 Jan 2023 10:04:51 +1300 Subject: [PATCH 1/6] Move project metadata to pyproject.toml, clean-up --- setup.cfg => .flake8 | 6 --- .github/workflows/documentation.yml | 4 +- .github/workflows/lint.yml | 7 +-- .github/workflows/unit_tests.yml | 4 +- Makefile | 4 -- breathe-apidoc.py | 1 - breathe/__init__.py | 2 +- breathe/apidoc.py | 1 - documentation/environment.yaml | 2 +- documentation/source/conf.py | 8 ++-- mkrelease | 3 +- pyproject.toml | 73 +++++++++++++++++++++++++++++ requirements/development.txt | 14 ------ requirements/production.txt | 5 -- scripts/version-check.py | 28 ----------- setup.py | 61 +----------------------- tests/warnings/source/conf.py | 2 - 17 files changed, 88 insertions(+), 137 deletions(-) rename setup.cfg => .flake8 (70%) delete mode 100644 requirements/development.txt delete mode 100644 requirements/production.txt delete mode 100644 scripts/version-check.py 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. # From 0bf648a82813db46c51fbaa4a0613860d6c3a4a4 Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Thu, 20 Apr 2023 11:08:17 +1200 Subject: [PATCH 2/6] lint --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d467f5bc..f64bfd84 100644 --- a/setup.py +++ b/setup.py @@ -1,2 +1,3 @@ from setuptools import setup -setup(name="breathe") \ No newline at end of file + +setup(name="breathe") From ad60b3673f10eba5bac0f4b4b8e5e53c319fa54f Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Thu, 18 Jan 2024 22:27:15 +1300 Subject: [PATCH 3/6] Move pip cache to setup-python --- .github/workflows/unit_tests.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 817df481..563e7e31 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -36,17 +36,12 @@ jobs: sphinx-version: '6.1.3' steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} - restore-keys: | - ${{ runner.os }}-pip- + - uses: actions/checkout@v4 - name: set up python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: 'pip' - name: install sphinx from PyPI or from git run: | From cb0b97d3f3a616854689ac5c5b662683f2611ff7 Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Thu, 18 Jan 2024 22:32:03 +1300 Subject: [PATCH 4/6] Also move pip cache for other workflows --- .github/workflows/documentation.yml | 12 ++++-------- .github/workflows/lint.yml | 13 +++++-------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index c1d644d5..bd7a3c65 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -6,16 +6,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} - restore-keys: | - ${{ runner.os }}-pip- + - uses: actions/checkout@v4 - name: set up python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 + with: + cache: 'pip' - name: install dependencies run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 34f645ff..d97609b0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,15 +6,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} - restore-keys: | - ${{ runner.os }}-pip- + - uses: actions/checkout@v4 + - name: set up python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 + with: + cache: 'pip' - name: install dependencies run: | From c9e46ba8e32259c3edf6f240aa26a65bd4aa9918 Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Thu, 18 Jan 2024 22:32:55 +1300 Subject: [PATCH 5/6] Remove setup.py --- setup.py | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index f64bfd84..00000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup(name="breathe") From 9633bc4990cd34aac43056290d5897caacfc269b Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Tue, 30 Jul 2024 02:46:08 +0100 Subject: [PATCH 6/6] post-merge --- .github/workflows/documentation.yml | 2 +- .github/workflows/unit_tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 4fb5bee3..40124b27 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -15,9 +15,9 @@ jobs: - name: install dependencies run: | + pip install ".[docs]" sudo apt-get -y update sudo apt-get -y install graphviz libclang1-11 libclang-cpp11 - pip install -e .[docs,lint,test] - name: install doxygen from SF binary archives env: diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 5c3eb03e..a53ae8fb 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -53,7 +53,7 @@ jobs: - name: install dependencies run: | - pip install ".[docs,lint,test]" + pip install ".[test]" - name: run the unit tests run: make dev-test