-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make contents of
__init__.py
equal across projects (#304)
--------- Signed-off-by: Pieter Noordhuis <pieter.noordhuis@databricks.com> Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com> Co-authored-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
- Loading branch information
Showing
2 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages | ||
# This file should only contain the following line. Otherwise other sub-packages databricks.* namespace | ||
# may not be importable. | ||
# See: https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages | ||
# | ||
# This file must only contain the following line, or other packages in the databricks.* namespace | ||
# may not be importable. The contents of this file must be byte-for-byte equivalent across all packages. | ||
# If they are not, parallel package installation may lead to clobbered and invalid files. | ||
# Also see https://github.com/databricks/databricks-sdk-py/issues/343. | ||
__path__ = __import__("pkgutil").extend_path(__path__, __name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import hashlib | ||
|
||
|
||
class TestInitFile: | ||
""" | ||
Micro test to confirm the contents of `databricks/__init__.py` does not change. | ||
Also see https://github.com/databricks/databricks-sdk-py/issues/343#issuecomment-1866029118. | ||
""" | ||
|
||
def test_init_file_contents(self): | ||
with open("src/databricks/__init__.py") as f: | ||
init_file_contents = f.read() | ||
|
||
# This hash is the expected hash of the contents of `src/databricks/__init__.py`. | ||
# It must not change, or else parallel package installation may lead to clobbered and invalid files. | ||
expected_sha1 = "2772edbf52e517542acf8c039479c4b57b6ca2cd" | ||
actual_sha1 = hashlib.sha1(init_file_contents.encode("utf-8")).hexdigest() | ||
assert expected_sha1 == actual_sha1 |