-
Notifications
You must be signed in to change notification settings - Fork 106
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
Docs generation with pdoc #365
Conversation
Now cpplint/pylint don't complain 🎉 |
I just updated |
The CI stuff runs |
Hmm probably yes, I didn't do that just because I'm using a bit modified pdoc (normal pdoc sometimes hit some crazy errors while iterating over |
This CI fail was quite unexpected :( |
We have to tell mypy to not care that it has no annotations for pdoc.
|
Oh thanks, but I have the feeling that mypy was working a few days ago... (and this had to do something, though It looks like these guys didn't finish that). |
Well, yeah, I expected something like this :( Though my pylint is fine about that. |
Hmm yeah that could have something to do with it. Though I have also found occasionally mypy gets into a weird state where it doesn't pick up certain errors until I blow away its cache. An easy way to do that is the |
I'm playing with custom Jinja2 templates for pdoc right now, so would be |
Pdoc can use 'attribute docstrings' as generally described in rejected PEP 224, so I decided to update existing documentation and now it should looks like: 3-space indent shouldn't be a problem as far as I still left instance-level definitions at class level just because it looks better and doesn't mess with |
We simply failed to include |
That's nice 👍 |
Does python have some compile-time optimizers? I hit some crazy error which disappears when I'm trying to get |
Well, I realized that pdoc gets confused with |
It is simply to make names prettier (so that we get stuff like ba.Session instead of ba._session.Session). Does the |
Yes, that's a limitation with the current approach. If there is an alias in the current module it will be used, but it doesn't work if a module refers to another internal module that is publicly exposed only in some third module. In other words, it works if you have a single top-level namespace, but falls a bit apart otherwise. Fixing this would require pdoc to precompute all module members, aliases, and their visibility, which introduces more complexity than what I'm comfortable with for now. So I guess the best options are 1) not using _internal modules, 2) fixing it manually in Jinja2 templates, or 3) using Sphinx and then specifying things manually. |
Or maybe try to add some overridable function (or Jinja2 macros), the result of which will also be used by |
I'm not exactly sure if I understand what you are proposing. |
Oops; I renamed that function to 'clipboard_is_supported' and forgot to update those references. (I thought 'clipboard_available' sounded too much like it tells whether the clipboard has something on it, which is not what the function does; it simply tells whether there is clipboard functionality present at all). Would you want to fix that in your PR? If not, I can fix it myself. |
No problem, already done. :) |
Merge branch 'master' of github.com:efroemling/ballistica into docs-generation
In short, |
It's ok. 'Awful' is better than nonexistent :). It'll be nice motivation for us to clean up whichever docstrings need it. |
Okay, I think it can even be merged now (I was wrong about need in python 3.10); a few remained warnings mostly is about bastd module, which can be dealt with later 🤷♂️ Hope I didn't accidentally blow away your changes like removal of redundant Google Play functionality or what, but it would be cool if you check. :) |
Thanks for doing this. I'm finishing up some substantial changes for 1.7, but as soon as I get to a good stopping point I'll get this stuff pulled in. Should be sometime in the next several days. |
Ok I'm at a good point where I can pull this in if you can clean up those few conflicts. I'm seeing one of them is with the 'all' stuff in ba/init.py. Is setting all necessary to avoid errors in documentation generation? And is there still a problem with changing module on classes? |
Still the same. But I can do what I did in commit above or something similar. Though I didn't notice the question about |
Well, without |
This all looks great. I'll go ahead and pull it in now, and I'll try to get a cron job set up to push docs to ballistica.net soon. I'm sure I'll have some feedback but I'll spend some time getting a feel for things first. Thanks so much for doing this! |
Checklist
tools/batools/docs.py
(pylint is silent about this 🤔 )_ba.*
function signatures from its python-docstrings.pdoc
to checkenv requirementsDescription
This PR will generate documentation using pdoc library, which (it seems) has a way more advantages than current script, at least modules other than
ba
is supported.Screenshots
Type of Changes
Closes #23