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

Fix pydoc rendering for annotated classes #22121

Merged
merged 1 commit into from
Jul 13, 2022

Conversation

Abacn
Copy link
Contributor

@Abacn Abacn commented Jul 1, 2022

Fixes #21555

  • Do not assemble target class into a func which messes up doc generating

Please add a meaningful description for your change here


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

* Do not assemble target class into a func which messes up doc generating
@codecov
Copy link

codecov bot commented Jul 1, 2022

Codecov Report

Merging #22121 (675c60b) into master (d6b6253) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #22121      +/-   ##
==========================================
+ Coverage   74.19%   74.25%   +0.06%     
==========================================
  Files         701      701              
  Lines       92687    92889     +202     
==========================================
+ Hits        68767    68974     +207     
+ Misses      22654    22649       -5     
  Partials     1266     1266              
Flag Coverage Δ
python 83.63% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sdks/python/apache_beam/io/fileio.py 96.26% <100.00%> (+0.03%) ⬆️
sdks/python/apache_beam/utils/annotations.py 100.00% <100.00%> (ø)
...dks/python/apache_beam/options/pipeline_options.py 94.96% <0.00%> (+0.01%) ⬆️
...hon/apache_beam/runners/worker/bundle_processor.py 93.42% <0.00%> (+0.12%) ⬆️
...eam/runners/interactive/interactive_environment.py 92.02% <0.00%> (+0.30%) ⬆️
.../python/apache_beam/typehints/trivial_inference.py 96.88% <0.00%> (+0.46%) ⬆️
sdks/python/apache_beam/typehints/schemas.py 95.56% <0.00%> (+1.01%) ⬆️
...che_beam/runners/interactive/interactive_runner.py 91.39% <0.00%> (+1.32%) ⬆️
sdks/python/apache_beam/utils/interactive_utils.py 97.56% <0.00%> (+2.43%) ⬆️
...thon/apache_beam/runners/worker/sdk_worker_main.py 78.36% <0.00%> (+2.54%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6b6253...675c60b. Read the comment docs.

@Abacn
Copy link
Contributor Author

Abacn commented Jul 1, 2022

Refactored in a way similar to pypi's deprecated package. This resolves missing constructor documentation in pydoc, for example, in mangodbio, in GroupIntoBatches.

(Precommit fails on known flake Gradle build daemon disappeared unexpectedly. will rerun in revision.)

R: @johnjcasey

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2022

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

@Abacn Abacn marked this pull request as ready for review July 1, 2022 15:00
@Abacn
Copy link
Contributor Author

Abacn commented Jul 6, 2022

Run Python PreCommit

@Abacn
Copy link
Contributor Author

Abacn commented Jul 6, 2022

The failed test is apache_beam.runners.portability.portable_runner_test.PortableRunnerTestWithSubprocessesAndMultiWorkers.test_batch_pardo_trigger_flush, due to grpc DEADLINE_EXCEEDED which is similar to #22115 and not relevant to this change.

Copy link
Contributor

@johnjcasey johnjcasey left a comment

Choose a reason for hiding this comment

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

LGTM

@Abacn
Copy link
Contributor Author

Abacn commented Jul 13, 2022

R: @tvalentyn

@tvalentyn
Copy link
Contributor

Thanks!

Out of scope, but it may be possible to also alter docstring (__doc__) when decorators are used, so that it is reflected in autogenerated sphinx docs, I think TF is doing this here: https://github.com/tensorflow/tensorflow/blob/e4dbcc5732be1914b5dad205c2b1eabc040aafc4/tensorflow/python/util/deprecation.py#L372

@tvalentyn tvalentyn merged commit 9574973 into apache:master Jul 13, 2022
@Abacn Abacn deleted the fixannotationdoc branch July 13, 2022 23:19
@Abacn
Copy link
Contributor Author

Abacn commented Jul 13, 2022

Thanks!

Out of scope, but it may be possible to also alter docstring (__doc__) when decorators are used, so that it is reflected in autogenerated sphinx docs, I think TF is doing this here: https://github.com/tensorflow/tensorflow/blob/e4dbcc5732be1914b5dad205c2b1eabc040aafc4/tensorflow/python/util/deprecation.py#L372

Thanks. Sounds good. Filed #22265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incomplete documentation rendering for classes decorated by deprecated or experimental
3 participants