Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvements, new tests, more typing annotations and miscellaneous fixes #967

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
15a0fe9
Support member references in compound
JasperCraeghs Jun 19, 2023
d7160fe
Store member nodes
JasperCraeghs Jun 20, 2023
6ef8cf0
Support member references in compound
JasperCraeghs Jun 21, 2023
d0fea4b
Remove unused import 'pprint'
JasperCraeghs Jun 28, 2023
d746a4b
Support member references in compound
JasperCraeghs Jun 19, 2023
2a9ed6b
Store member nodes
JasperCraeghs Jun 20, 2023
b1de593
Support member references in compound
JasperCraeghs Jun 21, 2023
b6359af
Remove unused import 'pprint'
JasperCraeghs Jun 28, 2023
ce5f503
Merge branch 'memberdef-in-groups' of github.com:JasperCraeghs/breath…
JasperCraeghs Oct 30, 2023
06f37d8
Revert bad changes
JasperCraeghs Oct 30, 2023
86b06e9
Revert unneeded change
JasperCraeghs Oct 30, 2023
4d89014
Minor refactoring to make diff in PR smaller
JasperCraeghs Oct 30, 2023
3498158
Use a matrix to test Doxygen 1.9.7
JasperCraeghs Oct 30, 2023
20f9a22
Always read in the xml file referenced by the compound
JasperCraeghs Nov 1, 2023
5b23a92
Test doxygenfunction directive with function in group
JasperCraeghs Nov 1, 2023
1247172
Began incorporating C parser
Rouslan Nov 16, 2023
3d05263
Made progress on new parser integration
Rouslan Nov 17, 2023
7e1a87a
Replaced many references to old classes
Rouslan Nov 21, 2023
4122200
Getting close to working again
Rouslan Nov 25, 2023
eee9d22
Appears to be working now
Rouslan Nov 26, 2023
58aadd4
Replaced filter objects with plain functions
Rouslan Nov 29, 2023
8b11b89
Fixed the filters
Rouslan Dec 1, 2023
a670b76
Small fixes and new tests
Rouslan Dec 5, 2023
997e1a8
More tests and another fix
Rouslan Dec 5, 2023
7163482
more tests, more fixes
Rouslan Dec 6, 2023
23cdf28
A few more fixes; a bunch more tests
Rouslan Dec 10, 2023
918525e
Another little fix
Rouslan Dec 11, 2023
ec4010e
Uncoupled test and example code and more tests
Rouslan Dec 12, 2023
4323b9c
Formatted with Black and added test
Rouslan Dec 13, 2023
5f55b64
Update unit test action
Rouslan Dec 13, 2023
5626a08
Update git actions - attempt 2
Rouslan Dec 13, 2023
cec80a6
Attempted fix for code that works locally but not on test runner
Rouslan Dec 13, 2023
6583436
Fix in Github actions and Python compatibility
Rouslan Dec 13, 2023
d64b641
Fixed problem introduced by previous fix
Rouslan Dec 13, 2023
42f9e11
Neglected to install Doxygen in unit test action
Rouslan Dec 13, 2023
9c20dc7
Updated Github actions and added much needed cache
Rouslan Dec 13, 2023
d7f7746
Better caching
Rouslan Dec 13, 2023
2f27528
Fixed mistake in actions
Rouslan Dec 13, 2023
cdb8564
Another attempt at Github actions
Rouslan Dec 13, 2023
7f48ddb
Made tests compatible with older packages and Doxygen versions
Rouslan Dec 15, 2023
925f1a1
Compatibility fixes
Rouslan Dec 15, 2023
a6e1135
A fix, new tests and linter/typing conformance
Rouslan Dec 15, 2023
771ca62
One small fix
Rouslan Dec 15, 2023
fd22f6b
Remove unused import
JasperCraeghs Dec 20, 2023
86815a9
Reorganized setup code and metadata
Rouslan Dec 20, 2023
9323b9f
Style fix
JasperCraeghs Dec 21, 2023
4071ffc
Check type of object to prevent AttributeError
JasperCraeghs Dec 21, 2023
5c3b6fb
Don't warn about duplicate memberdef with the same signature
JasperCraeghs Dec 21, 2023
5f5f7ce
Prevent IndexError when no result was found due to arg spec
JasperCraeghs Dec 22, 2023
8568960
Refactored "finders", eliminating huge bottleneck
Rouslan Dec 24, 2023
94d5f00
Parser now converts html entity tags
Rouslan Dec 26, 2023
fb2fd79
Minor fix and added new doc-strings
Rouslan Dec 26, 2023
becb3a5
Tweaked setup options and added internal documentation
Rouslan Dec 28, 2023
f70f22e
Added ability to run tests with "cached" Doxygen output
Rouslan Jan 8, 2024
a580332
Now generates pure-python parser in addition to compiled extension
Rouslan Jan 13, 2024
d479834
Removed compiled version of parser
Rouslan Jan 14, 2024
1659373
Fixed working with multiple "projects"
Rouslan Jan 22, 2024
fab44ad
Now compatible with in-development sphinx version 7.3
Rouslan Jan 22, 2024
c8fb596
Updated makefile and version check script
Rouslan Jan 23, 2024
5465c9d
fixed/silenced mypy errors
Rouslan Jan 23, 2024
db2ae32
Merge branch 'main' of https://github.com/Rouslan/breathe into member…
Rouslan Feb 10, 2024
5113947
Added Doxygen 1.9.7 to unit test action matrix
Rouslan Feb 10, 2024
01c61cd
Fixed minor lint error
Rouslan Feb 10, 2024
65f2ee1
Fixed mistake in actions
Rouslan Feb 10, 2024
26cce59
Another Github action fix
Rouslan Feb 10, 2024
31a3206
Copied fixes from "name-qualification" branch
Rouslan Apr 28, 2024
96ff636
Merged upstream changes
Rouslan Aug 2, 2024
4ce8751
Add --editable for mypy and test actions install
Rouslan Aug 2, 2024
59a31df
Fix encoding warning and compatibility with older Python
Rouslan Aug 2, 2024
eaf04b0
Made encoding explicit when using Path.write_text
Rouslan Aug 2, 2024
8d07745
Made encoding explicit when using "open()"
Rouslan Aug 2, 2024
d32d168
Make encoding explicit when using subprocess.run
Rouslan Aug 2, 2024
9e15125
Lint fix
Rouslan Aug 2, 2024
aa4cb7b
Update xml_parser_generator/schema.json
Rouslan Aug 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/cache_doxygen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: download and cache Doxygen
on:
workflow_call
jobs:
install:
runs-on: ubuntu-latest
concurrency:
group: linux-doxygen-${{ matrix.doxygen-version }}-cache
strategy:
fail-fast: false
matrix:
doxygen-version: ['1.9.4', '1.9.7']
steps:
- uses: actions/cache/restore@v4
id: cache-doxygen
with:
path: doxygen-bin-arc
key: ${{ runner.os }}-doxygen-${{ matrix.doxygen-version }}
lookup-only: true
restore-keys: |
${{ runner.os }}-doxygen-

- name: download Doxygen from SF binary archives
if: steps.cache-doxygen.outputs.cache-hit != 'true'
run: |
mkdir doxygen-bin-arc && cd doxygen-bin-arc
curl -L https://sourceforge.net/projects/doxygen/files/rel-${{ matrix.doxygen-version }}/doxygen-${{ matrix.doxygen-version }}.linux.bin.tar.gz > doxygen.tar.gz

- uses: actions/cache/save@v4
if: steps.cache-doxygen.outputs.cache-hit != 'true'
with:
path: doxygen-bin-arc
key: ${{ steps.cache-doxygen.outputs.cache-primary-key }}
56 changes: 35 additions & 21 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,59 @@
name: build the documentation
on: [push, pull_request]
env:
DOXYGEN_VERSION: 1.9.4
jobs:
build:
cache-doxygen:
uses: ./.github/workflows/cache_doxygen.yml

build:
needs: cache-doxygen
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
cache: 'pip'
cache-dependency-path: |
requirements/development.txt
requirements/production.txt

- name: install dependencies
- name: install dependencies and build extension module
run: |
pip install -r requirements/development.txt
sudo apt-get -y update
sudo apt-get -y install graphviz libclang1-11 libclang-cpp11
pip install -r requirements/development.txt
pip install --editable .

- name: install doxygen from SF binary archives
env:
DOXYGEN_VERSION: 1.9.4
- uses: actions/cache/restore@v4
id: cache-doxygen
with:
path: doxygen-bin-arc
fail-on-cache-miss: true
key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }}

- name: install Doxygen
# at some point actions/cache/restore@4 started unpacking doxygen.tar.gz
# automatically and I don't know why -- Rouslan
run: |
mkdir doxygen-bin-arc && cd doxygen-bin-arc
curl -L https://sourceforge.net/projects/doxygen/files/rel-$DOXYGEN_VERSION/doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz > doxygen.tar.gz
gunzip doxygen.tar.gz
tar xf doxygen.tar
cd doxygen-$DOXYGEN_VERSION
cd doxygen-bin-arc
if test -d doxygen; then
cd doxygen
else
gunzip doxygen.tar.gz
tar xf doxygen.tar
cd doxygen-${{ env.DOXYGEN_VERSION }}
fi
sudo make install

- name: build the documentation
run: |
make html
rm documentation/build/html/.buildinfo

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: docs build artifacts
path: |
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: set up python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
cache: 'pip'
cache-dependency-path: |
requirements/development.txt
requirements/production.txt

- name: install dependencies
run: |
Expand Down
92 changes: 62 additions & 30 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,96 @@
name: unit tests
on: [push, pull_request]
jobs:
build:
cache-doxygen:
uses: ./.github/workflows/cache_doxygen.yml

build:
needs: cache-doxygen
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
doxygen-version: ['1.9.4', '1.9.7']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
sphinx-version:
- '4.0.3'
- '4.1.2'
- '4.2.0'
- '4.3.2'
- '4.5.0'
- '5.0.2'
- '5.1.1'
- '5.3.0'
- '6.1.3'
- '7.2.6'
# version 7.3 broke up the domain modules into packages, changing
# where some classes had to be imported from
- '7.3.0'
- git+https://github.com/sphinx-doc/sphinx.git@master
exclude:
# avoid bug in following configurations
# sphinx/util/typing.py:37: in <module>
# from types import Union as types_Union
# ImportError: cannot import name 'Union' from 'types'
- python-version: '3.10'
sphinx-version: '4.0.3'
- python-version: '3.10'
sphinx-version: '4.1.2'

# Sphinx has removed support for Python 3.7, Breathe will follow.
- python-version: '3.7'
# Sphinx version 7.2 and up isn't compatible with Python 3.8
- python-version: '3.8'
sphinx-version: '7.2.6'
- python-version: '3.8'
sphinx-version: '7.3.0'
- python-version: '3.8'
sphinx-version: git+https://github.com/sphinx-doc/sphinx.git@master
- python-version: '3.7'
sphinx-version: '6.1.3'

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
requirements/development.txt
requirements/production.txt

# the latest sphinxcontrib- packages don't work with Sphinx version 4
- name: install sphinx from PyPI with compatible versions of sphinxcontrib- packages
if: ${{ startsWith(matrix.sphinx-version, '4.') }}
run: >
pip install -Iv
Sphinx==${{ matrix.sphinx-version }}
sphinxcontrib-applehelp==1.0.4
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.1
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-qthelp==1.0.3

- name: install sphinx from PyPI
if: ${{ ! startsWith(matrix.sphinx-version, 'git') && ! startsWith(matrix.sphinx-version, '4.') }}
run: |
pip install -Iv Sphinx==${{ matrix.sphinx-version }}

- name: install sphinx from git
if: startsWith(matrix.sphinx-version, 'git')
run: |
pip install ${{ matrix.sphinx-version }}

- uses: actions/cache/restore@v4
id: cache-doxygen
with:
path: doxygen-bin-arc
fail-on-cache-miss: true
key: ${{ runner.os }}-doxygen-${{ matrix.doxygen-version }}

- name: install sphinx from PyPI or from git
- name: install Doxygen
# at some point actions/cache/restore@4 started unpacking doxygen.tar.gz
# automatically and I don't know why -- Rouslan
run: |
if echo "${{ matrix.sphinx-version }}"|grep -q git; then
pip install ${{ matrix.sphinx-version }}
cd doxygen-bin-arc
if test -d doxygen; then
cd doxygen
else
pip install -Iv Sphinx==${{ matrix.sphinx-version }}
gunzip doxygen.tar.gz
tar xf doxygen.tar
cd doxygen-${{ matrix.doxygen-version }}
fi
sudo make install

- name: install dependencies
- name: install dependencies and build extension module
run: |
pip install -r requirements/development.txt
pip install --editable .

- name: run the unit tests
run: make dev-test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ com_crashlytics_export_strings.xml
# modified by build process
examples/doxygen/example.tag
examples/specific/dot_graphs/xml/dotfile.dot

# generated in editable install
/breathe/_parser.py
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
recursive-include xml_parser_generator *.py *.in *.json
include requirements/*.txt tests/*.py
graft tests/data
exclude breathe/_parser.py
global-exclude *.py[cod]
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
RM = rm -f
GENERATED_MOD = breathe/_parser.py

.PHONY: all
all: html pdf
Expand All @@ -16,9 +18,16 @@ data:
$(MAKE) -C examples/tinyxml all
$(MAKE) -C examples/specific all

$(GENERATED_MOD): \
xml_parser_generator/schema.json \
xml_parser_generator/module_template.py.in \
xml_parser_generator/make_parser.py
python3 xml_parser_generator/setuptools_builder.py

.PHONY: distclean
distclean: clean
$(MAKE) -C documentation clean
$(RM) $(GENERATED_MOD)

.PHONY: clean
clean:
Expand All @@ -31,7 +40,7 @@ test:
cd tests && python3 -m pytest -v

.PHONY: dev-test
dev-test:
dev-test: $(GENERATED_MOD)
cd tests && PYTHONPATH=../:$(PYTHONPATH) python3 -m pytest -v

.PHONY: flake8
Expand All @@ -43,7 +52,7 @@ black:
black --check .

.PHONY: type-check
type-check:
type-check: $(GENERATED_MOD)
mypy --warn-redundant-casts --warn-unused-ignores breathe tests

.PHONY: version-check
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ branch.
Requirements
------------

Breathe requires Python 3.6+, Sphinx 4.0+ and Doxygen 1.8+.
Breathe requires Python 3.8+, Sphinx 4.0+ and Doxygen 1.8+.

Mailing List Archives
---------------------
Expand Down
6 changes: 3 additions & 3 deletions breathe/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ breathe

- **directive** - Contains some rst directive definitions. These were split out
of `directives.py` when it started to become too large.
- **parser** - Contains code for parsing the doxygen xml into a tree of Python
objects. The vast majority of the code is autogenerated but there are now
small but significant tweaks which means we don't regenerate it.
- **finder** - Provides classes for finding nodes within the set of xml
files generated by doxygen. Finders are generally used in the `run` methods of
the directives to find the xml node which is then passed to the renderer to
Expand All @@ -23,6 +20,9 @@ breathe
- **directives** - Contains the definitions of some of the directives. The rest
are in the files in the `directive` folder. It also contains all the set up
code which registers with Sphinx and wires together all the various factories.
- **parser** - Contains code for parsing the doxygen xml into a tree of Python
objects. Most of its content is imported from `_parser`, which is generated
automatically when Breathe is built.
- **process** - Contains the code responsible for running the `doxygen` process
when using the `autodoxygen` directives.
- **project** - Handles the concept of a `Project` which is the breathe term for
Expand Down
10 changes: 5 additions & 5 deletions breathe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from breathe.directives.setup import setup as directive_setup
from breathe.file_state_cache import setup as file_state_cache_setup
from breathe.renderer.sphinxrenderer import setup as renderer_setup

from sphinx.application import Sphinx

# Keep in sync with setup.py __version__
# Keep in sync with pyproject.toml "version"
__version__ = "4.35.0"


def setup(app: Sphinx):
from breathe.directives.setup import setup as directive_setup
from breathe.file_state_cache import setup as file_state_cache_setup
from breathe.renderer.sphinxrenderer import setup as renderer_setup

directive_setup(app)
file_state_cache_setup(app)
renderer_setup(app)
Expand Down
Loading