-
Notifications
You must be signed in to change notification settings - Fork 32
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
Ignore exceptions in autodoc_property_type #142
Conversation
I haven't tested this but I think it will fix the issue. |
sadly, this does fix the issue. It just hides the errros. .. autoclass:: pyrf24.rf24_network.RF24NetworkHeader
:members: to_node type from_node id reserved to_string
.. property:: next_id
:classmethod:
The next sequential identifying number used for the next created header's `id`. FYI: Only |
We can probably get rid of the unused variable: --- a/sphinx_immaterial/apidoc/python/autodoc_property_type.py
+++ b/sphinx_immaterial/apidoc/python/autodoc_property_type.py
@@ -26,7 +26,6 @@ def _get_property_getter(obj: Any) -> Any:
def _get_property_return_type(obj: Any) -> Optional[str]:
- fget = _get_property_getter(obj)
doc = obj.__doc__
if doc is None:
return None I've got a working theory (assuming --- a/sphinx_immaterial/apidoc/python/autodoc_property_type.py
+++ b/sphinx_immaterial/apidoc/python/autodoc_property_type.py
@@ -19,7 +19,7 @@ property_sig_re = re.compile("^(\\(.*)\\)\\s*->\\s*(.*)$")
def _get_property_getter(obj: Any) -> Any:
# property
func = sphinx.util.inspect.safe_getattr(obj, "fget", None)
- if func is None:
+ if func is None or getattr(func, "__text_signature__", None) is None:
# cached_property
func = sphinx.util.inspect.safe_getattr(obj, "func", None)
return func |
When verifying the CI in #145, I added some config for black to the toml. This config alters the exit code returned by black. Previously, it was allowing unformatted code to pass in CI, but now it is properly alerting us to unformatted code. Unfortunately, I don't see the file tests/python_apigen_test_modules/_alpha.py that it is complaining about here |
I found the file on the main branch. Its weird that black scans the files that only exist on base branch. |
This seems to be because the CI runs on both PR sync events and any push event. The PR sync events are the ones that black scans the base branch (resulting in alerts about files that don't exist on the head branch). |
Thanks --- I rebased this branch, and fixed the formatting issue. |
I also fixed the bug with the return types not being listed for pybind11 properties, and added some unit tests to prevent regressions in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work (yet again) - especially with getting the return type annotations working for pybind11. Its good to see the new test pkg getting used for more than 1 test 👍🏼
tests/issue_134/sphinx-immaterial-pybind11-issue-134/sphinx_immaterial_pybind11_issue_134.cpp
Show resolved
Hide resolved
* add simple pybind11 example for testing * move pytest reqs, & add pytest config to toml * add failing test also test to validate example pkg * install test deps with pkg/lint tools - force black exit code to reflect required changes - ran black on object_toc.py - move linting tools' config to pyproject.toml The repo structure has changed since refactors (in previous PRs). So, the CI now does: - run mypy on all py files. - run pylint on all pkg files. - run black on all py files. * add pyyaml to test reqs * use custon sig in pybind11 test and show c'tor in test's rendered output
This regression was introduced by 8e4485e.
Co-authored-by: Brendan <[email protected]>
I'm good to go here. I'm thinking of pushing a tag v0.9.0 (after this is merged) due to the added graphviz integration. Unless you prefer v0.8.2? |
Pushing a tag sounds good. |
Fixes #134.