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

respect #|hide and #|include: false for showdoc #1079

Merged
merged 2 commits into from
Sep 16, 2022
Merged

Conversation

hamelsmu
Copy link
Member

@hamelsmu hamelsmu commented Sep 16, 2022

closes #1076

I tested this extensively with both #|hide and #|include: false to make sure the code is still exported but the show doc is not called

#|include: false is the same thing as #|hide

@jph00 @seeM

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@hamelsmu hamelsmu changed the title respect hide in showdoc respect #|hide for showdoc Sep 16, 2022
@hamelsmu hamelsmu added the bug Something isn't working label Sep 16, 2022
@hamelsmu hamelsmu requested a review from jph00 September 16, 2022 15:24
@hamelsmu hamelsmu changed the title respect #|hide for showdoc respect #|hide and #|include: false for showdoc Sep 16, 2022
@@ -59,8 +59,10 @@ def _show_docs(trees):
return [t for t in trees if isinstance(t,ast.Expr) and nested_attr(t, 'value.func.id')=='show_doc']

def cell_lang(cell): return nested_attr(cell, 'metadata.language', 'python')

def _want_hide(c): return 'hide' in c.directives_ or c.directives_.get('include:') == ['false']
Copy link
Member Author

Choose a reason for hiding this comment

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

I found it odd that the colon is included in the key include: vs include. Looking at the code this seems deliberate and is even in the tests for processor.extract_directives.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why it wouldn't include the :? That's the thing that let's you know it's a key:value thing.

BTW why did you abstract out _want_hide here? Seems like you could easily inline it since you're only using it in one place?

Copy link
Member Author

Choose a reason for hiding this comment

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

Would you mind taking a look at the new way I just pushed? Just want to check if that is more in line with what you would do

Copy link
Member

@jph00 jph00 left a comment

Choose a reason for hiding this comment

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

Feel free to merge when ready - just one question inline

@hamelsmu hamelsmu requested a review from jph00 September 16, 2022 22:19
@hamelsmu hamelsmu merged commit 5440471 into master Sep 16, 2022
@hamelsmu hamelsmu deleted the hide-showdoc branch September 16, 2022 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export class to library but hide from documentation
2 participants