From 456b74405f74ea218d8ab4b5d90635bd7ca17485 Mon Sep 17 00:00:00 2001 From: Kori Kuzma Date: Wed, 10 Jul 2024 09:42:40 -0400 Subject: [PATCH] refactor: remove _internal directories close #407 * Remove _internal directories and move files up a directory --- src/ga4gh/core/__init__.py | 35 +++++++++++++++---- src/ga4gh/core/_internal/__init__.py | 0 src/ga4gh/core/{_internal => }/digests.py | 0 src/ga4gh/core/{_internal => }/enderef.py | 0 src/ga4gh/core/{_internal => }/identifiers.py | 0 src/ga4gh/core/{_internal => }/models.py | 0 src/ga4gh/core/{_internal => }/pydantic.py | 0 src/ga4gh/vrs/__init__.py | 11 ++++-- src/ga4gh/vrs/{_internal => }/enderef.py | 0 src/ga4gh/vrs/{_internal => }/models.py | 4 +-- src/ga4gh/vrs/normalize.py | 2 +- 11 files changed, 40 insertions(+), 12 deletions(-) delete mode 100644 src/ga4gh/core/_internal/__init__.py rename src/ga4gh/core/{_internal => }/digests.py (100%) rename src/ga4gh/core/{_internal => }/enderef.py (100%) rename src/ga4gh/core/{_internal => }/identifiers.py (100%) rename src/ga4gh/core/{_internal => }/models.py (100%) rename src/ga4gh/core/{_internal => }/pydantic.py (100%) rename src/ga4gh/vrs/{_internal => }/enderef.py (100%) rename src/ga4gh/vrs/{_internal => }/models.py (99%) diff --git a/src/ga4gh/core/__init__.py b/src/ga4gh/core/__init__.py index 77466e15..640b2411 100644 --- a/src/ga4gh/core/__init__.py +++ b/src/ga4gh/core/__init__.py @@ -2,20 +2,43 @@ """ -import warnings from importlib.metadata import version, PackageNotFoundError -from ._internal.digests import sha512t24u -from ._internal.enderef import ga4gh_enref, ga4gh_deref -from ._internal.identifiers import ( +from .digests import sha512t24u +from .enderef import ga4gh_enref, ga4gh_deref +from .identifiers import ( ga4gh_digest, ga4gh_identify, ga4gh_serialize, is_ga4gh_identifier, parse_ga4gh_identifier, VrsObjectIdentifierIs, use_ga4gh_compute_identifier_when, CURIE_NAMESPACE, CURIE_SEP, GA4GH_PREFIX_SEP, GA4GH_IR_REGEXP, GA4GH_DIGEST_REGEXP ) -from ._internal.pydantic import ( +from .pydantic import ( is_pydantic_instance, is_curie_type, is_ga4gh_identifiable, is_literal, pydantic_copy ) -from ._internal import models as common_models +from . import models as common_models + +__all__ = [ + "sha512t24u", + "ga4gh_enref", + "ga4gh_deref", + "ga4gh_digest", + "ga4gh_identify", + "ga4gh_serialize", + "is_ga4gh_identifier", + "parse_ga4gh_identifier", + "VrsObjectIdentifierIs", + "use_ga4gh_compute_identifier_when", + "CURIE_NAMESPACE", + "CURIE_SEP", + "GA4GH_PREFIX_SEP", + "GA4GH_IR_REGEXP", + "GA4GH_DIGEST_REGEXP", + "is_pydantic_instance", + "is_curie_type", + "is_ga4gh_identifiable", + "is_literal", + "pydantic_copy", + "common_models" +] try: __version__ = version(__name__) diff --git a/src/ga4gh/core/_internal/__init__.py b/src/ga4gh/core/_internal/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/ga4gh/core/_internal/digests.py b/src/ga4gh/core/digests.py similarity index 100% rename from src/ga4gh/core/_internal/digests.py rename to src/ga4gh/core/digests.py diff --git a/src/ga4gh/core/_internal/enderef.py b/src/ga4gh/core/enderef.py similarity index 100% rename from src/ga4gh/core/_internal/enderef.py rename to src/ga4gh/core/enderef.py diff --git a/src/ga4gh/core/_internal/identifiers.py b/src/ga4gh/core/identifiers.py similarity index 100% rename from src/ga4gh/core/_internal/identifiers.py rename to src/ga4gh/core/identifiers.py diff --git a/src/ga4gh/core/_internal/models.py b/src/ga4gh/core/models.py similarity index 100% rename from src/ga4gh/core/_internal/models.py rename to src/ga4gh/core/models.py diff --git a/src/ga4gh/core/_internal/pydantic.py b/src/ga4gh/core/pydantic.py similarity index 100% rename from src/ga4gh/core/_internal/pydantic.py rename to src/ga4gh/core/pydantic.py diff --git a/src/ga4gh/vrs/__init__.py b/src/ga4gh/vrs/__init__.py index fdd445d7..adbec052 100644 --- a/src/ga4gh/vrs/__init__.py +++ b/src/ga4gh/vrs/__init__.py @@ -5,10 +5,15 @@ from importlib.metadata import version, PackageNotFoundError from .normalize import normalize -from ._internal.enderef import vrs_deref, vrs_enref -from ._internal import models +from .enderef import vrs_deref, vrs_enref +from . import models -__all__ = """models normalize schema_path vrs_deref vrs_enref""".split() +__all__ = [ + "normalize", + "vrs_deref", + "vrs_enref", + "models" +] try: __version__ = version(__name__) diff --git a/src/ga4gh/vrs/_internal/enderef.py b/src/ga4gh/vrs/enderef.py similarity index 100% rename from src/ga4gh/vrs/_internal/enderef.py rename to src/ga4gh/vrs/enderef.py diff --git a/src/ga4gh/vrs/_internal/models.py b/src/ga4gh/vrs/models.py similarity index 99% rename from src/ga4gh/vrs/_internal/models.py rename to src/ga4gh/vrs/models.py index 44ca885b..e0f304da 100644 --- a/src/ga4gh/vrs/_internal/models.py +++ b/src/ga4gh/vrs/models.py @@ -19,11 +19,11 @@ from pydantic import BaseModel, Field, RootModel, StringConstraints, model_serializer -from ga4gh.core._internal.pydantic import ( +from ga4gh.core.pydantic import ( is_ga4gh_identifiable, getattr_in ) -from ga4gh.core._internal.models import IRI, Expression, _DomainEntity +from ga4gh.core.models import IRI, Expression, _DomainEntity def flatten(vals): diff --git a/src/ga4gh/vrs/normalize.py b/src/ga4gh/vrs/normalize.py index 33dc70a5..41389937 100644 --- a/src/ga4gh/vrs/normalize.py +++ b/src/ga4gh/vrs/normalize.py @@ -11,7 +11,7 @@ from bioutils.normalize import normalize as _normalize, NormalizationMode from ga4gh.core import is_pydantic_instance, ga4gh_digest, pydantic_copy -from ._internal import models +from . import models from .dataproxy import SequenceProxy