fix(docs): ensure class member order follows source#4436
fix(docs): ensure class member order follows source#4436Umpire2018 wants to merge 1 commit intolitestar-org:mainfrom
Conversation
3865d12 to
863a38d
Compare
|
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/4436 |
|
Interesting find! Does this replicate in a fresh project? If so, I think you should submit this as a bug to https://github.com/sphinx-doc/sphinx/. As for the proposed fix on our side, I'm not entirely sure this is fine to do, since it would mean that only members of @euri10, got some thoughts on this? I know how much you like to consult documentation :) |
|
vey interesting finding yeah. i agree with you it would be confusing, and if i had to choose i'd sacrifice the order for the "correct" import. now the order is already weird to me in other cases, not just class member, if you look at https://docs.litestar.dev/main/reference/middleware/constraints.html for instance i find it weird to get exceptions before classes for instance, |
863a38d to
6b03aaa
Compare
|
Alright, then let's merge this and see if can can sort out the imports again once the bug has been fixed upstream. |
any issue to follow ? |
Maybe we can consider alternatives like https://docusaurus.io/ ? |
|
idk https://docusaurus.io/ to be fair so I cant comment on this |
@euri10 Maybe this is expected behavior ? Because this is the sequence in source code and this PR haven't introduce relevant changes. litestar/litestar/middleware/constraints.py Lines 27 to 40 in 94073d3 |
yep sorry for the confusion i was speaking in general, its expected behaviour as you rightully say, with autoapi this would be ordered differently I think without thinking about how it's organized in source, |
No. We are currently implementing a lot of custom functionality in Sphinx, and I don't see enough of an upside to do the migration.
? |
- Fixes issue where class members are sometimes listed alphabetically instead of by source in middleware documentation.(litestar-org#4393) - Updates references to use the base module.
6b03aaa to
e8fd748
Compare
|
@Umpire2018 This is currently failing on docs build |

Description
At first glance, other modules works fine. e.g. https://docs.litestar.dev/main/reference/middleware/logging.html#litestar.middleware.logging.LoggingMiddlewareConfig
After digging in, i found that if a class is imported into
__init__.pyviafrom ... import ...and added to__all__, Sphinx may lose the original source order of its members so i changed to document classes directly from their original module, rather than through indirect imports in__init__.py.Closes
close #4393