-
Notifications
You must be signed in to change notification settings - Fork 49
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
Integrate Twisted's customizations #315
Comments
|
Note that the code for deprecation notices is currently spread over both Twisted and pydoctor: Twisted extracts them, but pydoctor inserts them into the output and filters the deprecation decorators out of the output. |
May be Epydoc had also an exclude option, which is also a good idea |
Good idea. Especially for complex cases, where you first want to exclude something ( And we already had a tag idea for marking private
An advantage of options is that they show up in Maybe we could do both? Although I would only want to do that if there are specific scenarios in which one approach is better than the other, not just to avoid having to make a decision. |
|
Both make sens. --exclude option might be useful to exclude whole packages or class while |
|
@mthuurne thanks for the In twisted we always had to work with various bugs for deprecation helpers... so I think that if is worth adopting But regret has still limited support, without support for attribute deprecations...but I think that it is worth contributing to |
|
Note that Twisted marks modules named "test" as hidden rather than private. Hidden means they are completely excluded from the output, while private means they are invisible by default, but can be revealed via the "Show Private API" button. Tests in Twisted are documented, so I think it's a pity to omit that documentation from the generated HTML. It also means that some of pydoctor's sanity checks on docstrings will not run, making it more likely for mistakes in test documentation to remain undetected. |
|
One advantage of an exclude option at the pydoctor level would be that we could skip the parsing and analysis of the excluded code altogether, while marking modules as hidden means they are analyzed and then not included in the output. |
|
On Sat, 19 Dec 2020 at 02:21, Maarten ter Huurne ***@***.***> wrote:
One advantage of an exclude option at the pydoctor level would be that we
could skip the parsing and analysis of the excluded code altogether, while
marking modules as hidden means they are analyzed and then not included in
the output.
I'm not sure I have 100% context here, but one problem with that is that
sometimes objects are imported from private modules into public ones and if
you don't parse the private modules then you can't document objects like
this. This is unlikely to be an issue for twisted's tests, of course.
|
There are currently 3 visibility levels for documentable objects:
Excluding modules would mean we skip those files when iterating over all modules in a package, so that goes a step further than "hidden". I don't think we need to change how "public" and "private" work. So re-exporting definitions from private modules to public modules would continue to work as it does now. What the custom My first thought was that if we have docstrings in test modules, we should make them available in the HTML. But after some more thought, including discussion with @adiroiban in #341, I don't actually think it's very likely that people will be reading test docstrings in HTML: docstrings for tests are useful when a test fails or when maintaining the test suite and in both those situations the person interested in the docstrings will already have the test code opened in a text editor. I'm not sure we even need "hidden" as a visibility level: currently there is no situation which in pydoctor itself marks an object as hidden: the custom |
I like the hidden privacy class value. Without the Twisted hack that makes all test modules hidden the search index is significantly smaller that with all test modules. |
|
Privacy tweaking is now part of pydoctor (with option There still the following todo:
I'll work on the later point. I'll try to refactor such that generic extra informations to be added to objects, like deprecation, but other kind of information could be added to a "extra informations" list. The code is here: https://github.com/twisted/twisted/blob/trunk/src/twisted/python/_pydoctor.py |
Twisted has a source file in which it customizes some aspects of pydoctor:
zope.interfacetwisted.test.proto_helpersI'm not sure if the workaround is still necessary, but if it is, it would be useful for all projects that want to link to
zope.interfacedocumentation, which means it would be better to move this code into pydoctor.The decorators used to mark deprecations in Twisted are public API, so a project that uses Twisted could use those as well. In that case, it would be an advantage if the functionality for formatting them was inside pydoctor. In the future, we might want to support other deprecation mechanisms such as regret, which would be easier to do in a consistent fashion if all the code is inside pydoctor.
Having the ability to exclude certain packages from the documentation sounds like a useful feature, so we could consider to facilitate that through command line options instead of customization code.
Put together, I think all of the code customizations that Twisted currently does would actually fit better inside pydoctor itself. Integrating them would have multiple advantages:
The template customizations would remain in Twisted. We are working on breaking up the templates into smaller ones, to make customizations more fine-grained, see #299 for details.
The text was updated successfully, but these errors were encountered: