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

[Task]: Standardize typehint in Python documention and docstrings #23984

Closed
wants to merge 4 commits into from

Conversation

ayushthe1
Copy link
Contributor

@ayushthe1 ayushthe1 commented Nov 4, 2022

fixes #23950

Currently 3 different formats (type-hints , type hints, type hints ) are used to represent "typehints" across the documentation and docstrings.
This creates confusion ,so this pr aims to standardize all occurences across documentation and docstrings by choosing typehints as the default format and replacing all the other formats with this.


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
Go tests

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

@Abacn
Copy link
Contributor

Abacn commented Nov 4, 2022

Thanks for the fix. There is a test failure about assertion to error message:

self = <apache_beam.typehints.typehints_test.KVHintTestCase testMethod=test_getitem_param_must_be_tuple>

    def test_getitem_param_must_be_tuple(self):
      with self.assertRaises(TypeError) as e:
        typehints.KV[4]
    
>     self.assertEqual(
          'Parameter to KV type-hint must be a tuple of types: '
          'KV[.., ..].',
          e.exception.args[0])
E     AssertionError: 'Parameter to KV type-hint must be a tuple of types: KV[.., ..].' != 'Parameter to KV typehint must be a tuple of types: KV[.., ..].'
E     - Parameter to KV type-hint must be a tuple of types: KV[.., ..].
E     ?                     -
E     + Parameter to KV typehint must be a tuple of types: KV[.., ..].

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2022

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @pabloem for label python.
R: @apilloud for label java.
R: @ahmedabu98 for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2022

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @pabloem for label python.
R: @apilloud for label java.
R: @ahmedabu98 for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@apilloud apilloud removed the java label Nov 4, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2022

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @pabloem for label python.
R: @ahmedabu98 for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@github-actions github-actions bot added the java label Nov 4, 2022
@codecov
Copy link

codecov bot commented Nov 4, 2022

Codecov Report

Merging #23984 (be6b86e) into master (1685251) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #23984      +/-   ##
==========================================
+ Coverage   73.45%   73.47%   +0.02%     
==========================================
  Files         709      709              
  Lines       95971    96048      +77     
==========================================
+ Hits        70491    70575      +84     
+ Misses      24163    24156       -7     
  Partials     1317     1317              
Flag Coverage Δ
python 83.21% <100.00%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
sdks/python/apache_beam/coders/coder_impl.py 93.77% <ø> (ø)
...ks/python/apache_beam/coders/coders_test_common.py 98.58% <ø> (ø)
sdks/python/apache_beam/coders/row_coder.py 94.95% <ø> (ø)
sdks/python/apache_beam/coders/typecoders.py 93.67% <ø> (ø)
.../apache_beam/examples/cookbook/group_with_coder.py 51.16% <ø> (ø)
sdks/python/apache_beam/pipeline.py 92.25% <ø> (ø)
...on/apache_beam/runners/dataflow/dataflow_runner.py 82.89% <ø> (ø)
...ache_beam/runners/dataflow/ptransform_overrides.py 90.90% <ø> (ø)
...python/apache_beam/runners/direct/direct_runner.py 93.92% <ø> (ø)
...ks/python/apache_beam/runners/interactive/utils.py 95.08% <ø> (ø)
... and 16 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@apilloud apilloud removed the java label Nov 4, 2022
@ayushthe1
Copy link
Contributor Author

R: @TheNeuralBit

@ayushthe1
Copy link
Contributor Author

thanks @Abacn ,i fixed it.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2022

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @AnandInguva for label python.
R: @ahmedabu98 for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@TheNeuralBit
Copy link
Member

I think we may want to standardize on "type hint" in documentation and "typehint" for code. For reference: PEP 484 uses "type hint".

@TheNeuralBit
Copy link
Member

I'm going to propose we switch to "type hints" in documentation. I'll raise on dev@ to see if there are any objections. Can we hold on this for a couple of days?

@ayushthe1
Copy link
Contributor Author

Sure @TheNeuralBit ,

I'm going to propose we switch to "type hints" in documentation. I'll raise on dev@ to see if there are any objections. Can we hold on this for a couple of days?

Sure @TheNeuralBit ,i will make the changes once you confirm them. 👍

@TheNeuralBit
Copy link
Member

Thanks! How about if we don't hear any objection by Wednesday (9 November) we go ahead with switching to "type hints"

@github-actions
Copy link
Contributor

Reminder, please take a look at this pr: @AnandInguva @ahmedabu98

@AnandInguva
Copy link
Contributor

Hi, I think based on the discussion the Beam dev list(https://lists.apache.org/[email protected]:lte=1M:typehint)

type hints should be the standardized format. Can you change this to type hints wherever its possible?

Thanks for the changes.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @tvalentyn for label python.
R: @chamikaramj for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

@tvalentyn
Copy link
Contributor

waiting on author

@ayushthe1
Copy link
Contributor Author

@TheNeuralBit , any update on this ?

@AnandInguva
Copy link
Contributor

@TheNeuralBit , any update on this ?

Please look at #23984 (comment)

@ayushthe1
Copy link
Contributor Author

@TheNeuralBit , any update on this ?

Please look at #23984 (comment)

Thanks ,i will do it.

@github-actions
Copy link
Contributor

Reminder, please take a look at this pr: @tvalentyn @chamikaramj

@tvalentyn
Copy link
Contributor

waiting on author

@github-actions
Copy link
Contributor

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @pabloem for label python.
R: @johnjcasey for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

@tvalentyn
Copy link
Contributor

waiting on author

@AnandInguva
Copy link
Contributor

@ayushthe1 friendly ping:). Any update on this?

@github-actions
Copy link
Contributor

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions bot added stale and removed stale labels Feb 21, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2023

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 7, 2023
@github-actions
Copy link
Contributor

This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions bot closed this Jun 15, 2023
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.

[Task]: Normalize typehint vs. type-hint vs. type hint in Python documentation and docstrings
6 participants