-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
Use sphinx to create NVDA developer documentation #9968
Conversation
I just looked at Sphinx AutoAPI which seems to offer a cleaner approach to build the docs by means of source code parsing. However, the logging of this tool is not very good. For example, if there is an error in a source file, the log file doesn't contain the name of the source file that actually failed. It also doesn't support surrogate characters in source files and seems to break on raw bytes of which it thinks they should UTF-8 continuation bytes. |
hi leonardder |
hi @michaelDCurran |
Can epydoc be removed from misc-deps while at it? |
PR introduces Flake8 errors 😲 See test results for Failed build of commit 915df16915 |
source/NVDAObjects/UIA/__init__.py
Outdated
@@ -379,16 +380,16 @@ def _get_bookmark(self): | |||
UIAHandler.UIA_TabItemControlTypeId, | |||
UIAHandler.UIA_TextControlTypeId, | |||
UIAHandler.UIA_SplitButtonControlTypeId | |||
} if UIAHandler.isUIAAvailable else None |
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.
This doesn't look like it should be in this change.
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.
You're correct, it makes sense to split this out.
source/NVDAObjects/UIA/__init__.py
Outdated
@@ -1186,7 +1189,7 @@ def _get_keyboardShortcut(self): | |||
UIAHandler.UIA_IsSelectionItemPatternAvailablePropertyId, | |||
UIAHandler.UIA_IsEnabledPropertyId, | |||
UIAHandler.UIA_IsOffscreenPropertyId, | |||
} if UIAHandler.isUIAAvailable else set() |
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.
Or this?
There seem to be some unrelated changes in this PR. I think the next step is to get this building in the |
I'd prefer to see these pieces happen as separate PR's though, if possible. |
hi feerrenrut |
PR introduces Flake8 errors 😲 See test results for Failed build of commit bdedb60376 |
PR introduces Flake8 errors 😲 See test results for Failed build of commit ae97234d63 |
Once #10573, #10571 and #10574 are merged, what is plan? I assume making sphinx docs build with the scons devDocs command. If that is happening without errors, then we can merge this in I think. If you decide to go down the "roll your own" path for converting epydoc to sphinx you might want to consider using the 2to3 converter. It will handle iterating over the python files in a directory, and is smarter than regex about identifying python syntax. Modifying only doc strings should be much easier, if you hit that as a problem. |
Yes, that's True.
That's an interesting one. I'd say we should do that in a separate pr though. |
hi @LeonarddeR I checked the files about the development documents uploaded by pr 19430 and found the following problems:
|
Publishing devDocs in the output folder was a test to see whether the devDocs build on appveyor. I disabled this again as we never did this before, however I'm intending to revisit this at some point in a follow up. |
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.
In appveyor yml we refer to "developerGuide" when doing a release. Having moved the developerGuide file and the release path being harder to test, there is potential for a change in behavior here. What do you think?
Could you update the testing to talk about the testing you have done with Appveyor?
I think that we should publish the changes, user guide and developer guide with every build, which makes it easier to inspect them. |
I have temporarily added the devDocs target to the appveyor scons targets and the build succeeded. Note that I only did this to see whether the dev docs would be able to build on appveyor. I don't think we should build them by default just yet. |
This looks ok, is there more work remaining before we merge this? |
Nope, if this looks ok to you, go ahead and merge this. We'll have to
fineutne the output anyway
|
I have built this locally, bear in mind there are many warnings and a few errors. These will have to be fixed piece by piece, a single large PR will be hard to manage. Full error:
|
- espeakedit.exe - eSpeak NG has ability to build voice files natively - epydoc - were using Sphinx as of nvaccess/nvda#9968 - Boost - were using optional from C++ 17 as of nvaccess/nvda#9661
Fix-up of PR nvaccess#9968
* Remove unused dependencies: - espeakedit.exe - eSpeak NG has ability to build voice files natively - epydoc - were using Sphinx as of nvaccess/nvda#9968 - Boost - were using optional from C++ 17 as of nvaccess/nvda#9661 * Revert "BRLAPI for Python 3.8 (#20)" This reverts commit 9121704.
Link to issue number:
Fixes #9840
Summary of the issue:
When we switched to Python 3, we had to abandon Epydoc for developer documentation.
From the alternatives, sphinx seemed to be the most useful to us:
Description of how this pull request fixes the issue:
This pr reimplements the functionality of
scons devDocs
, they are now build using sphinx.Testing performed:
Tested that building the docs results into a structure of html files and that the build log doesn't contain any warnings related to parse errors of the source code.
Known issues with pull request:
Incompatible doc string syntax
Currently, we use epytext/epydoc style annotations for our doc strings. such as:
Sphinx uses directives like
:param
and:type
. It also allows nesting them, e.g.:param test int: a parameter
Another important prerequisite is that sphinx doc strings require an empty line between the doc string body and the parameter info.
I've looked that sphinx-epytext but that doesn't handle the empty line case. It also just replaces
@
with:
in most cases.I found an interesting tutorial that deals with the conversion using sed. I myself chose a different approach and wrote a prototype python conversion script
@feerrenrut suggested using 2to3 for this. This has to be done in a follow up pr, though.
Change log entry: