Add sphinx-matlab-apidoc#334
Conversation
refactor: upgraded identification of file to use tree-sitter parser
| omit = [ | ||
| '*/_build/*' | ||
| '*/_build/*', | ||
| 'sphinxcontrib\__init__.py' |
There was a problem hiding this comment.
why is this needed? I may be missing something.
There was a problem hiding this comment.
You can update your pytest config so that it produces coverage for the things you want. I moved the pytest config to pyproject.toml below. If you want HTML coverage for the current active python version and installed Sphinx, you call pytest --cov-report=html. The HTML coverage will get generated. Ignoring the init.py is what allows you get coverage for the whole folder sphinxcontrib sanely.
[tool.pytest.ini_options]
addopts = "-ra --strict-config --strict-markers --show-capture=all --showlocals -s -vv --cov=sphinxcontrib --cov=tests --cov-report=term"
doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS"
junit_family = "xunit2"
log_cli_level = "INFO"
xfail_strict = true
[tool.coverage.run]
branch = true
omit = [
'*/_build/*',
'sphinxcontrib/__init__.py',
]| Similar to sphinx-apidoc but specifically designed for MATLAB projects. | ||
| Generates RST files per namespace and limits to 50 code files per page. | ||
|
|
||
| :copyright: Copyright 2025 by the sphinxcontrib-matlabdomain team. |
There was a problem hiding this comment.
| :copyright: Copyright 2025 by the sphinxcontrib-matlabdomain team. | |
| :copyright: Copyright by the sphinxcontrib-matlabdomain team. |
Remi-Gau
left a comment
There was a problem hiding this comment.
Not had a look in detail but we are going to need some mention of this in the doc somewhere to improve discoverability.
| return ".".join(parts) | ||
|
|
||
|
|
||
| def detect_item_type(file_path: Path) -> str: |
There was a problem hiding this comment.
Three notes on this function:
- I don't love the code duplication with
mat_types.py. This makes maintainability worse when inevitably Mathworks chooses to change/add some syntax we want to support. - Why return a string? I know/hope this is probably interned and performance isn't really a question but it feels like we should have an enum for this. This may be part of a different refactor though.
tree-sitteris blazing fast but I don't love the extra IO and CPU operations of loading and parsing each file twice if you use this.
|
Hi @remi and @apozharski . This isn't ready for review. If you have feedback on the idea, I will take that. The details on the code will likely age. |
Did you click the link? I have a whole new site to bring in. |
I like the idea in general, I was just jotting down some thoughts I had on the details while I was here :) |
This will add a function that will automatically create rst files for a MATLAB set of source files. This what I expect the API to look like: sphinx-matlab-apidoc.
Main uses:
This PR is here now for awareness. It's not ready.
What's coming after this PR is merged is testing against fairly large open source MATLAB projects, looking for parsing failures.