mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-26 01:18:20 +00:00
chore(sdk): rename _schema_classes to mark it as internal-only (#13309)
This commit is contained in:
parent
3c9da5a0e9
commit
f6764ee17a
@ -842,9 +842,9 @@ def generate(
|
||||
)
|
||||
|
||||
if enable_custom_loader:
|
||||
# Move schema_classes.py -> _schema_classes.py
|
||||
# Move schema_classes.py -> _internal_schema_classes.py
|
||||
# and add a custom loader.
|
||||
(Path(outdir) / "_schema_classes.py").write_text(
|
||||
(Path(outdir) / "_internal_schema_classes.py").write_text(
|
||||
(Path(outdir) / "schema_classes.py").read_text()
|
||||
)
|
||||
(Path(outdir) / "schema_classes.py").write_text(
|
||||
@ -861,16 +861,16 @@ from datahub.utilities._custom_package_loader import get_custom_models_package
|
||||
_custom_package_path = get_custom_models_package()
|
||||
|
||||
if TYPE_CHECKING or not _custom_package_path:
|
||||
from ._schema_classes import *
|
||||
from ._internal_schema_classes import *
|
||||
|
||||
# Required explicitly because __all__ doesn't include _ prefixed names.
|
||||
from ._schema_classes import __SCHEMA_TYPES
|
||||
from ._internal_schema_classes import __SCHEMA_TYPES
|
||||
|
||||
if IS_SPHINX_BUILD:
|
||||
# Set __module__ to the current module so that Sphinx will document the
|
||||
# classes as belonging to this module instead of the custom package.
|
||||
for _cls in list(globals().values()):
|
||||
if hasattr(_cls, "__module__") and "datahub.metadata._schema_classes" in _cls.__module__:
|
||||
if hasattr(_cls, "__module__") and "datahub.metadata._internal_schema_classes" in _cls.__module__:
|
||||
_cls.__module__ = __name__
|
||||
else:
|
||||
_custom_package = importlib.import_module(_custom_package_path)
|
||||
|
||||
@ -9,7 +9,7 @@ def ensure_no_indirect_model_imports(dirs: List[pathlib.Path]) -> None:
|
||||
# If our needs become more complex, we should move to a proper linter.
|
||||
denied_imports = {
|
||||
"src.": "datahub.*",
|
||||
"datahub.metadata._schema_classes": "datahub.metadata.schema_classes",
|
||||
"datahub.metadata._internal_schema_classes": "datahub.metadata.schema_classes",
|
||||
"datahub.metadata._urns": "datahub.metadata.urns",
|
||||
}
|
||||
ignored_files = {
|
||||
|
||||
@ -7,11 +7,11 @@ import datahub.metadata.schema_classes as models
|
||||
from datahub.emitter.mce_builder import make_dashboard_urn
|
||||
from datahub.emitter.mcp import MetadataChangeProposalWrapper
|
||||
from datahub.emitter.serialization_helper import pre_json_transform
|
||||
from datahub.metadata._schema_classes import MetadataChangeProposalClass
|
||||
from datahub.metadata.schema_classes import (
|
||||
AuditStampClass,
|
||||
ChangeAuditStampsClass,
|
||||
DashboardInfoClass,
|
||||
MetadataChangeProposalClass,
|
||||
)
|
||||
from datahub.metadata.urns import MlModelUrn
|
||||
from tests.consistency_utils import wait_for_writes_to_sync
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user