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

[BEAM-2241] Renames some python classes and functions that were unnecessarily public #3036

Closed
wants to merge 3 commits into from

Conversation

chamikaramj
Copy link
Contributor

Adds a note to documentation of classes that are public but should be only used internally by the SDK (non-user facing classes).

Marks some of the modules as experimental.

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

  • Make sure the PR title is formatted like:
    [BEAM-<Jira issue #>] Description of pull request
  • Make sure tests pass via mvn clean verify.
  • Replace <Jira issue #> in the title with the actual Jira issue
    number, if there is one.
  • If this contribution is large, please file an Apache
    Individual Contributor License Agreement.

@chamikaramj
Copy link
Contributor Author

R: @aaltay

Copy link
Member

@aaltay aaltay left a comment

Choose a reason for hiding this comment

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

Thank you @chamikaramj. This is great.

Given the size and pending release, adding another reviewer might be useful.

@@ -72,7 +72,9 @@ def MakeXyzs(v):


class CoderRegistry(object):
"""A coder registry for typehint/coder associations."""
"""For internal use only; no backwards-compatibility guarantees.
Copy link
Member

Choose a reason for hiding this comment

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

register_coder coder is public, this class is not internal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted this update.

@@ -58,7 +60,9 @@ class AuthenticationException(retry.PermanentException):


class GCEMetadataCredentials(OAuth2Credentials):
Copy link
Member

Choose a reason for hiding this comment

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

This could be just renamed to _ GCEMetadataCredentials all users of it should be in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -31,7 +31,9 @@


class CellCommitState(object):
Copy link
Member

Choose a reason for hiding this comment

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

It does not look like there is much public interfaces in this file. Should we add __all__?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an empty all so that methods here will not be imported by an import *.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like lint was crashing due to this change (empty all tag) for some reason. So had to revert this.

@@ -36,7 +36,9 @@


class MetricKey(object):
"""Key used to identify instance of metric cell.
"""For internal use only; no backwards-compatibility guarantees.
Copy link
Member

Choose a reason for hiding this comment

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

Should we just update the comment at the top of the file that says Internal classes for Metrics API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Top level comment should be enough. Updated.

@@ -72,7 +77,9 @@ def __init__(self, do_fn, method_name):


class DoFnSignature(object):
"""Represents the signature of a given ``DoFn`` object.
"""For internal use only; no backwards-compatibility guarantees.
Copy link
Member

Choose a reason for hiding this comment

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

Would not these be useful for an implementer of a new runner?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the comment from DoFnSignature, DoFnInvoker, and implementations of DoFnInvoker.

@@ -533,6 +550,7 @@ def counter_for(self, aggregator):

# TODO(robertwb): Replace core.DoFnContext with this.
Copy link
Member

Choose a reason for hiding this comment

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

@sb2nov - Unrelated to PR. Is this another opportunity for removing backward compatibility code?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, I'll look into it.

@@ -15,7 +15,9 @@
# limitations under the License.
#

"""Dataflow client utility functions."""
""" For internal use only. No backwards compatibility guarantees.
Copy link
Member

Choose a reason for hiding this comment

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

Is it enough to just add this comment here and not add the same comment to individual classes in this file?

For example iobase.py only comment is added to the top.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed from classes. Top level comment should be enough.

@chamikaramj
Copy link
Contributor Author

R: @sb2nov

@@ -97,7 +98,9 @@ def get_estimated_size_and_observables(self, value, nested=False):


class SimpleCoderImpl(CoderImpl):
"""Subclass of CoderImpl implementing stream methods using encode/decode."""
"""For internal use only; no backwards-compatibility guarantees.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wanted to check if the DocString still renders correctly as I thought the first line acted as a summary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the thinking was that if the class should not be used by users, it might be good to have this as a summary. Also, I generated a doc using pydoc and this doesn't seem to be being rendered in a special way at least for that tool.

…lic.

Adds a note to documentation of classes that are public but should be only used internally by the SDK (non-user facing classes).

Marks some of the modules as experimental.
Copy link
Contributor Author

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

Thanks. PTAL.

@@ -72,7 +72,9 @@ def MakeXyzs(v):


class CoderRegistry(object):
"""A coder registry for typehint/coder associations."""
"""For internal use only; no backwards-compatibility guarantees.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted this update.

@@ -58,7 +60,9 @@ class AuthenticationException(retry.PermanentException):


class GCEMetadataCredentials(OAuth2Credentials):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -31,7 +31,9 @@


class CellCommitState(object):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an empty all so that methods here will not be imported by an import *.

@@ -36,7 +36,9 @@


class MetricKey(object):
"""Key used to identify instance of metric cell.
"""For internal use only; no backwards-compatibility guarantees.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Top level comment should be enough. Updated.

@@ -72,7 +77,9 @@ def __init__(self, do_fn, method_name):


class DoFnSignature(object):
"""Represents the signature of a given ``DoFn`` object.
"""For internal use only; no backwards-compatibility guarantees.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the comment from DoFnSignature, DoFnInvoker, and implementations of DoFnInvoker.

@@ -15,7 +15,9 @@
# limitations under the License.
#

"""Dataflow client utility functions."""
""" For internal use only. No backwards compatibility guarantees.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed from classes. Top level comment should be enough.

@@ -97,7 +98,9 @@ def get_estimated_size_and_observables(self, value, nested=False):


class SimpleCoderImpl(CoderImpl):
"""Subclass of CoderImpl implementing stream methods using encode/decode."""
"""For internal use only; no backwards-compatibility guarantees.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the thinking was that if the class should not be used by users, it might be good to have this as a summary. Also, I generated a doc using pydoc and this doesn't seem to be being rendered in a special way at least for that tool.

@aaltay
Copy link
Member

aaltay commented May 10, 2017

LGTM (assuming the tests will pass).

@sb2nov
Copy link
Contributor

sb2nov commented May 10, 2017

LGTM

@asfgit asfgit closed this in 1fafaa8 May 10, 2017
asfgit pushed a commit that referenced this pull request May 10, 2017
… unnecessarily public.

Adds a note to documentation of classes that are public but should be only used internally by the SDK (non-user facing classes).

Marks some of the modules as experimental.
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.

None yet

3 participants