Skip to content
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

reset currentmodule to traits.has_traits so Property Factory function is correctly documented #1350

Merged
merged 1 commit into from
Nov 16, 2020

Conversation

aaronayres35
Copy link
Contributor

fixes #149

This PR simply makes a 1 line addition to the documentation by resetting currentmodule to traits.has_traits instead of traits.adaptation.api so that the Property Factory Function is correctly documented. After building the docs this is what you now see:

Screen Shot 2020-11-13 at 3 02 10 PM

Excuse the highlighted "Property" in the screenshot.

Checklist
- [ ] Tests
- [ ] Update API reference (docs/source/traits_api_reference)
- [ ] Update User manual (docs/source/traits_user_manual)
- [ ] Update type annotation hints in traits-stubs

@aaronayres35 aaronayres35 changed the title reset currentmodule to traits.has_traits so correct Property Factory function is documented reset currentmodule to traits.has_traits so Property Factory function is correctly documented Nov 13, 2020
@mdickinson
Copy link
Member

Thanks for the PR. I'm not sure that this is the right fix: the use of currentmodule in the first place feels a little fragile, in that if we move documentation sections to a different file, we have to remember to check and possibly alter those uses. Is there any sane way to avoid that use in the first place? E.g., in the .. function declaration, can we specify the full path to the function somehow?

@mdickinson
Copy link
Member

Ah, apparently there's a canonical argument to the .. function directive, but it's not available until Sphinx 4.0 (which is not yet released).

Okay, so until we have that available, maybe the only sane way is to set currentmodule immediately before any and all .. function directives (at least outside the API documentation). Or we find a way to rewrite so that we don't need those directives.

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a quick fix, though I'd still be interested to know whether there are cleaner solutions.

However, I think that's a question for a separate issue/PR, and affects more than just this one case - there are various places where we're using the .. method, .. function and .. class directives within the user documentation, which feels a bit wrong when those functions, classes and methods are already being documented in the API documentation.

@mdickinson mdickinson merged commit 88500c7 into master Nov 16, 2020
@mdickinson mdickinson deleted the doc/reference-correct-Property branch November 16, 2020 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Advanced property documentation references traits.adaptation.api.Property
2 participants