Comments (3)
Would it be easy to post a tiny working example?
from sphinxcontrib-trio.
https://github.com/SunDwarf/sphinxcontrib-trio-issue-8
This should be all that's need to show the issue. Just pipenv install; cd docs; make html
.
Notice the missing await
at the beginning of test_one
despite it being an async function. The trio docs don't have this issue, despite using autodoc.
from sphinxcontrib-trio.
Ughhhh sphiiinnnnx.
sphinx.ext.autosummary
has a helper script to generate new .rst files on the fly. It's written as a standalone script, sphinx/ext/autosummary/generate.py
. So it can't assume that it's run inside a normal sphinx environment – but it wants to use autodoc functionality anyway. So at import time, it attempts to set up a fake autodoc environment, by manually registering all the normal autodoc classes.
The sphinx.ext.autosummary
extension has a callback for the sphinx build-inited
event, which calls sphinx.ext.autosummary.process_generate_options
. Then process_generate_options
imports sphinx.ext.autosummary.generate
. So at some point after sphinx's initial configuration is read and all plugins – like sphinxcontrib-trio are loaded – we end up running the code in generate.py
to set up the fake autodoc environment, and since we're doing this inside the real sphinx process, it ends up overwriting the normal autodoc environment. And in particular it overwrites sphinxcontrib-trio's customized autofunction/automethod directives.
sphinxcontrib-asyncio is spared, because of a confusing thing where you can have multiple autodoc classes registered to provide documentation for, say, functions, and they're selected based on their .priority
attributes. But each such class has an associated directive name, and you can't have multiple autodoc classes registered with the same directive name at the same time. sphinxcontrib-trio takes over the regular automethod
and autofunction
directives, so its classes get lost when the default classes are reloaded; sphinxcontrib-asyncio uses autocomethod
and autocofunction
directives, so they survive.
It looks like this was already fixed in 1.7, sort of accidentally in passing – in addition to other changes, this commit moves the fake autodoc setup code so that it's called from main
rather than at import time: sphinx-doc/sphinx@5d6413b
In the mean time, there's a silly but simple fix: we can import sphinx.ext.autosummary.generate
ourselves up front, to get all the import side-effects out of the way before we register our autodoc classes.
from sphinxcontrib-trio.
Related Issues (20)
- autodoc_member_order ignored HOT 15
- Something wrong with our sphinx compatibility matrix after #14... HOT 4
- `PyClassmember` is deprecated since Sphinx 2.1 and will be removed in Sphinx 4.0 HOT 1
- 'NoneType' object has no attribute '__dict__'
- Remove dependency on contextlib2 HOT 2
- autodoc: Inherited async methods not detected HOT 5
- autodetect :for: false positive HOT 2
- Dependabot couldn't authenticate with https://pypi.python.org/simple/
- autodoc_member_order="bysource" still not working?
- Fix compatibility with sphinx 2.1 HOT 8
- test_end_to_end fails HOT 2
- 1.1.2: is sphinxcontrib-trio not sphinx 4.0.2 ready? HOT 8
- Using both :async-with: and :async-for: should raise a warning
- Allow to mark function from the docstring when using autodoc HOT 1
- AttributeError that only occurs with trio HOT 2
- 1.1.2: pytest fails in one unit
- Dependabot can't resolve your Python dependency files
- Dependabot can't resolve your Python dependency files
- Breaks on Sphinx 1.7.0 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sphinxcontrib-trio.