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

Add empty __init__.pys where missing #2975

Merged
merged 2 commits into from
Nov 27, 2019
Merged

Conversation

wchargin
Copy link
Contributor

@wchargin wchargin commented Nov 27, 2019

Summary:
Bazel generates these automatically, but having them in the source tree
is convenient for REPLs and tools like pydoc.

Generated with:

find tensorboard -type f -name '*.py' |
    xargs -n 1 -d '\n' dirname |
    sort -u |
    xargs -n 1 -d '\n' sh -c 'cp -n tensorboard/util/__init__.py "$1/"' cmd

Test Plan:
Running pydoc tensorboard.data.provider after this commit successfully
shows useful docs; before this commit, it fails with, “no Python
documentation found for 'tensorboard.data.provider'”.

wchargin-branch: empty-init-py

Summary:
Bazel generates these automatically, but having them in the source tree
is convenient for REPLs and tools like `pydoc`.

Generated with:

```
find tensorboard -type f -name '*.py' |
    xargs -n 1 -d '\n' dirname |
    sort -u |
    xargs -n 1 -d '\n' sh -c '>>"$1/__init__.py"' unused
```

Test Plan:
Running `pydoc tensorboard.data.provider` after this commit successfully
shows useful docs; before this commit, it fails with, “no Python
documentation found for 'tensorboard.data.provider'”.

wchargin-branch: empty-init-py
wchargin-branch: empty-init-py
wchargin-source: 0ceb4dabdc54e6bacf9e956ffaf2053a93f727ec
Copy link
Contributor

@stephanwlee stephanwlee left a comment

Choose a reason for hiding this comment

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

All those licenses on empty init's :)

@wchargin wchargin removed the request for review from davidsoergel November 27, 2019 04:25
@wchargin wchargin merged commit 21ea968 into master Nov 27, 2019
@wchargin wchargin deleted the wchargin-empty-init-py branch November 27, 2019 04:25
@wchargin
Copy link
Contributor Author

Yeah… At least I think they don’t make it into the final Pip package,
because we never depend on the __init__.pys at the BUILD level. So
we’re not shipping kilobytes of redundant licenses to end users, just
ourselves. :-)

@nfelt
Copy link
Contributor

nfelt commented Dec 3, 2019

FWIW Bazel's behavior of auto-creating the __init__.py is in theory going to be deprecated and removed eventually: bazelbuild/bazel#7386

@wchargin
Copy link
Contributor Author

wchargin commented Dec 3, 2019

Good to know; thanks. Perhaps as that time draws near we can write a
test that in the extracted //tensorboard/pip_package, every directory
with a *.py file also has an __init__.py file.

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.

4 participants