diff --git a/doc/changes/DM-41043.misc.md b/doc/changes/DM-41043.misc.md
new file mode 100644
index 0000000000..c9abc8d0d8
--- /dev/null
+++ b/doc/changes/DM-41043.misc.md
@@ -0,0 +1,5 @@
+Reorganize internal subpackages, rename modules, and adjust symbol lifting.
+
+This includes moving some symbols that we had always intended to be private (or
+public only to other middleware packages) that were not clearly marked as such
+(e.g. with leading underscores) before.
diff --git a/doc/lsst.daf.butler/index.rst b/doc/lsst.daf.butler/index.rst
index 7b566a3d91..24c84ad09b 100644
--- a/doc/lsst.daf.butler/index.rst
+++ b/doc/lsst.daf.butler/index.rst
@@ -101,18 +101,8 @@ Python API reference
.. automodapi:: lsst.daf.butler
:no-main-docstr:
-
-.. automodapi:: lsst.daf.butler.registry
- :no-main-docstr:
-
-.. automodapi:: lsst.daf.butler.registry.interfaces
- :no-main-docstr:
-
-.. automodapi:: lsst.daf.butler.registry.queries
- :no-main-docstr:
-
-.. automodapi:: lsst.daf.butler.registry.wildcards
- :no-main-docstr:
+ :skip: CollectionSearch
+ :skip: RegistryConfig
Example datastores
------------------
@@ -149,57 +139,130 @@ Example formatters
:no-main-docstr:
:headings: ^"
+Test utilities
+--------------
+
+.. automodapi:: lsst.daf.butler.tests
+ :no-main-docstr:
+ :headings: ^"
+ :no-inheritance-diagram:
+
+Middleware-Internal API
+=======================
+
+.. warning::
+
+ These symbols are used throughout the middleware system and may be used in advanced middleware extensions (e.g. third-party `Datastore` implementations), but are not considered fully public interfaces in terms of stability guarantees.
+
+Datastore utilities
+-------------------
+
+.. automodapi:: lsst.daf.butler.datastore
+ :no-main-docstr:
+ :headings: ^"
+ :skip: Datastore
+
+Registry utilities and interfaces
+---------------------------------
+
+.. automodapi:: lsst.daf.butler.registry
+ :no-main-docstr:
+ :headings: ^"
+ :skip: Registry
+ :skip: CollectionType
+
+.. automodapi:: lsst.daf.butler.registry.interfaces
+ :headings: ^"
+ :no-main-docstr:
+
+.. automodapi:: lsst.daf.butler.registry.queries
+ :headings: ^"
+ :no-main-docstr:
+
+.. automodapi:: lsst.daf.butler.registry.wildcards
+ :headings: ^"
+ :no-main-docstr:
+
Database backends
-----------------
.. automodapi:: lsst.daf.butler.registry.databases.sqlite
:no-main-docstr:
:headings: ^"
+
.. automodapi:: lsst.daf.butler.registry.databases.postgresql
:no-main-docstr:
:headings: ^"
-Support API
------------
+General utilities
+-----------------
-.. automodapi:: lsst.daf.butler.core.utils
+.. automodapi:: lsst.daf.butler.ddl
:no-main-docstr:
:headings: ^"
-.. automodapi:: lsst.daf.butler.core.repoRelocation
+
+.. automodapi:: lsst.daf.butler.instrument
:no-main-docstr:
:headings: ^"
- :include-all-objects:
-Test utilities
---------------
+.. automodapi:: lsst.daf.butler.json
+ :no-main-docstr:
+ :headings: ^"
-.. automodapi:: lsst.daf.butler.tests
+.. automodapi:: lsst.daf.butler.logging
:no-main-docstr:
- :no-inheritance-diagram:
+ :headings: ^"
-Command Line Interface API
---------------------------
+.. automodapi:: lsst.daf.butler.mapping_factory
+ :no-main-docstr:
+ :headings: ^"
-.. warning::
- The command line interface API (everything in ``lsst.daf.butler.cli``) is for only for developer use to write command line interfaces, and is not intended for general use.
+.. automodapi:: lsst.daf.butler.persistence_context
+ :no-main-docstr:
+ :headings: ^"
-.. automodapi:: lsst.daf.butler.cli.butler
+.. automodapi:: lsst.daf.butler.progress
:no-main-docstr:
+ :headings: ^"
+
+.. automodapi:: lsst.daf.butler.repo_relocation
+ :no-main-docstr:
+ :headings: ^"
+ :include-all-objects:
+
+.. automodapi:: lsst.daf.butler.time_utils
+ :no-main-docstr:
+ :headings: ^"
+
+.. automodapi:: lsst.daf.butler.utils
+ :no-main-docstr:
+ :headings: ^"
+
+Command-Line Interface Utilities
+--------------------------------
+.. automodapi:: lsst.daf.butler.cli.butler
+ :no-main-docstr:
+ :headings: ^"
.. automodapi:: lsst.daf.butler.cli.cmd
:no-main-docstr:
:include-all-objects:
+ :headings: ^"
.. automodapi:: lsst.daf.butler.cli.opt
:no-main-docstr:
:include-all-objects:
+ :headings: ^"
.. automodapi:: lsst.daf.butler.cli.utils
:no-main-docstr:
+ :headings: ^"
.. automodapi:: lsst.daf.butler.cli.cliLog
:no-main-docstr:
+ :headings: ^"
.. automodapi:: lsst.daf.butler.cli.progress
:no-main-docstr:
+ :headings: ^"
diff --git a/python/lsst/daf/butler/__init__.py b/python/lsst/daf/butler/__init__.py
index d14c9f9d45..c346ca7b87 100644
--- a/python/lsst/daf/butler/__init__.py
+++ b/python/lsst/daf/butler/__init__.py
@@ -1,3 +1,30 @@
+# This file is part of daf_butler.
+#
+# Developed for the LSST Data Management System.
+# This product includes software developed by the LSST Project
+# (http://www.lsst.org).
+# See the COPYRIGHT file at the top-level directory of this distribution
+# for details of code ownership.
+#
+# This software is dual licensed under the GNU General Public License and also
+# under a 3-clause BSD license. Recipients may choose which of these licenses
+# to use; please see the files gpl-3.0.txt and/or bsd_license.txt,
+# respectively. If you choose the GPL option then the following text applies
+# (but note that there is still no warranty even if you opt for BSD instead):
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
"""
Data Access Butler
"""
@@ -5,16 +32,57 @@
# Some components are not auto-imported since they can have additional runtime
# dependencies.
+from . import logging # most symbols are helpers only
+from . import progress # most symbols are only used by handler implementors
+from . import ddl, time_utils
from ._butler import *
-from ._butlerConfig import *
-from ._butlerRepoIndex import *
+from ._butler_config import *
+from ._butler_repo_index import *
+from ._column_categorization import *
+from ._column_tags import *
+from ._column_type_info import *
+from ._config import *
+from ._config_support import LookupKey
+from ._dataset_association import *
from ._dataset_existence import *
+from ._dataset_ref import *
+from ._dataset_type import *
from ._deferredDatasetHandle import *
+from ._exceptions import *
+from ._file_dataset import *
+from ._file_descriptor import *
+from ._formatter import *
+
+# Do not import 'instrument' or 'json' at all by default.
from ._limited_butler import *
+from ._location import *
+from ._named import *
+from ._quantum import *
from ._quantum_backed import *
-from .core import *
+from ._storage_class import *
+from ._storage_class_delegate import *
+from ._timespan import *
+from ._topology import *
+
+# Only lift 'Datastore' itself to this scope.
+from .datastore import Datastore
+from .dimensions import *
+
+# Only export 'ButlerLogRecords' from 'logging', import the module as-is for
+# other symbols. ButlerLogRecords is the fundamental type stored in datastores.
+from .logging import ButlerLogRecords
+# Do not import or lift symbols from mapping_factory and persistence_content,
+# as those are internal.
+# Only lift 'Progress' from 'progess'; the module is imported as-is above
+from .progress import Progress
+
+# Do not import or lift symbols from 'server' or 'server_models'.
# Import the registry subpackage directly for other symbols.
from .registry import CollectionSearch, CollectionType, Registry, RegistryConfig
from .transfers import RepoExportContext, YamlRepoExportBackend, YamlRepoImportBackend
from .version import *
+
+# Do not import or lift symbols from 'repo_relocation'.
+
+# Do not export the utility routines from utils.
diff --git a/python/lsst/daf/butler/_butler.py b/python/lsst/daf/butler/_butler.py
index d1099604a8..a8110f6c15 100644
--- a/python/lsst/daf/butler/_butler.py
+++ b/python/lsst/daf/butler/_butler.py
@@ -52,38 +52,31 @@
from lsst.utils.logging import VERBOSE, getLogger
from sqlalchemy.exc import IntegrityError
-from ._butlerConfig import ButlerConfig
-from ._butlerRepoIndex import ButlerRepoIndex
+from ._butler_config import ButlerConfig
+from ._butler_repo_index import ButlerRepoIndex
+from ._config import Config, ConfigSubset
from ._dataset_existence import DatasetExistence
+from ._dataset_ref import DatasetIdGenEnum, DatasetRef
+from ._dataset_type import DatasetType
from ._deferredDatasetHandle import DeferredDatasetHandle
+from ._exceptions import ValidationError
+from ._file_dataset import FileDataset
from ._limited_butler import LimitedButler
from ._registry_shim import RegistryShim
-from .core import (
- Config,
- ConfigSubset,
+from ._storage_class import StorageClass, StorageClassFactory
+from ._timespan import Timespan
+from .datastore import DatasetRefURIs, Datastore, NullDatastore
+from .dimensions import (
DataCoordinate,
DataId,
DataIdValue,
- DatasetIdGenEnum,
- DatasetRef,
- DatasetRefURIs,
- DatasetType,
- Datastore,
Dimension,
DimensionConfig,
DimensionElement,
DimensionRecord,
DimensionUniverse,
- FileDataset,
- NullDatastore,
- Progress,
- StorageClass,
- StorageClassFactory,
- Timespan,
- ValidationError,
)
-from .core.repoRelocation import BUTLER_ROOT_TAG
-from .core.utils import transactional
+from .progress import Progress
from .registry import (
CollectionType,
ConflictingDefinitionError,
@@ -96,7 +89,9 @@
_ButlerRegistry,
_RegistryFactory,
)
+from .repo_relocation import BUTLER_ROOT_TAG
from .transfers import RepoExportContext
+from .utils import transactional
if TYPE_CHECKING:
from lsst.resources import ResourceHandleProtocol
diff --git a/python/lsst/daf/butler/_butlerConfig.py b/python/lsst/daf/butler/_butler_config.py
similarity index 98%
rename from python/lsst/daf/butler/_butlerConfig.py
rename to python/lsst/daf/butler/_butler_config.py
index a14779b120..989f37c853 100644
--- a/python/lsst/daf/butler/_butlerConfig.py
+++ b/python/lsst/daf/butler/_butler_config.py
@@ -38,8 +38,10 @@
from lsst.resources import ResourcePath, ResourcePathExpression
-from ._butlerRepoIndex import ButlerRepoIndex
-from .core import Config, DatastoreConfig, StorageClassConfig
+from ._butler_repo_index import ButlerRepoIndex
+from ._config import Config
+from ._storage_class import StorageClassConfig
+from .datastore import DatastoreConfig
from .registry import RegistryConfig
from .transfers import RepoTransferFormatConfig
diff --git a/python/lsst/daf/butler/_butlerRepoIndex.py b/python/lsst/daf/butler/_butler_repo_index.py
similarity index 99%
rename from python/lsst/daf/butler/_butlerRepoIndex.py
rename to python/lsst/daf/butler/_butler_repo_index.py
index 71a55d8e01..184e1f2e3d 100644
--- a/python/lsst/daf/butler/_butlerRepoIndex.py
+++ b/python/lsst/daf/butler/_butler_repo_index.py
@@ -34,7 +34,7 @@
from lsst.resources import ResourcePath
-from .core import Config
+from ._config import Config
class ButlerRepoIndex:
diff --git a/python/lsst/daf/butler/core/_column_categorization.py b/python/lsst/daf/butler/_column_categorization.py
similarity index 100%
rename from python/lsst/daf/butler/core/_column_categorization.py
rename to python/lsst/daf/butler/_column_categorization.py
diff --git a/python/lsst/daf/butler/core/_column_tags.py b/python/lsst/daf/butler/_column_tags.py
similarity index 100%
rename from python/lsst/daf/butler/core/_column_tags.py
rename to python/lsst/daf/butler/_column_tags.py
diff --git a/python/lsst/daf/butler/core/_column_type_info.py b/python/lsst/daf/butler/_column_type_info.py
similarity index 98%
rename from python/lsst/daf/butler/core/_column_type_info.py
rename to python/lsst/daf/butler/_column_type_info.py
index 411842f8c9..6a32e86e71 100644
--- a/python/lsst/daf/butler/core/_column_type_info.py
+++ b/python/lsst/daf/butler/_column_type_info.py
@@ -40,8 +40,8 @@
from . import ddl
from ._column_tags import DatasetColumnTag, DimensionKeyColumnTag, DimensionRecordColumnTag
+from ._timespan import TimespanDatabaseRepresentation
from .dimensions import Dimension, DimensionUniverse
-from .timespan import TimespanDatabaseRepresentation
LogicalColumn = sqlalchemy.sql.ColumnElement | TimespanDatabaseRepresentation
"""A type alias for the types used to represent columns in SQL relations.
@@ -77,7 +77,7 @@ class ColumnTypeInfo:
ingest_date_dtype: type[ddl.AstropyTimeNsecTai] | type[sqlalchemy.TIMESTAMP]
"""Type of the ``ingest_date`` column, can be either
- `~lsst.daf.butler.core.ddl.AstropyTimeNsecTai` or `sqlalchemy.TIMESTAMP`.
+ `~lsst.daf.butler.ddl.AstropyTimeNsecTai` or `sqlalchemy.TIMESTAMP`.
"""
@property
diff --git a/python/lsst/daf/butler/core/config.py b/python/lsst/daf/butler/_config.py
similarity index 100%
rename from python/lsst/daf/butler/core/config.py
rename to python/lsst/daf/butler/_config.py
diff --git a/python/lsst/daf/butler/core/configSupport.py b/python/lsst/daf/butler/_config_support.py
similarity index 99%
rename from python/lsst/daf/butler/core/configSupport.py
rename to python/lsst/daf/butler/_config_support.py
index 35621feb2b..fe01404a1f 100644
--- a/python/lsst/daf/butler/core/configSupport.py
+++ b/python/lsst/daf/butler/_config_support.py
@@ -39,7 +39,7 @@
from .dimensions import DimensionGraph
if TYPE_CHECKING:
- from .config import Config
+ from ._config import Config
from .dimensions import Dimension, DimensionUniverse
log = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/core/datasets/association.py b/python/lsst/daf/butler/_dataset_association.py
similarity index 95%
rename from python/lsst/daf/butler/core/datasets/association.py
rename to python/lsst/daf/butler/_dataset_association.py
index 3e7da88ec8..a836a50682 100644
--- a/python/lsst/daf/butler/core/datasets/association.py
+++ b/python/lsst/daf/butler/_dataset_association.py
@@ -27,11 +27,13 @@
from __future__ import annotations
+__all__ = ("DatasetAssociation",)
+
from dataclasses import dataclass
from typing import Any
-from ..timespan import Timespan
-from .ref import DatasetRef
+from ._dataset_ref import DatasetRef
+from ._timespan import Timespan
@dataclass(frozen=True, eq=True)
diff --git a/python/lsst/daf/butler/core/datasets/ref.py b/python/lsst/daf/butler/_dataset_ref.py
similarity index 98%
rename from python/lsst/daf/butler/core/datasets/ref.py
rename to python/lsst/daf/butler/_dataset_ref.py
index 899d5e54fa..32c75fa9c3 100644
--- a/python/lsst/daf/butler/core/datasets/ref.py
+++ b/python/lsst/daf/butler/_dataset_ref.py
@@ -46,16 +46,16 @@
from lsst.utils.classes import immutable
from pydantic import StrictStr
-from ..configSupport import LookupKey
-from ..dimensions import DataCoordinate, DimensionGraph, DimensionUniverse, SerializedDataCoordinate
-from ..json import from_json_pydantic, to_json_pydantic
-from ..named import NamedKeyDict
-from ..persistenceContext import PersistenceContextVars
-from .type import DatasetType, SerializedDatasetType
+from ._config_support import LookupKey
+from ._dataset_type import DatasetType, SerializedDatasetType
+from ._named import NamedKeyDict
+from .dimensions import DataCoordinate, DimensionGraph, DimensionUniverse, SerializedDataCoordinate
+from .json import from_json_pydantic, to_json_pydantic
+from .persistence_context import PersistenceContextVars
if TYPE_CHECKING:
- from ...registry import Registry
- from ..storageClass import StorageClass
+ from ._storage_class import StorageClass
+ from .registry import Registry
class AmbiguousDatasetError(Exception):
diff --git a/python/lsst/daf/butler/core/datasets/type.py b/python/lsst/daf/butler/_dataset_type.py
similarity index 98%
rename from python/lsst/daf/butler/core/datasets/type.py
rename to python/lsst/daf/butler/_dataset_type.py
index 8928542247..6b578036b3 100644
--- a/python/lsst/daf/butler/core/datasets/type.py
+++ b/python/lsst/daf/butler/_dataset_type.py
@@ -38,15 +38,15 @@
from lsst.daf.butler._compat import _BaseModelCompat
from pydantic import StrictBool, StrictStr
-from ..configSupport import LookupKey
-from ..dimensions import DimensionGraph, SerializedDimensionGraph
-from ..json import from_json_pydantic, to_json_pydantic
-from ..persistenceContext import PersistenceContextVars
-from ..storageClass import StorageClass, StorageClassFactory
+from ._config_support import LookupKey
+from ._storage_class import StorageClass, StorageClassFactory
+from .dimensions import DimensionGraph, SerializedDimensionGraph
+from .json import from_json_pydantic, to_json_pydantic
+from .persistence_context import PersistenceContextVars
if TYPE_CHECKING:
- from ...registry import Registry
- from ..dimensions import Dimension, DimensionUniverse
+ from .dimensions import Dimension, DimensionUniverse
+ from .registry import Registry
def _safeMakeMappingProxyType(data: Mapping | None) -> Mapping:
diff --git a/python/lsst/daf/butler/_deferredDatasetHandle.py b/python/lsst/daf/butler/_deferredDatasetHandle.py
index bb0a67e304..867f85e2ce 100644
--- a/python/lsst/daf/butler/_deferredDatasetHandle.py
+++ b/python/lsst/daf/butler/_deferredDatasetHandle.py
@@ -35,8 +35,10 @@
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
+ from ._dataset_ref import DatasetRef
from ._limited_butler import LimitedButler
- from .core import DataCoordinate, DatasetRef, StorageClass
+ from ._storage_class import StorageClass
+ from .dimensions import DataCoordinate
@dataclasses.dataclass(frozen=True)
diff --git a/python/lsst/daf/butler/core/exceptions.py b/python/lsst/daf/butler/_exceptions.py
similarity index 100%
rename from python/lsst/daf/butler/core/exceptions.py
rename to python/lsst/daf/butler/_exceptions.py
diff --git a/python/lsst/daf/butler/core/fileDataset.py b/python/lsst/daf/butler/_file_dataset.py
similarity index 97%
rename from python/lsst/daf/butler/core/fileDataset.py
rename to python/lsst/daf/butler/_file_dataset.py
index 2bd61cda6c..80e67ed838 100644
--- a/python/lsst/daf/butler/core/fileDataset.py
+++ b/python/lsst/daf/butler/_file_dataset.py
@@ -34,8 +34,8 @@
from lsst.resources import ResourcePath, ResourcePathExpression
-from .datasets import DatasetRef
-from .formatter import FormatterParameter
+from ._dataset_ref import DatasetRef
+from ._formatter import FormatterParameter
@dataclass
diff --git a/python/lsst/daf/butler/core/fileDescriptor.py b/python/lsst/daf/butler/_file_descriptor.py
similarity index 97%
rename from python/lsst/daf/butler/core/fileDescriptor.py
rename to python/lsst/daf/butler/_file_descriptor.py
index 9e0dc9cc91..b014fb71b7 100644
--- a/python/lsst/daf/butler/core/fileDescriptor.py
+++ b/python/lsst/daf/butler/_file_descriptor.py
@@ -32,8 +32,8 @@
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
- from .location import Location
- from .storageClass import StorageClass
+ from ._location import Location
+ from ._storage_class import StorageClass
class FileDescriptor:
diff --git a/python/lsst/daf/butler/core/formatter.py b/python/lsst/daf/butler/_formatter.py
similarity index 98%
rename from python/lsst/daf/butler/core/formatter.py
rename to python/lsst/daf/butler/_formatter.py
index bd954bb53c..49529c4956 100644
--- a/python/lsst/daf/butler/core/formatter.py
+++ b/python/lsst/daf/butler/_formatter.py
@@ -38,14 +38,15 @@
from lsst.utils.introspection import get_full_type_name
-from .config import Config
-from .configSupport import LookupKey, processLookupConfigs
-from .datasets import DatasetRef, DatasetType
+from ._config import Config
+from ._config_support import LookupKey, processLookupConfigs
+from ._dataset_ref import DatasetRef
+from ._dataset_type import DatasetType
+from ._file_descriptor import FileDescriptor
+from ._location import Location
+from ._storage_class import StorageClass
from .dimensions import DimensionUniverse
-from .fileDescriptor import FileDescriptor
-from .location import Location
-from .mappingFactory import MappingFactory
-from .storageClass import StorageClass
+from .mapping_factory import MappingFactory
log = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/_limited_butler.py b/python/lsst/daf/butler/_limited_butler.py
index 4f9f710342..a382572b32 100644
--- a/python/lsst/daf/butler/_limited_butler.py
+++ b/python/lsst/daf/butler/_limited_butler.py
@@ -37,8 +37,11 @@
from deprecated.sphinx import deprecated
from lsst.resources import ResourcePath
+from ._dataset_ref import DatasetRef
from ._deferredDatasetHandle import DeferredDatasetHandle
-from .core import DatasetRef, DatasetRefURIs, Datastore, DimensionUniverse, StorageClass, StorageClassFactory
+from ._storage_class import StorageClass, StorageClassFactory
+from .datastore import DatasetRefURIs, Datastore
+from .dimensions import DimensionUniverse
log = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/core/location.py b/python/lsst/daf/butler/_location.py
similarity index 100%
rename from python/lsst/daf/butler/core/location.py
rename to python/lsst/daf/butler/_location.py
diff --git a/python/lsst/daf/butler/core/named.py b/python/lsst/daf/butler/_named.py
similarity index 100%
rename from python/lsst/daf/butler/core/named.py
rename to python/lsst/daf/butler/_named.py
diff --git a/python/lsst/daf/butler/core/quantum.py b/python/lsst/daf/butler/_quantum.py
similarity index 98%
rename from python/lsst/daf/butler/core/quantum.py
rename to python/lsst/daf/butler/_quantum.py
index c9a1c32eda..3f410c8fd3 100644
--- a/python/lsst/daf/butler/core/quantum.py
+++ b/python/lsst/daf/butler/_quantum.py
@@ -38,8 +38,10 @@
from lsst.utils import doImportType
from lsst.utils.introspection import find_outside_stacklevel
-from .datasets import DatasetRef, DatasetType, SerializedDatasetRef, SerializedDatasetType
-from .datastoreRecordData import DatastoreRecordData, SerializedDatastoreRecordData
+from ._dataset_ref import DatasetRef, SerializedDatasetRef
+from ._dataset_type import DatasetType, SerializedDatasetType
+from ._named import NamedKeyDict, NamedKeyMapping
+from .datastore.record_data import DatastoreRecordData, SerializedDatastoreRecordData
from .dimensions import (
DataCoordinate,
DimensionRecord,
@@ -47,7 +49,6 @@
SerializedDataCoordinate,
SerializedDimensionRecord,
)
-from .named import NamedKeyDict, NamedKeyMapping
def _reconstructDatasetRef(
diff --git a/python/lsst/daf/butler/_quantum_backed.py b/python/lsst/daf/butler/_quantum_backed.py
index 85e9deaffa..5d3edb797d 100644
--- a/python/lsst/daf/butler/_quantum_backed.py
+++ b/python/lsst/daf/butler/_quantum_backed.py
@@ -27,6 +27,8 @@
from __future__ import annotations
+from . import ddl
+
__all__ = ("QuantumBackedButler", "QuantumProvenanceData")
import itertools
@@ -37,26 +39,20 @@
from typing import TYPE_CHECKING, Any
from deprecated.sphinx import deprecated
-from lsst.daf.butler._compat import _BaseModelCompat
from lsst.resources import ResourcePathExpression
-from ._butlerConfig import ButlerConfig
+from ._butler_config import ButlerConfig
+from ._compat import _BaseModelCompat
+from ._config import Config
+from ._dataset_ref import DatasetId, DatasetRef
+from ._dataset_type import DatasetType
from ._deferredDatasetHandle import DeferredDatasetHandle
from ._limited_butler import LimitedButler
-from .core import (
- Config,
- DatasetId,
- DatasetRef,
- DatasetType,
- Datastore,
- DatastoreRecordData,
- DimensionUniverse,
- Quantum,
- SerializedDatastoreRecordData,
- StorageClass,
- StorageClassFactory,
- ddl,
-)
+from ._quantum import Quantum
+from ._storage_class import StorageClass, StorageClassFactory
+from .datastore import Datastore
+from .datastore.record_data import DatastoreRecordData, SerializedDatastoreRecordData
+from .dimensions import DimensionUniverse
from .registry.bridge.monolithic import MonolithicDatastoreRegistryBridgeManager
from .registry.databases.sqlite import SqliteDatabase
from .registry.interfaces import DatastoreRegistryBridgeManager, OpaqueTableStorageManager
diff --git a/python/lsst/daf/butler/_registry_shim.py b/python/lsst/daf/butler/_registry_shim.py
index 7694d17546..4ba989e829 100644
--- a/python/lsst/daf/butler/_registry_shim.py
+++ b/python/lsst/daf/butler/_registry_shim.py
@@ -33,25 +33,23 @@
from collections.abc import Iterable, Iterator, Mapping, Sequence
from typing import TYPE_CHECKING, Any
-from .core import (
+from ._dataset_association import DatasetAssociation
+from ._dataset_ref import DatasetId, DatasetIdGenEnum, DatasetRef
+from ._dataset_type import DatasetType
+from ._named import NameLookupMapping
+from ._timespan import Timespan
+from .dimensions import (
DataCoordinate,
DataId,
- DatasetAssociation,
- DatasetId,
- DatasetIdGenEnum,
- DatasetRef,
- DatasetType,
Dimension,
DimensionElement,
DimensionGraph,
DimensionRecord,
DimensionUniverse,
- NameLookupMapping,
- Timespan,
)
from .registry import Registry
from .registry._collection_summary import CollectionSummary
-from .registry._collectionType import CollectionType
+from .registry._collection_type import CollectionType
from .registry._defaults import RegistryDefaults
from .registry.queries import DataCoordinateQueryResults, DatasetQueryResults, DimensionRecordQueryResults
diff --git a/python/lsst/daf/butler/core/storageClass.py b/python/lsst/daf/butler/_storage_class.py
similarity index 98%
rename from python/lsst/daf/butler/core/storageClass.py
rename to python/lsst/daf/butler/_storage_class.py
index 787ce7b559..f66241e13f 100644
--- a/python/lsst/daf/butler/core/storageClass.py
+++ b/python/lsst/daf/butler/_storage_class.py
@@ -52,9 +52,9 @@
from lsst.utils.classes import Singleton
from lsst.utils.introspection import get_full_type_name
-from .config import Config, ConfigSubset
-from .configSupport import LookupKey
-from .storageClassDelegate import StorageClassDelegate
+from ._config import Config, ConfigSubset
+from ._config_support import LookupKey
+from ._storage_class_delegate import StorageClassDelegate
log = logging.getLogger(__name__)
@@ -97,8 +97,6 @@ class StorageClass:
_cls_delegate: str | None = None
_cls_pytype: type | str | None = None
_cls_converters: dict[str, str] | None = None
- defaultDelegate: type = StorageClassDelegate
- defaultDelegateName: str = get_full_type_name(defaultDelegate)
def __init__(
self,
@@ -172,8 +170,8 @@ def __init__(
# We set a default delegate for composites so that a class is
# guaranteed to support something if it is a composite.
log.debug("Setting default delegate for %s", self.name)
- self._delegate = self.defaultDelegate
- self._delegateClassName = self.defaultDelegateName
+ self._delegate = StorageClassDelegate
+ self._delegateClassName = get_full_type_name(self._delegate)
else:
self._delegate = None
self._delegateClassName = None
diff --git a/python/lsst/daf/butler/core/storageClassDelegate.py b/python/lsst/daf/butler/_storage_class_delegate.py
similarity index 99%
rename from python/lsst/daf/butler/core/storageClassDelegate.py
rename to python/lsst/daf/butler/_storage_class_delegate.py
index d229f4f701..344c299f2e 100644
--- a/python/lsst/daf/butler/core/storageClassDelegate.py
+++ b/python/lsst/daf/butler/_storage_class_delegate.py
@@ -40,7 +40,7 @@
from lsst.utils.introspection import get_full_type_name
if TYPE_CHECKING:
- from .storageClass import StorageClass
+ from ._storage_class import StorageClass
log = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/core/timespan.py b/python/lsst/daf/butler/_timespan.py
similarity index 99%
rename from python/lsst/daf/butler/core/timespan.py
rename to python/lsst/daf/butler/_timespan.py
index d0552edcc4..38d7f9dbec 100644
--- a/python/lsst/daf/butler/core/timespan.py
+++ b/python/lsst/daf/butler/_timespan.py
@@ -56,8 +56,8 @@
from .time_utils import TimeConverter
if TYPE_CHECKING: # Imports needed only for type annotations; may be circular.
- from ..registry import Registry
from .dimensions import DimensionUniverse
+ from .registry import Registry
class _SpecialTimespanBound(enum.Enum):
diff --git a/python/lsst/daf/butler/core/_topology.py b/python/lsst/daf/butler/_topology.py
similarity index 99%
rename from python/lsst/daf/butler/core/_topology.py
rename to python/lsst/daf/butler/_topology.py
index d7039e6fb6..6ca43982a1 100644
--- a/python/lsst/daf/butler/core/_topology.py
+++ b/python/lsst/daf/butler/_topology.py
@@ -40,7 +40,7 @@
from lsst.utils.classes import immutable
-from .named import NamedValueAbstractSet
+from ._named import NamedValueAbstractSet
@enum.unique
diff --git a/python/lsst/daf/butler/cli/cliLog.py b/python/lsst/daf/butler/cli/cliLog.py
index 8cfbed0990..45ac6e4b46 100644
--- a/python/lsst/daf/butler/cli/cliLog.py
+++ b/python/lsst/daf/butler/cli/cliLog.py
@@ -43,7 +43,7 @@
from lsst.utils.logging import TRACE, VERBOSE
-from ..core.logging import ButlerMDC, JsonLogFormatter
+from ..logging import ButlerMDC, JsonLogFormatter
class PrecisionLogFormatter(logging.Formatter):
diff --git a/python/lsst/daf/butler/cli/progress.py b/python/lsst/daf/butler/cli/progress.py
index 4aecebd6a0..e81b1e066c 100644
--- a/python/lsst/daf/butler/cli/progress.py
+++ b/python/lsst/daf/butler/cli/progress.py
@@ -35,7 +35,7 @@
import click
-from ..core.progress import Progress, ProgressBar, ProgressHandler
+from ..progress import Progress, ProgressBar, ProgressHandler
_T = TypeVar("_T")
diff --git a/python/lsst/daf/butler/cli/utils.py b/python/lsst/daf/butler/cli/utils.py
index d125269a16..69d0b9825b 100644
--- a/python/lsst/daf/butler/cli/utils.py
+++ b/python/lsst/daf/butler/cli/utils.py
@@ -77,7 +77,7 @@
import yaml
from lsst.utils.iteration import ensure_iterable
-from ..core.config import Config
+from .._config import Config
from .cliLog import CliLog
if TYPE_CHECKING:
diff --git a/python/lsst/daf/butler/core/__init__.py b/python/lsst/daf/butler/core/__init__.py
deleted file mode 100644
index 0fd255ec18..0000000000
--- a/python/lsst/daf/butler/core/__init__.py
+++ /dev/null
@@ -1,38 +0,0 @@
-"""Core code for butler."""
-
-# Do not export the utility routines from utils and queries.
-
-from . import progress # most symbols are only used by handler implementors
-from . import ddl, time_utils
-from ._column_categorization import *
-from ._column_tags import *
-from ._column_type_info import *
-from ._topology import *
-from .composites import *
-from .config import *
-from .configSupport import LookupKey
-from .constraints import *
-from .datasets import *
-from .datastore import *
-from .datastoreCacheManager import *
-from .datastoreRecordData import *
-from .dimensions import *
-from .exceptions import *
-from .fileDataset import *
-from .fileDescriptor import *
-from .fileTemplates import *
-from .formatter import *
-from .location import *
-
-# Only import ButlerLogRecords
-# ButlerLogRecords is the fundamental type stored in datastores.
-from .logging import ButlerLogRecords
-from .mappingFactory import *
-from .named import *
-from .persistenceContext import *
-from .progress import Progress
-from .quantum import *
-from .storageClass import *
-from .storageClassDelegate import *
-from .storedFileInfo import *
-from .timespan import *
diff --git a/python/lsst/daf/butler/core/datasets/__init__.py b/python/lsst/daf/butler/datastore/__init__.py
similarity index 92%
rename from python/lsst/daf/butler/core/datasets/__init__.py
rename to python/lsst/daf/butler/datastore/__init__.py
index cc5d5790c0..858eb2e307 100644
--- a/python/lsst/daf/butler/core/datasets/__init__.py
+++ b/python/lsst/daf/butler/datastore/__init__.py
@@ -24,7 +24,5 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-"""Butler dataset types."""
-from .association import DatasetAssociation
-from .ref import *
-from .type import *
+
+from ._datastore import *
diff --git a/python/lsst/daf/butler/core/datastore.py b/python/lsst/daf/butler/datastore/_datastore.py
similarity index 98%
rename from python/lsst/daf/butler/core/datastore.py
rename to python/lsst/daf/butler/datastore/_datastore.py
index fa486f0f93..5b2567ec2b 100644
--- a/python/lsst/daf/butler/core/datastore.py
+++ b/python/lsst/daf/butler/datastore/_datastore.py
@@ -29,7 +29,14 @@
from __future__ import annotations
-__all__ = ("DatastoreConfig", "Datastore", "DatastoreValidationError", "DatasetRefURIs", "NullDatastore")
+__all__ = (
+ "DatastoreConfig",
+ "Datastore",
+ "DatastoreValidationError",
+ "DatasetRefURIs",
+ "NullDatastore",
+ "DatastoreTransaction",
+)
import contextlib
import dataclasses
@@ -42,20 +49,21 @@
from lsst.utils import doImportType
-from .config import Config, ConfigSubset
+from .._config import Config, ConfigSubset
+from .._exceptions import DatasetTypeNotSupportedError, ValidationError
+from .._file_dataset import FileDataset
+from .._storage_class import StorageClassFactory
from .constraints import Constraints
-from .exceptions import DatasetTypeNotSupportedError, ValidationError
-from .fileDataset import FileDataset
-from .storageClass import StorageClassFactory
if TYPE_CHECKING:
from lsst.resources import ResourcePath, ResourcePathExpression
+ from .._config_support import LookupKey
+ from .._dataset_ref import DatasetRef
+ from .._dataset_type import DatasetType
+ from .._storage_class import StorageClass
from ..registry.interfaces import DatasetIdRef, DatastoreRegistryBridgeManager
- from .configSupport import LookupKey
- from .datasets import DatasetRef, DatasetType
- from .datastoreRecordData import DatastoreRecordData
- from .storageClass import StorageClass
+ from .record_data import DatastoreRecordData
_LOG = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/core/datastoreCacheManager.py b/python/lsst/daf/butler/datastore/cache_manager.py
similarity index 99%
rename from python/lsst/daf/butler/core/datastoreCacheManager.py
rename to python/lsst/daf/butler/datastore/cache_manager.py
index a388f7e8a0..bf0af433d5 100644
--- a/python/lsst/daf/butler/core/datastoreCacheManager.py
+++ b/python/lsst/daf/butler/datastore/cache_manager.py
@@ -55,15 +55,15 @@
from lsst.resources import ResourcePath
from pydantic import PrivateAttr
-from .config import ConfigSubset
-from .configSupport import processLookupConfigs
-from .datasets import DatasetId, DatasetRef
+from .._config import ConfigSubset
+from .._config_support import processLookupConfigs
+from .._dataset_ref import DatasetId, DatasetRef
if TYPE_CHECKING:
- from .configSupport import LookupKey
- from .datasets import DatasetType
- from .dimensions import DimensionUniverse
- from .storageClass import StorageClass
+ from .._config_support import LookupKey
+ from .._dataset_type import DatasetType
+ from .._storage_class import StorageClass
+ from ..dimensions import DimensionUniverse
log = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/core/composites.py b/python/lsst/daf/butler/datastore/composites.py
similarity index 94%
rename from python/lsst/daf/butler/core/composites.py
rename to python/lsst/daf/butler/datastore/composites.py
index 0b7f71c0a7..1895e97e7d 100644
--- a/python/lsst/daf/butler/core/composites.py
+++ b/python/lsst/daf/butler/datastore/composites.py
@@ -36,17 +36,18 @@
import yaml
-from .config import ConfigSubset
-from .configSupport import processLookupConfigs
+from .._config import ConfigSubset
+from .._config_support import processLookupConfigs
if TYPE_CHECKING:
from lsst.resources import ResourcePathExpression
- from .._butlerConfig import ButlerConfig
- from .configSupport import LookupKey
- from .datasets import DatasetRef, DatasetType
- from .dimensions import DimensionUniverse
- from .storageClass import StorageClass
+ from .._butler_config import ButlerConfig
+ from .._config_support import LookupKey
+ from .._dataset_ref import DatasetRef
+ from .._dataset_type import DatasetType
+ from .._storage_class import StorageClass
+ from ..dimensions import DimensionUniverse
log = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/core/constraints.py b/python/lsst/daf/butler/datastore/constraints.py
similarity index 94%
rename from python/lsst/daf/butler/core/constraints.py
rename to python/lsst/daf/butler/datastore/constraints.py
index 7325a2a8b4..28ff4d0e5d 100644
--- a/python/lsst/daf/butler/core/constraints.py
+++ b/python/lsst/daf/butler/datastore/constraints.py
@@ -36,14 +36,15 @@
import logging
from typing import TYPE_CHECKING
-from .config import Config
-from .configSupport import LookupKey, processLookupConfigList
-from .exceptions import ValidationError
+from .._config import Config
+from .._config_support import LookupKey, processLookupConfigList
+from .._exceptions import ValidationError
if TYPE_CHECKING:
- from .datasets import DatasetRef, DatasetType
- from .dimensions import DimensionUniverse
- from .storageClass import StorageClass
+ from .._dataset_ref import DatasetRef
+ from .._dataset_type import DatasetType
+ from .._storage_class import StorageClass
+ from ..dimensions import DimensionUniverse
log = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/core/fileTemplates.py b/python/lsst/daf/butler/datastore/file_templates.py
similarity index 98%
rename from python/lsst/daf/butler/core/fileTemplates.py
rename to python/lsst/daf/butler/datastore/file_templates.py
index 07a92f923e..17c3ca80ca 100644
--- a/python/lsst/daf/butler/core/fileTemplates.py
+++ b/python/lsst/daf/butler/datastore/file_templates.py
@@ -38,16 +38,16 @@
from types import MappingProxyType
from typing import TYPE_CHECKING, Any
-from .config import Config
-from .configSupport import LookupKey, processLookupConfigs
-from .datasets import DatasetRef
-from .dimensions import DataCoordinate, SkyPixDimension
-from .exceptions import ValidationError
-from .storageClass import StorageClass
+from .._config import Config
+from .._config_support import LookupKey, processLookupConfigs
+from .._dataset_ref import DatasetRef
+from .._exceptions import ValidationError
+from .._storage_class import StorageClass
+from ..dimensions import DataCoordinate, SkyPixDimension
if TYPE_CHECKING:
- from .datasets import DatasetType
- from .dimensions import DimensionUniverse
+ from .._dataset_type import DatasetType
+ from ..dimensions import DimensionUniverse
log = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/datastores/genericDatastore.py b/python/lsst/daf/butler/datastore/generic_base.py
similarity index 96%
rename from python/lsst/daf/butler/datastores/genericDatastore.py
rename to python/lsst/daf/butler/datastore/generic_base.py
index 77a9bdc6c0..02f32133a8 100644
--- a/python/lsst/daf/butler/datastores/genericDatastore.py
+++ b/python/lsst/daf/butler/datastore/generic_base.py
@@ -36,13 +36,14 @@
from collections.abc import Iterable, Mapping, Sequence
from typing import TYPE_CHECKING, Any
-from lsst.daf.butler import DatasetTypeNotSupportedError, Datastore
-from lsst.daf.butler.registry.interfaces import DatastoreRegistryBridge
-
-from ..registry.interfaces import DatabaseInsertMode
+from .._exceptions import DatasetTypeNotSupportedError
+from ..registry.interfaces import DatabaseInsertMode, DatastoreRegistryBridge
+from ._datastore import Datastore
if TYPE_CHECKING:
- from lsst.daf.butler import DatasetRef, StorageClass, StoredDatastoreItemInfo
+ from .._dataset_ref import DatasetRef
+ from .._storage_class import StorageClass
+ from .stored_file_info import StoredDatastoreItemInfo
log = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/core/datastoreRecordData.py b/python/lsst/daf/butler/datastore/record_data.py
similarity index 96%
rename from python/lsst/daf/butler/core/datastoreRecordData.py
rename to python/lsst/daf/butler/datastore/record_data.py
index 4dc191d454..21ff4eab92 100644
--- a/python/lsst/daf/butler/core/datastoreRecordData.py
+++ b/python/lsst/daf/butler/datastore/record_data.py
@@ -40,10 +40,10 @@
from lsst.utils import doImportType
from lsst.utils.introspection import get_full_type_name
-from .datasets import DatasetId
-from .dimensions import DimensionUniverse
-from .persistenceContext import PersistenceContextVars
-from .storedFileInfo import StoredDatastoreItemInfo
+from .._dataset_ref import DatasetId
+from ..dimensions import DimensionUniverse
+from ..persistence_context import PersistenceContextVars
+from .stored_file_info import StoredDatastoreItemInfo
if TYPE_CHECKING:
from ..registry import Registry
@@ -170,7 +170,7 @@ def subset(self, dataset_ids: set[DatasetId]) -> DatastoreRecordData | None:
def to_simple(self, minimal: bool = False) -> SerializedDatastoreRecordData:
"""Make representation of the object for serialization.
- Implements `~lsst.daf.butler.core.json.SupportsSimple` protocol.
+ Implements `~lsst.daf.butler.json.SupportsSimple` protocol.
Parameters
----------
@@ -213,7 +213,7 @@ def from_simple(
) -> DatastoreRecordData:
"""Make an instance of this class from serialized data.
- Implements `~lsst.daf.butler.core.json.SupportsSimple` protocol.
+ Implements `~lsst.daf.butler.json.SupportsSimple` protocol.
Parameters
----------
diff --git a/python/lsst/daf/butler/core/storedFileInfo.py b/python/lsst/daf/butler/datastore/stored_file_info.py
similarity index 97%
rename from python/lsst/daf/butler/core/storedFileInfo.py
rename to python/lsst/daf/butler/datastore/stored_file_info.py
index fe5dc0aec0..a38ff6742d 100644
--- a/python/lsst/daf/butler/core/storedFileInfo.py
+++ b/python/lsst/daf/butler/datastore/stored_file_info.py
@@ -36,12 +36,12 @@
from lsst.resources import ResourcePath
-from .formatter import Formatter, FormatterParameter
-from .location import Location, LocationFactory
-from .storageClass import StorageClass, StorageClassFactory
+from .._formatter import Formatter, FormatterParameter
+from .._location import Location, LocationFactory
+from .._storage_class import StorageClass, StorageClassFactory
if TYPE_CHECKING:
- from .datasets import DatasetId, DatasetRef
+ from .. import DatasetId, DatasetRef
# String to use when a Python None is encountered
NULLSTR = "__NULL_STRING__"
diff --git a/python/lsst/daf/butler/datastores/chainedDatastore.py b/python/lsst/daf/butler/datastores/chainedDatastore.py
index 35b3b151a7..f6af89048c 100644
--- a/python/lsst/daf/butler/datastores/chainedDatastore.py
+++ b/python/lsst/daf/butler/datastores/chainedDatastore.py
@@ -38,17 +38,10 @@
from collections.abc import Iterable, Mapping, Sequence
from typing import TYPE_CHECKING, Any
-from lsst.daf.butler import (
- Constraints,
- DatasetRef,
- DatasetRefURIs,
- DatasetTypeNotSupportedError,
- Datastore,
- DatastoreConfig,
- DatastoreRecordData,
- DatastoreValidationError,
- FileDataset,
-)
+from lsst.daf.butler import DatasetRef, DatasetTypeNotSupportedError, Datastore, FileDataset
+from lsst.daf.butler.datastore import DatasetRefURIs, DatastoreConfig, DatastoreValidationError
+from lsst.daf.butler.datastore.constraints import Constraints
+from lsst.daf.butler.datastore.record_data import DatastoreRecordData
from lsst.resources import ResourcePath
from lsst.utils import doImportType
diff --git a/python/lsst/daf/butler/datastores/fileDatastore.py b/python/lsst/daf/butler/datastores/fileDatastore.py
index a48bf2893b..5f0c2a7aaf 100644
--- a/python/lsst/daf/butler/datastores/fileDatastore.py
+++ b/python/lsst/daf/butler/datastores/fileDatastore.py
@@ -40,36 +40,40 @@
from typing import TYPE_CHECKING, Any, ClassVar
from lsst.daf.butler import (
- CompositesMap,
Config,
DatasetId,
DatasetRef,
- DatasetRefURIs,
DatasetType,
DatasetTypeNotSupportedError,
Datastore,
- DatastoreCacheManager,
- DatastoreConfig,
- DatastoreDisabledCacheManager,
- DatastoreRecordData,
- DatastoreValidationError,
FileDataset,
FileDescriptor,
- FileTemplates,
- FileTemplateValidationError,
Formatter,
FormatterFactory,
Location,
LocationFactory,
Progress,
StorageClass,
- StoredDatastoreItemInfo,
- StoredFileInfo,
ddl,
)
-from lsst.daf.butler.core.repoRelocation import replaceRoot
-from lsst.daf.butler.core.utils import transactional
-from lsst.daf.butler.registry.interfaces import DatastoreRegistryBridge, ReadOnlyDatabaseError
+from lsst.daf.butler.datastore import DatasetRefURIs, DatastoreConfig, DatastoreValidationError
+from lsst.daf.butler.datastore.cache_manager import (
+ AbstractDatastoreCacheManager,
+ DatastoreCacheManager,
+ DatastoreDisabledCacheManager,
+)
+from lsst.daf.butler.datastore.composites import CompositesMap
+from lsst.daf.butler.datastore.file_templates import FileTemplates, FileTemplateValidationError
+from lsst.daf.butler.datastore.record_data import DatastoreRecordData
+from lsst.daf.butler.datastore.stored_file_info import StoredDatastoreItemInfo, StoredFileInfo
+from lsst.daf.butler.registry.interfaces import (
+ DatabaseInsertMode,
+ DatastoreRegistryBridge,
+ FakeDatasetRef,
+ ReadOnlyDatabaseError,
+)
+from lsst.daf.butler.repo_relocation import replaceRoot
+from lsst.daf.butler.utils import transactional
from lsst.resources import ResourcePath, ResourcePathExpression
from lsst.utils.introspection import get_class_of, get_instance_of
from lsst.utils.iteration import chunk_iterable
@@ -79,11 +83,10 @@
from lsst.utils.timer import time_this
from sqlalchemy import BigInteger, String
-from ..registry.interfaces import DatabaseInsertMode, FakeDatasetRef
-from .genericDatastore import GenericBaseDatastore
+from ..datastore.generic_base import GenericBaseDatastore
if TYPE_CHECKING:
- from lsst.daf.butler import AbstractDatastoreCacheManager, LookupKey
+ from lsst.daf.butler import LookupKey
from lsst.daf.butler.registry.interfaces import DatasetIdRef, DatastoreRegistryBridgeManager
log = getLogger(__name__)
diff --git a/python/lsst/daf/butler/datastores/inMemoryDatastore.py b/python/lsst/daf/butler/datastores/inMemoryDatastore.py
index 3f4936bc38..565c1dc4db 100644
--- a/python/lsst/daf/butler/datastores/inMemoryDatastore.py
+++ b/python/lsst/daf/butler/datastores/inMemoryDatastore.py
@@ -38,20 +38,16 @@
from typing import TYPE_CHECKING, Any
from urllib.parse import urlencode
-from lsst.daf.butler import (
- DatasetId,
- DatasetRef,
- DatasetRefURIs,
- DatastoreRecordData,
- StorageClass,
- StoredDatastoreItemInfo,
-)
-from lsst.daf.butler.core.utils import transactional
+from lsst.daf.butler import DatasetId, DatasetRef, StorageClass
+from lsst.daf.butler.datastore import DatasetRefURIs
+from lsst.daf.butler.datastore.record_data import DatastoreRecordData
+from lsst.daf.butler.datastore.stored_file_info import StoredDatastoreItemInfo
from lsst.daf.butler.registry.interfaces import DatastoreRegistryBridge
+from lsst.daf.butler.utils import transactional
from lsst.resources import ResourcePath
+from ..datastore.generic_base import GenericBaseDatastore
from ..registry.interfaces import DatabaseInsertMode
-from .genericDatastore import GenericBaseDatastore
if TYPE_CHECKING:
from lsst.daf.butler import Config, DatasetType, LookupKey
diff --git a/python/lsst/daf/butler/core/ddl.py b/python/lsst/daf/butler/ddl.py
similarity index 99%
rename from python/lsst/daf/butler/core/ddl.py
rename to python/lsst/daf/butler/ddl.py
index e401958d04..81041f4ec7 100644
--- a/python/lsst/daf/butler/core/ddl.py
+++ b/python/lsst/daf/butler/ddl.py
@@ -66,13 +66,13 @@
from sqlalchemy.dialects.postgresql import UUID
from . import time_utils
-from .config import Config
-from .exceptions import ValidationError
-from .named import NamedValueSet
+from ._config import Config
+from ._exceptions import ValidationError
+from ._named import NamedValueSet
from .utils import stripIfNotNone
if TYPE_CHECKING:
- from .timespan import TimespanDatabaseRepresentation
+ from ._timespan import TimespanDatabaseRepresentation
_LOG = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/core/dimensions/__init__.py b/python/lsst/daf/butler/dimensions/__init__.py
similarity index 97%
rename from python/lsst/daf/butler/core/dimensions/__init__.py
rename to python/lsst/daf/butler/dimensions/__init__.py
index 09ddc68e3b..75ab7b283d 100644
--- a/python/lsst/daf/butler/core/dimensions/__init__.py
+++ b/python/lsst/daf/butler/dimensions/__init__.py
@@ -36,8 +36,8 @@
from . import construction
from ._config import *
from ._coordinate import *
+from ._data_coordinate_iterable import *
from ._database import *
-from ._dataCoordinateIterable import *
from ._elements import *
from ._governor import *
from ._graph import *
diff --git a/python/lsst/daf/butler/core/dimensions/_config.py b/python/lsst/daf/butler/dimensions/_config.py
similarity index 99%
rename from python/lsst/daf/butler/core/dimensions/_config.py
rename to python/lsst/daf/butler/dimensions/_config.py
index e6b4c4cc4a..d6bea5b36d 100644
--- a/python/lsst/daf/butler/core/dimensions/_config.py
+++ b/python/lsst/daf/butler/dimensions/_config.py
@@ -36,8 +36,8 @@
from lsst.resources import ResourcePath, ResourcePathExpression
from .. import ddl
+from .._config import Config, ConfigSubset
from .._topology import TopologicalSpace
-from ..config import Config, ConfigSubset
from ._database import (
DatabaseDimensionElementConstructionVisitor,
DatabaseTopologicalFamilyConstructionVisitor,
diff --git a/python/lsst/daf/butler/core/dimensions/_coordinate.py b/python/lsst/daf/butler/dimensions/_coordinate.py
similarity index 99%
rename from python/lsst/daf/butler/core/dimensions/_coordinate.py
rename to python/lsst/daf/butler/dimensions/_coordinate.py
index 4e01df4958..474365e865 100644
--- a/python/lsst/daf/butler/core/dimensions/_coordinate.py
+++ b/python/lsst/daf/butler/dimensions/_coordinate.py
@@ -43,16 +43,16 @@
from lsst.daf.butler._compat import _BaseModelCompat
from lsst.sphgeom import IntersectionRegion, Region
+from .._named import NamedKeyDict, NamedKeyMapping, NamedValueAbstractSet, NameLookupMapping
+from .._timespan import Timespan
from ..json import from_json_pydantic, to_json_pydantic
-from ..named import NamedKeyDict, NamedKeyMapping, NamedValueAbstractSet, NameLookupMapping
-from ..persistenceContext import PersistenceContextVars
-from ..timespan import Timespan
+from ..persistence_context import PersistenceContextVars
from ._elements import Dimension, DimensionElement
from ._graph import DimensionGraph
from ._records import DimensionRecord, SerializedDimensionRecord
if TYPE_CHECKING: # Imports needed only for type annotations; may be circular.
- from ...registry import Registry
+ from ..registry import Registry
from ._universe import DimensionUniverse
DataIdKey = str | Dimension
diff --git a/python/lsst/daf/butler/core/dimensions/_dataCoordinateIterable.py b/python/lsst/daf/butler/dimensions/_data_coordinate_iterable.py
similarity index 100%
rename from python/lsst/daf/butler/core/dimensions/_dataCoordinateIterable.py
rename to python/lsst/daf/butler/dimensions/_data_coordinate_iterable.py
diff --git a/python/lsst/daf/butler/core/dimensions/_database.py b/python/lsst/daf/butler/dimensions/_database.py
similarity index 99%
rename from python/lsst/daf/butler/core/dimensions/_database.py
rename to python/lsst/daf/butler/dimensions/_database.py
index 242dd122e8..a6212fe7a9 100644
--- a/python/lsst/daf/butler/core/dimensions/_database.py
+++ b/python/lsst/daf/butler/dimensions/_database.py
@@ -42,13 +42,13 @@
from lsst.utils.classes import cached_getter
from .. import ddl
+from .._named import NamedKeyMapping, NamedValueAbstractSet, NamedValueSet
from .._topology import TopologicalFamily, TopologicalRelationshipEndpoint, TopologicalSpace
-from ..named import NamedKeyMapping, NamedValueAbstractSet, NamedValueSet
from ._elements import Dimension, DimensionCombination, DimensionElement
from .construction import DimensionConstructionBuilder, DimensionConstructionVisitor
if TYPE_CHECKING:
- from ...registry.interfaces import (
+ from ..registry.interfaces import (
Database,
DatabaseDimensionRecordStorage,
GovernorDimensionRecordStorage,
@@ -268,7 +268,7 @@ def makeStorage(
storage : `DatabaseDimensionRecordStorage`
Storage object that should back this element in a registry.
"""
- from ...registry.interfaces import DatabaseDimensionRecordStorage
+ from ..registry.interfaces import DatabaseDimensionRecordStorage
cls = doImportType(self._storage["cls"])
assert issubclass(cls, DatabaseDimensionRecordStorage)
diff --git a/python/lsst/daf/butler/core/dimensions/_elements.py b/python/lsst/daf/butler/dimensions/_elements.py
similarity index 99%
rename from python/lsst/daf/butler/core/dimensions/_elements.py
rename to python/lsst/daf/butler/dimensions/_elements.py
index cdb9a6a8bb..163cb98bd5 100644
--- a/python/lsst/daf/butler/core/dimensions/_elements.py
+++ b/python/lsst/daf/butler/dimensions/_elements.py
@@ -39,12 +39,12 @@
from lsst.utils.classes import cached_getter
from .. import ddl
+from .._named import NamedValueAbstractSet, NamedValueSet
from .._topology import TopologicalRelationshipEndpoint
from ..json import from_json_generic, to_json_generic
-from ..named import NamedValueAbstractSet, NamedValueSet
if TYPE_CHECKING: # Imports needed only for type annotations; may be circular.
- from ...registry import Registry
+ from ..registry import Registry
from ._governor import GovernorDimension
from ._graph import DimensionGraph
from ._records import DimensionRecord
diff --git a/python/lsst/daf/butler/core/dimensions/_governor.py b/python/lsst/daf/butler/dimensions/_governor.py
similarity index 97%
rename from python/lsst/daf/butler/core/dimensions/_governor.py
rename to python/lsst/daf/butler/dimensions/_governor.py
index 5937f04ac5..d603a27384 100644
--- a/python/lsst/daf/butler/core/dimensions/_governor.py
+++ b/python/lsst/daf/butler/dimensions/_governor.py
@@ -36,13 +36,13 @@
from lsst.utils import doImportType
from .. import ddl
+from .._named import NamedValueAbstractSet, NamedValueSet
from .._topology import TopologicalFamily, TopologicalSpace
-from ..named import NamedValueAbstractSet, NamedValueSet
from ._elements import Dimension
from .construction import DimensionConstructionBuilder, DimensionConstructionVisitor
if TYPE_CHECKING:
- from ...registry.interfaces import Database, GovernorDimensionRecordStorage, StaticTablesContext
+ from ..registry.interfaces import Database, GovernorDimensionRecordStorage, StaticTablesContext
class GovernorDimension(Dimension):
@@ -171,7 +171,7 @@ def makeStorage(
storage : `GovernorDimensionRecordStorage`
Storage object that should back this element in a registry.
"""
- from ...registry.interfaces import GovernorDimensionRecordStorage
+ from ..registry.interfaces import GovernorDimensionRecordStorage
cls = doImportType(self._storage["cls"])
assert issubclass(cls, GovernorDimensionRecordStorage)
diff --git a/python/lsst/daf/butler/core/dimensions/_graph.py b/python/lsst/daf/butler/dimensions/_graph.py
similarity index 99%
rename from python/lsst/daf/butler/core/dimensions/_graph.py
rename to python/lsst/daf/butler/dimensions/_graph.py
index 93ed166a78..8026b5306e 100644
--- a/python/lsst/daf/butler/core/dimensions/_graph.py
+++ b/python/lsst/daf/butler/dimensions/_graph.py
@@ -37,12 +37,12 @@
from lsst.daf.butler._compat import _BaseModelCompat
from lsst.utils.classes import cached_getter, immutable
+from .._named import NamedValueAbstractSet, NamedValueSet
from .._topology import TopologicalFamily, TopologicalSpace
from ..json import from_json_pydantic, to_json_pydantic
-from ..named import NamedValueAbstractSet, NamedValueSet
if TYPE_CHECKING: # Imports needed only for type annotations; may be circular.
- from ...registry import Registry
+ from ..registry import Registry
from ._elements import Dimension, DimensionElement
from ._governor import GovernorDimension
from ._universe import DimensionUniverse
diff --git a/python/lsst/daf/butler/core/dimensions/_packer.py b/python/lsst/daf/butler/dimensions/_packer.py
similarity index 100%
rename from python/lsst/daf/butler/core/dimensions/_packer.py
rename to python/lsst/daf/butler/dimensions/_packer.py
diff --git a/python/lsst/daf/butler/core/dimensions/_records.py b/python/lsst/daf/butler/dimensions/_records.py
similarity index 99%
rename from python/lsst/daf/butler/core/dimensions/_records.py
rename to python/lsst/daf/butler/dimensions/_records.py
index 44160e19f7..e3d9220d3b 100644
--- a/python/lsst/daf/butler/core/dimensions/_records.py
+++ b/python/lsst/daf/butler/dimensions/_records.py
@@ -37,13 +37,13 @@
from lsst.utils.classes import immutable
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, create_model
+from .._timespan import Timespan, TimespanDatabaseRepresentation
from ..json import from_json_pydantic, to_json_pydantic
-from ..persistenceContext import PersistenceContextVars
-from ..timespan import Timespan, TimespanDatabaseRepresentation
+from ..persistence_context import PersistenceContextVars
from ._elements import Dimension, DimensionElement
if TYPE_CHECKING: # Imports needed only for type annotations; may be circular.
- from ...registry import Registry
+ from ..registry import Registry
from ._coordinate import DataCoordinate
from ._graph import DimensionUniverse
from ._schema import DimensionElementFields
diff --git a/python/lsst/daf/butler/core/dimensions/_schema.py b/python/lsst/daf/butler/dimensions/_schema.py
similarity index 99%
rename from python/lsst/daf/butler/core/dimensions/_schema.py
rename to python/lsst/daf/butler/dimensions/_schema.py
index 3a9e7c1205..99be580fa5 100644
--- a/python/lsst/daf/butler/core/dimensions/_schema.py
+++ b/python/lsst/daf/butler/dimensions/_schema.py
@@ -36,8 +36,8 @@
from .. import ddl
from .._column_tags import DimensionKeyColumnTag, DimensionRecordColumnTag
-from ..named import NamedValueSet
-from ..timespan import TimespanDatabaseRepresentation
+from .._named import NamedValueSet
+from .._timespan import TimespanDatabaseRepresentation
if TYPE_CHECKING: # Imports needed only for type annotations; may be circular.
from lsst.daf.relation import ColumnTag
diff --git a/python/lsst/daf/butler/core/dimensions/_skypix.py b/python/lsst/daf/butler/dimensions/_skypix.py
similarity index 97%
rename from python/lsst/daf/butler/core/dimensions/_skypix.py
rename to python/lsst/daf/butler/dimensions/_skypix.py
index 8716454235..02e7dedaa3 100644
--- a/python/lsst/daf/butler/core/dimensions/_skypix.py
+++ b/python/lsst/daf/butler/dimensions/_skypix.py
@@ -41,13 +41,13 @@
from lsst.utils import doImportType
from .. import ddl
+from .._named import NamedValueAbstractSet, NamedValueSet
from .._topology import TopologicalFamily, TopologicalRelationshipEndpoint, TopologicalSpace
-from ..named import NamedValueAbstractSet, NamedValueSet
from ._elements import Dimension
from .construction import DimensionConstructionBuilder, DimensionConstructionVisitor
if TYPE_CHECKING:
- from ...registry.interfaces import SkyPixDimensionRecordStorage
+ from ..registry.interfaces import SkyPixDimensionRecordStorage
class SkyPixSystem(TopologicalFamily):
@@ -161,7 +161,7 @@ def makeStorage(self) -> SkyPixDimensionRecordStorage:
storage : `SkyPixDimensionRecordStorage`
Storage object that should back this element in a registry.
"""
- from ...registry.dimensions.skypix import BasicSkyPixDimensionRecordStorage
+ from ..registry.dimensions.skypix import BasicSkyPixDimensionRecordStorage
return BasicSkyPixDimensionRecordStorage(self)
diff --git a/python/lsst/daf/butler/core/dimensions/_universe.py b/python/lsst/daf/butler/dimensions/_universe.py
similarity index 99%
rename from python/lsst/daf/butler/core/dimensions/_universe.py
rename to python/lsst/daf/butler/dimensions/_universe.py
index d4c7296bd5..a284605e8d 100644
--- a/python/lsst/daf/butler/core/dimensions/_universe.py
+++ b/python/lsst/daf/butler/dimensions/_universe.py
@@ -39,9 +39,9 @@
from deprecated.sphinx import deprecated
from lsst.utils.classes import cached_getter, immutable
+from .._config import Config
+from .._named import NamedValueAbstractSet, NamedValueSet
from .._topology import TopologicalFamily, TopologicalSpace
-from ..config import Config
-from ..named import NamedValueAbstractSet, NamedValueSet
from ._config import _DEFAULT_NAMESPACE, DimensionConfig
from ._database import DatabaseDimensionElement
from ._elements import Dimension, DimensionElement
diff --git a/python/lsst/daf/butler/core/dimensions/construction.py b/python/lsst/daf/butler/dimensions/construction.py
similarity index 99%
rename from python/lsst/daf/butler/core/dimensions/construction.py
rename to python/lsst/daf/butler/dimensions/construction.py
index 043e810079..f2e491ca21 100644
--- a/python/lsst/daf/butler/core/dimensions/construction.py
+++ b/python/lsst/daf/butler/dimensions/construction.py
@@ -31,8 +31,8 @@
from collections.abc import Iterable, Set
from typing import TYPE_CHECKING
+from .._named import NamedValueSet
from .._topology import TopologicalFamily, TopologicalSpace
-from ..named import NamedValueSet
if TYPE_CHECKING:
from ._config import DimensionConfig
diff --git a/python/lsst/daf/butler/formatters/logs.py b/python/lsst/daf/butler/formatters/logs.py
index c957af5ded..30ab1b6d64 100644
--- a/python/lsst/daf/butler/formatters/logs.py
+++ b/python/lsst/daf/butler/formatters/logs.py
@@ -29,7 +29,7 @@
from typing import Any
-from lsst.daf.butler.core.logging import ButlerLogRecords
+from lsst.daf.butler.logging import ButlerLogRecords
from .json import JsonFormatter
diff --git a/python/lsst/daf/butler/core/json.py b/python/lsst/daf/butler/json.py
similarity index 99%
rename from python/lsst/daf/butler/core/json.py
rename to python/lsst/daf/butler/json.py
index 6684318a26..250a4fb3e7 100644
--- a/python/lsst/daf/butler/core/json.py
+++ b/python/lsst/daf/butler/json.py
@@ -33,8 +33,8 @@
from typing import TYPE_CHECKING, Any, Protocol, Type
if TYPE_CHECKING:
- from ..registry import Registry
from .dimensions import DimensionUniverse
+ from .registry import Registry
class SupportsSimple(Protocol):
diff --git a/python/lsst/daf/butler/core/logging.py b/python/lsst/daf/butler/logging.py
similarity index 99%
rename from python/lsst/daf/butler/core/logging.py
rename to python/lsst/daf/butler/logging.py
index 6be616e69f..957fe7970c 100644
--- a/python/lsst/daf/butler/core/logging.py
+++ b/python/lsst/daf/butler/logging.py
@@ -35,11 +35,12 @@
from logging import Formatter, LogRecord, StreamHandler
from typing import IO, Any, ClassVar, Union, overload
-from lsst.daf.butler._compat import PYDANTIC_V2, _BaseModelCompat
from lsst.utils.introspection import get_full_type_name
from lsst.utils.iteration import isplit
from pydantic import ConfigDict, PrivateAttr
+from ._compat import PYDANTIC_V2, _BaseModelCompat
+
_LONG_LOG_FORMAT = "{levelname} {asctime} {name} {filename}:{lineno} - {message}"
"""Default format for log records."""
diff --git a/python/lsst/daf/butler/core/mappingFactory.py b/python/lsst/daf/butler/mapping_factory.py
similarity index 99%
rename from python/lsst/daf/butler/core/mappingFactory.py
rename to python/lsst/daf/butler/mapping_factory.py
index e2301b6763..67c8f22f0e 100644
--- a/python/lsst/daf/butler/core/mappingFactory.py
+++ b/python/lsst/daf/butler/mapping_factory.py
@@ -34,8 +34,8 @@
from lsst.utils.introspection import get_class_of
-from .config import Config
-from .configSupport import LookupKey
+from ._config import Config
+from ._config_support import LookupKey
class MappingFactory:
diff --git a/python/lsst/daf/butler/core/persistenceContext.py b/python/lsst/daf/butler/persistence_context.py
similarity index 97%
rename from python/lsst/daf/butler/core/persistenceContext.py
rename to python/lsst/daf/butler/persistence_context.py
index 4e520e6ef4..d56a6df2d6 100644
--- a/python/lsst/daf/butler/core/persistenceContext.py
+++ b/python/lsst/daf/butler/persistence_context.py
@@ -36,9 +36,9 @@
from typing import TYPE_CHECKING, ParamSpec, TypeVar, cast
if TYPE_CHECKING:
- from .datasets.ref import DatasetRef
- from .datasets.type import DatasetType, SerializedDatasetType
- from .datastoreRecordData import DatastoreRecordData
+ from ._dataset_ref import DatasetRef
+ from ._dataset_type import DatasetType, SerializedDatasetType
+ from .datastore.record_data import DatastoreRecordData
from .dimensions._coordinate import DataCoordinate, SerializedDataCoordinate
from .dimensions._records import DimensionRecord, SerializedDimensionRecord
diff --git a/python/lsst/daf/butler/core/progress.py b/python/lsst/daf/butler/progress.py
similarity index 100%
rename from python/lsst/daf/butler/core/progress.py
rename to python/lsst/daf/butler/progress.py
diff --git a/python/lsst/daf/butler/registries/remote.py b/python/lsst/daf/butler/registries/remote.py
index 3388866c4f..4e1be429b1 100644
--- a/python/lsst/daf/butler/registries/remote.py
+++ b/python/lsst/daf/butler/registries/remote.py
@@ -39,41 +39,37 @@
from lsst.utils.introspection import get_full_type_name
from lsst.utils.iteration import ensure_iterable
-from ..core import (
- Config,
+from .._config import Config
+from .._dataset_association import DatasetAssociation
+from .._dataset_ref import DatasetId, DatasetIdGenEnum, DatasetRef, SerializedDatasetRef
+from .._dataset_type import DatasetType, SerializedDatasetType
+from .._named import NameLookupMapping
+from .._storage_class import StorageClassFactory
+from .._timespan import Timespan
+from ..dimensions import (
DataCoordinate,
DataCoordinateSequence,
DataId,
- DatasetAssociation,
- DatasetId,
- DatasetIdGenEnum,
- DatasetRef,
- DatasetType,
Dimension,
DimensionConfig,
DimensionElement,
DimensionGraph,
DimensionRecord,
DimensionUniverse,
- NameLookupMapping,
SerializedDataCoordinate,
- SerializedDatasetRef,
- SerializedDatasetType,
SerializedDimensionRecord,
- StorageClassFactory,
- Timespan,
)
-from ..core.serverModels import (
+from ..registry import CollectionSummary, CollectionType, RegistryConfig, RegistryDefaults, _ButlerRegistry
+from ..server_models import (
DatasetsQueryParameter,
ExpressionQueryParameter,
QueryDataIdsModel,
QueryDatasetsModel,
QueryDimensionRecordsModel,
)
-from ..registry import CollectionSummary, CollectionType, RegistryConfig, RegistryDefaults, _ButlerRegistry
if TYPE_CHECKING:
- from .._butlerConfig import ButlerConfig
+ from .._butler_config import ButlerConfig
from ..registry._registry import CollectionArgType
from ..registry.interfaces import CollectionRecord, DatastoreRegistryBridgeManager
diff --git a/python/lsst/daf/butler/registries/sql.py b/python/lsst/daf/butler/registries/sql.py
index beeb20d92f..f2c769aef9 100644
--- a/python/lsst/daf/butler/registries/sql.py
+++ b/python/lsst/daf/butler/registries/sql.py
@@ -27,6 +27,8 @@
from __future__ import annotations
+from .. import ddl
+
__all__ = ("SqlRegistry",)
import contextlib
@@ -41,30 +43,25 @@
from lsst.utils.introspection import find_outside_stacklevel
from lsst.utils.iteration import ensure_iterable
-from ..core import (
- Config,
+from .._column_tags import DatasetColumnTag
+from .._config import Config
+from .._dataset_association import DatasetAssociation
+from .._dataset_ref import DatasetId, DatasetIdGenEnum, DatasetRef
+from .._dataset_type import DatasetType
+from .._named import NamedKeyMapping, NameLookupMapping
+from .._storage_class import StorageClassFactory
+from .._timespan import Timespan
+from ..dimensions import (
DataCoordinate,
DataId,
- DatasetAssociation,
- DatasetColumnTag,
- DatasetId,
- DatasetIdGenEnum,
- DatasetRef,
- DatasetType,
Dimension,
DimensionConfig,
DimensionElement,
DimensionGraph,
DimensionRecord,
DimensionUniverse,
- NamedKeyMapping,
- NameLookupMapping,
- Progress,
- StorageClassFactory,
- Timespan,
- ddl,
)
-from ..core.utils import transactional
+from ..progress import Progress
from ..registry import (
ArgumentError,
CollectionExpressionError,
@@ -87,9 +84,10 @@
from ..registry.interfaces import ChainedCollectionRecord, RunRecord
from ..registry.managers import RegistryManagerInstances, RegistryManagerTypes
from ..registry.wildcards import CollectionWildcard, DatasetTypeWildcard
+from ..utils import transactional
if TYPE_CHECKING:
- from .._butlerConfig import ButlerConfig
+ from .._butler_config import ButlerConfig
from ..registry._registry import CollectionArgType
from ..registry.interfaces import (
CollectionRecord,
diff --git a/python/lsst/daf/butler/registry/__init__.py b/python/lsst/daf/butler/registry/__init__.py
index a7ae4d0324..d3c6e5ebd6 100644
--- a/python/lsst/daf/butler/registry/__init__.py
+++ b/python/lsst/daf/butler/registry/__init__.py
@@ -28,7 +28,7 @@
from . import interfaces, managers, queries, wildcards
from ._butler_registry import _ButlerRegistry
from ._collection_summary import *
-from ._collectionType import *
+from ._collection_type import *
from ._config import *
from ._defaults import *
from ._exceptions import *
diff --git a/python/lsst/daf/butler/registry/_butler_registry.py b/python/lsst/daf/butler/registry/_butler_registry.py
index 26146fbd0d..a0f709f4a7 100644
--- a/python/lsst/daf/butler/registry/_butler_registry.py
+++ b/python/lsst/daf/butler/registry/_butler_registry.py
@@ -34,13 +34,14 @@
from lsst.resources import ResourcePathExpression
-from ..core import Config, DimensionConfig
+from .._config import Config
+from ..dimensions import DimensionConfig
from ._config import RegistryConfig
from ._defaults import RegistryDefaults
from ._registry import Registry
if TYPE_CHECKING:
- from .._butlerConfig import ButlerConfig
+ from .._butler_config import ButlerConfig
from .interfaces import CollectionRecord, DatastoreRegistryBridgeManager
diff --git a/python/lsst/daf/butler/registry/_collection_summary.py b/python/lsst/daf/butler/registry/_collection_summary.py
index 74469d2bd9..ec25789548 100644
--- a/python/lsst/daf/butler/registry/_collection_summary.py
+++ b/python/lsst/daf/butler/registry/_collection_summary.py
@@ -32,8 +32,10 @@
from collections.abc import Generator, Iterable, Mapping, Set
from typing import cast
-from ..core import DataCoordinate, DatasetRef, DatasetType
-from ..core.named import NamedValueSet
+from .._dataset_ref import DatasetRef
+from .._dataset_type import DatasetType
+from .._named import NamedValueSet
+from ..dimensions import DataCoordinate
@dataclasses.dataclass
diff --git a/python/lsst/daf/butler/registry/_collectionType.py b/python/lsst/daf/butler/registry/_collection_type.py
similarity index 100%
rename from python/lsst/daf/butler/registry/_collectionType.py
rename to python/lsst/daf/butler/registry/_collection_type.py
diff --git a/python/lsst/daf/butler/registry/_config.py b/python/lsst/daf/butler/registry/_config.py
index c814b09e31..b9c11dc7fd 100644
--- a/python/lsst/daf/butler/registry/_config.py
+++ b/python/lsst/daf/butler/registry/_config.py
@@ -33,8 +33,8 @@
from lsst.utils import doImportType
-from ..core import ConfigSubset
-from ..core.repoRelocation import replaceRoot
+from .._config import ConfigSubset
+from ..repo_relocation import replaceRoot
from .connectionString import ConnectionStringFactory
from .interfaces import Database
diff --git a/python/lsst/daf/butler/registry/_defaults.py b/python/lsst/daf/butler/registry/_defaults.py
index 01f91d61a6..a8e1e35a77 100644
--- a/python/lsst/daf/butler/registry/_defaults.py
+++ b/python/lsst/daf/butler/registry/_defaults.py
@@ -35,7 +35,7 @@
from lsst.utils.classes import immutable
-from ..core import DataCoordinate
+from ..dimensions import DataCoordinate
from ._collection_summary import CollectionSummary
from ._exceptions import MissingCollectionError
from .wildcards import CollectionWildcard
diff --git a/python/lsst/daf/butler/registry/_registry.py b/python/lsst/daf/butler/registry/_registry.py
index 12c2ae9428..30b490aebe 100644
--- a/python/lsst/daf/butler/registry/_registry.py
+++ b/python/lsst/daf/butler/registry/_registry.py
@@ -39,26 +39,24 @@
from lsst.resources import ResourcePathExpression
-from ..core import (
+from .._dataset_association import DatasetAssociation
+from .._dataset_ref import DatasetId, DatasetIdGenEnum, DatasetRef
+from .._dataset_type import DatasetType
+from .._named import NameLookupMapping
+from .._storage_class import StorageClassFactory
+from .._timespan import Timespan
+from ..dimensions import (
DataCoordinate,
DataId,
- DatasetAssociation,
- DatasetId,
- DatasetIdGenEnum,
- DatasetRef,
- DatasetType,
Dimension,
DimensionConfig,
DimensionElement,
DimensionGraph,
DimensionRecord,
DimensionUniverse,
- NameLookupMapping,
- StorageClassFactory,
- Timespan,
)
from ._collection_summary import CollectionSummary
-from ._collectionType import CollectionType
+from ._collection_type import CollectionType
from ._config import RegistryConfig
from ._defaults import RegistryDefaults
from .queries import DataCoordinateQueryResults, DatasetQueryResults, DimensionRecordQueryResults
diff --git a/python/lsst/daf/butler/registry/_registry_factory.py b/python/lsst/daf/butler/registry/_registry_factory.py
index f7bc4390b0..4cc8665fdb 100644
--- a/python/lsst/daf/butler/registry/_registry_factory.py
+++ b/python/lsst/daf/butler/registry/_registry_factory.py
@@ -34,13 +34,14 @@
from lsst.resources import ResourcePathExpression
from lsst.utils import doImportType
-from ..core import Config, DimensionConfig
+from .._config import Config
+from ..dimensions import DimensionConfig
from ._butler_registry import _ButlerRegistry
from ._config import RegistryConfig
from ._defaults import RegistryDefaults
if TYPE_CHECKING:
- from .._butlerConfig import ButlerConfig
+ from .._butler_config import ButlerConfig
class _RegistryFactory:
diff --git a/python/lsst/daf/butler/registry/attributes.py b/python/lsst/daf/butler/registry/attributes.py
index 3f15a07fb9..4e6de1abe4 100644
--- a/python/lsst/daf/butler/registry/attributes.py
+++ b/python/lsst/daf/butler/registry/attributes.py
@@ -38,7 +38,7 @@
import sqlalchemy
-from ..core.ddl import FieldSpec, TableSpec
+from ..ddl import FieldSpec, TableSpec
from .interfaces import (
ButlerAttributeExistsError,
ButlerAttributeManager,
diff --git a/python/lsst/daf/butler/registry/bridge/ephemeral.py b/python/lsst/daf/butler/registry/bridge/ephemeral.py
index 4243901a4e..a79ca8d0f8 100644
--- a/python/lsst/daf/butler/registry/bridge/ephemeral.py
+++ b/python/lsst/daf/butler/registry/bridge/ephemeral.py
@@ -32,12 +32,12 @@
from contextlib import contextmanager
from typing import TYPE_CHECKING
-from ...core import DatasetId
+from ..._dataset_ref import DatasetId
from ..interfaces import DatasetIdRef, DatastoreRegistryBridge, FakeDatasetRef, OpaqueTableStorage
if TYPE_CHECKING:
- from ...core import StoredDatastoreItemInfo
- from ...core.datastore import DatastoreTransaction
+ from ...datastore import DatastoreTransaction
+ from ...datastore.stored_file_info import StoredDatastoreItemInfo
class EphemeralDatastoreRegistryBridge(DatastoreRegistryBridge):
diff --git a/python/lsst/daf/butler/registry/bridge/monolithic.py b/python/lsst/daf/butler/registry/bridge/monolithic.py
index 635a4dec39..664d71cf95 100644
--- a/python/lsst/daf/butler/registry/bridge/monolithic.py
+++ b/python/lsst/daf/butler/registry/bridge/monolithic.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl
+
__all__ = ("MonolithicDatastoreRegistryBridgeManager", "MonolithicDatastoreRegistryBridge")
import copy
@@ -36,7 +38,8 @@
import sqlalchemy
-from ...core import NamedValueSet, StoredDatastoreItemInfo, ddl
+from ..._named import NamedValueSet
+from ...datastore.stored_file_info import StoredDatastoreItemInfo
from ..interfaces import (
DatasetIdRef,
DatastoreRegistryBridge,
@@ -49,8 +52,8 @@
from .ephemeral import EphemeralDatastoreRegistryBridge
if TYPE_CHECKING:
- from ...core import DimensionUniverse
- from ...core.datastore import DatastoreTransaction
+ from ...datastore import DatastoreTransaction
+ from ...dimensions import DimensionUniverse
from ..interfaces import (
Database,
DatasetRecordStorageManager,
diff --git a/python/lsst/daf/butler/registry/collections/_base.py b/python/lsst/daf/butler/registry/collections/_base.py
index c764bff9b5..f611cd630c 100644
--- a/python/lsst/daf/butler/registry/collections/_base.py
+++ b/python/lsst/daf/butler/registry/collections/_base.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl
+
__all__ = ()
import itertools
@@ -36,8 +38,9 @@
import sqlalchemy
-from ...core import DimensionUniverse, Timespan, TimespanDatabaseRepresentation, ddl
-from .._collectionType import CollectionType
+from ..._timespan import Timespan, TimespanDatabaseRepresentation
+from ...dimensions import DimensionUniverse
+from .._collection_type import CollectionType
from .._exceptions import MissingCollectionError
from ..interfaces import ChainedCollectionRecord, CollectionManager, CollectionRecord, RunRecord, VersionTuple
from ..wildcards import CollectionWildcard
diff --git a/python/lsst/daf/butler/registry/collections/nameKey.py b/python/lsst/daf/butler/registry/collections/nameKey.py
index 6cc4a310ca..e5e635e61c 100644
--- a/python/lsst/daf/butler/registry/collections/nameKey.py
+++ b/python/lsst/daf/butler/registry/collections/nameKey.py
@@ -26,13 +26,15 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl
+
__all__ = ["NameKeyCollectionManager"]
from typing import TYPE_CHECKING, Any
import sqlalchemy
-from ...core import TimespanDatabaseRepresentation, ddl
+from ..._timespan import TimespanDatabaseRepresentation
from ..interfaces import VersionTuple
from ._base import (
CollectionTablesTuple,
diff --git a/python/lsst/daf/butler/registry/collections/synthIntKey.py b/python/lsst/daf/butler/registry/collections/synthIntKey.py
index 3d0f0a59ea..8e49140c8d 100644
--- a/python/lsst/daf/butler/registry/collections/synthIntKey.py
+++ b/python/lsst/daf/butler/registry/collections/synthIntKey.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl
+
__all__ = ["SynthIntKeyCollectionManager"]
from collections.abc import Iterable
@@ -33,7 +35,7 @@
import sqlalchemy
-from ...core import TimespanDatabaseRepresentation, ddl
+from ..._timespan import TimespanDatabaseRepresentation
from ..interfaces import CollectionRecord, VersionTuple
from ._base import (
CollectionTablesTuple,
diff --git a/python/lsst/daf/butler/registry/databases/postgresql.py b/python/lsst/daf/butler/registry/databases/postgresql.py
index 0ce8a83461..b5bdc83189 100644
--- a/python/lsst/daf/butler/registry/databases/postgresql.py
+++ b/python/lsst/daf/butler/registry/databases/postgresql.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl, time_utils
+
__all__ = ["PostgresqlDatabase"]
from collections.abc import Iterable, Iterator, Mapping
@@ -37,8 +39,8 @@
import sqlalchemy.dialects.postgresql
from sqlalchemy import sql
-from ...core import Timespan, TimespanDatabaseRepresentation, ddl, time_utils
-from ...core.named import NamedValueAbstractSet
+from ..._named import NamedValueAbstractSet
+from ..._timespan import Timespan, TimespanDatabaseRepresentation
from ..interfaces import Database
from ..nameShrinker import NameShrinker
diff --git a/python/lsst/daf/butler/registry/databases/sqlite.py b/python/lsst/daf/butler/registry/databases/sqlite.py
index 12efc3b83b..87c78566ed 100644
--- a/python/lsst/daf/butler/registry/databases/sqlite.py
+++ b/python/lsst/daf/butler/registry/databases/sqlite.py
@@ -40,8 +40,8 @@
import sqlalchemy.dialects.sqlite
import sqlalchemy.ext.compiler
-from ...core import ddl
-from ...core.named import NamedValueAbstractSet
+from ... import ddl
+from ..._named import NamedValueAbstractSet
from ..interfaces import Database, StaticTablesContext
diff --git a/python/lsst/daf/butler/registry/datasets/byDimensions/_manager.py b/python/lsst/daf/butler/registry/datasets/byDimensions/_manager.py
index d877b0654f..d52d337a2b 100644
--- a/python/lsst/daf/butler/registry/datasets/byDimensions/_manager.py
+++ b/python/lsst/daf/butler/registry/datasets/byDimensions/_manager.py
@@ -1,5 +1,7 @@
from __future__ import annotations
+from .... import ddl
+
__all__ = ("ByDimensionsDatasetRecordStorageManagerUUID",)
import logging
@@ -10,7 +12,8 @@
import sqlalchemy
from lsst.utils.introspection import find_outside_stacklevel
-from ....core import DatasetId, DatasetIdGenEnum, DatasetRef, DatasetType, DimensionUniverse, ddl
+from ...._dataset_ref import DatasetId, DatasetIdGenEnum, DatasetRef, DatasetType
+from ....dimensions import DimensionUniverse
from ..._collection_summary import CollectionSummary
from ..._exceptions import ConflictingDefinitionError, DatasetTypeError, OrphanedRecordError
from ...interfaces import DatasetRecordStorage, DatasetRecordStorageManager, VersionTuple
diff --git a/python/lsst/daf/butler/registry/datasets/byDimensions/_storage.py b/python/lsst/daf/butler/registry/datasets/byDimensions/_storage.py
index f9a791c37e..454702b5b8 100644
--- a/python/lsst/daf/butler/registry/datasets/byDimensions/_storage.py
+++ b/python/lsst/daf/butler/registry/datasets/byDimensions/_storage.py
@@ -28,6 +28,8 @@
from __future__ import annotations
+from .... import ddl
+
__all__ = ("ByDimensionsDatasetRecordStorage",)
from collections.abc import Iterable, Iterator, Sequence, Set
@@ -38,21 +40,14 @@
import sqlalchemy
from lsst.daf.relation import Relation, sql
-from ....core import (
- DataCoordinate,
- DatasetColumnTag,
- DatasetId,
- DatasetIdFactory,
- DatasetIdGenEnum,
- DatasetRef,
- DatasetType,
- DimensionKeyColumnTag,
- LogicalColumn,
- Timespan,
- ddl,
-)
+from ...._column_tags import DatasetColumnTag, DimensionKeyColumnTag
+from ...._column_type_info import LogicalColumn
+from ...._dataset_ref import DatasetId, DatasetIdFactory, DatasetIdGenEnum, DatasetRef
+from ...._dataset_type import DatasetType
+from ...._timespan import Timespan
+from ....dimensions import DataCoordinate
from ..._collection_summary import CollectionSummary
-from ..._collectionType import CollectionType
+from ..._collection_type import CollectionType
from ..._exceptions import CollectionTypeError, ConflictingDefinitionError
from ...interfaces import DatasetRecordStorage
from ...queries import SqlQueryContext
diff --git a/python/lsst/daf/butler/registry/datasets/byDimensions/summaries.py b/python/lsst/daf/butler/registry/datasets/byDimensions/summaries.py
index c27517a8e1..1356576376 100644
--- a/python/lsst/daf/butler/registry/datasets/byDimensions/summaries.py
+++ b/python/lsst/daf/butler/registry/datasets/byDimensions/summaries.py
@@ -27,6 +27,8 @@
from __future__ import annotations
+from .... import ddl
+
__all__ = ("CollectionSummaryManager",)
from collections.abc import Iterable, Mapping
@@ -34,16 +36,11 @@
import sqlalchemy
-from ....core import (
- DatasetType,
- GovernorDimension,
- NamedKeyDict,
- NamedKeyMapping,
- addDimensionForeignKey,
- ddl,
-)
+from ...._dataset_type import DatasetType
+from ...._named import NamedKeyDict, NamedKeyMapping
+from ....dimensions import GovernorDimension, addDimensionForeignKey
from ..._collection_summary import CollectionSummary
-from ..._collectionType import CollectionType
+from ..._collection_type import CollectionType
from ...interfaces import (
ChainedCollectionRecord,
CollectionManager,
diff --git a/python/lsst/daf/butler/registry/datasets/byDimensions/tables.py b/python/lsst/daf/butler/registry/datasets/byDimensions/tables.py
index 3b3fb921c2..c5a18ad835 100644
--- a/python/lsst/daf/butler/registry/datasets/byDimensions/tables.py
+++ b/python/lsst/daf/butler/registry/datasets/byDimensions/tables.py
@@ -27,6 +27,8 @@
from __future__ import annotations
+from .... import ddl
+
__all__ = (
"addDatasetForeignKey",
"makeCalibTableName",
@@ -42,14 +44,9 @@
import sqlalchemy
-from ....core import (
- DatasetType,
- DimensionUniverse,
- GovernorDimension,
- TimespanDatabaseRepresentation,
- addDimensionForeignKey,
- ddl,
-)
+from ...._dataset_type import DatasetType
+from ...._timespan import TimespanDatabaseRepresentation
+from ....dimensions import DimensionUniverse, GovernorDimension, addDimensionForeignKey
from ...interfaces import CollectionManager, VersionTuple
DATASET_TYPE_NAME_LENGTH = 128
diff --git a/python/lsst/daf/butler/registry/dimensions/caching.py b/python/lsst/daf/butler/registry/dimensions/caching.py
index 4893f49f60..08cc829995 100644
--- a/python/lsst/daf/butler/registry/dimensions/caching.py
+++ b/python/lsst/daf/butler/registry/dimensions/caching.py
@@ -35,13 +35,8 @@
from lsst.daf.relation import Join, Relation
from lsst.utils import doImportType
-from ...core import (
- DatabaseDimensionElement,
- DataCoordinate,
- DimensionRecord,
- GovernorDimension,
- NamedKeyMapping,
-)
+from ..._named import NamedKeyMapping
+from ...dimensions import DatabaseDimensionElement, DataCoordinate, DimensionRecord, GovernorDimension
from .. import queries
from ..interfaces import (
Database,
diff --git a/python/lsst/daf/butler/registry/dimensions/governor.py b/python/lsst/daf/butler/registry/dimensions/governor.py
index 3afcf7e31f..535e0ced44 100644
--- a/python/lsst/daf/butler/registry/dimensions/governor.py
+++ b/python/lsst/daf/butler/registry/dimensions/governor.py
@@ -34,7 +34,7 @@
import sqlalchemy
from lsst.daf.relation import Relation
-from ...core import DataCoordinate, DimensionRecord, GovernorDimension
+from ...dimensions import DataCoordinate, DimensionRecord, GovernorDimension
from .. import queries
from ..interfaces import Database, GovernorDimensionRecordStorage, StaticTablesContext
diff --git a/python/lsst/daf/butler/registry/dimensions/overlaps.py b/python/lsst/daf/butler/registry/dimensions/overlaps.py
index bccee36a36..0dac7ab55e 100644
--- a/python/lsst/daf/butler/registry/dimensions/overlaps.py
+++ b/python/lsst/daf/butler/registry/dimensions/overlaps.py
@@ -27,6 +27,8 @@
from __future__ import annotations
+from ... import ddl
+
__all__ = ("CrossFamilyDimensionOverlapStorage",)
import logging
@@ -36,7 +38,7 @@
import sqlalchemy
from lsst.daf.relation import Relation
-from ...core import DatabaseDimensionElement, addDimensionForeignKey, ddl
+from ...dimensions import DatabaseDimensionElement, addDimensionForeignKey
from ..interfaces import (
Database,
DatabaseDimensionOverlapStorage,
diff --git a/python/lsst/daf/butler/registry/dimensions/query.py b/python/lsst/daf/butler/registry/dimensions/query.py
index d2c622d444..835a93b70a 100644
--- a/python/lsst/daf/butler/registry/dimensions/query.py
+++ b/python/lsst/daf/butler/registry/dimensions/query.py
@@ -34,14 +34,14 @@
import sqlalchemy
from lsst.daf.relation import Relation
-from ...core import (
+from ..._column_tags import DimensionKeyColumnTag
+from ..._named import NamedKeyMapping
+from ...dimensions import (
DatabaseDimension,
DatabaseDimensionElement,
DataCoordinate,
- DimensionKeyColumnTag,
DimensionRecord,
GovernorDimension,
- NamedKeyMapping,
)
from ..interfaces import (
Database,
diff --git a/python/lsst/daf/butler/registry/dimensions/skypix.py b/python/lsst/daf/butler/registry/dimensions/skypix.py
index 4bbb231176..6d8a03fe41 100644
--- a/python/lsst/daf/butler/registry/dimensions/skypix.py
+++ b/python/lsst/daf/butler/registry/dimensions/skypix.py
@@ -33,13 +33,8 @@
import sqlalchemy
from lsst.daf.relation import Calculation, ColumnExpression, Join, Relation
-from ...core import (
- DataCoordinate,
- DimensionKeyColumnTag,
- DimensionRecord,
- DimensionRecordColumnTag,
- SkyPixDimension,
-)
+from ..._column_tags import DimensionKeyColumnTag, DimensionRecordColumnTag
+from ...dimensions import DataCoordinate, DimensionRecord, SkyPixDimension
from ..interfaces import SkyPixDimensionRecordStorage
if TYPE_CHECKING:
diff --git a/python/lsst/daf/butler/registry/dimensions/static.py b/python/lsst/daf/butler/registry/dimensions/static.py
index dd1fa1380e..d83becd298 100644
--- a/python/lsst/daf/butler/registry/dimensions/static.py
+++ b/python/lsst/daf/butler/registry/dimensions/static.py
@@ -34,17 +34,17 @@
import sqlalchemy
from lsst.daf.relation import Relation
-from ...core import (
+from ... import ddl
+from ..._column_tags import DimensionKeyColumnTag
+from ..._named import NamedKeyDict
+from ...dimensions import (
DatabaseDimensionElement,
DatabaseTopologicalFamily,
DimensionElement,
DimensionGraph,
- DimensionKeyColumnTag,
DimensionUniverse,
GovernorDimension,
- NamedKeyDict,
SkyPixDimension,
- ddl,
)
from .._exceptions import MissingSpatialOverlapError
from ..interfaces import (
diff --git a/python/lsst/daf/butler/registry/dimensions/table.py b/python/lsst/daf/butler/registry/dimensions/table.py
index 20c999c988..ef1f3c61be 100644
--- a/python/lsst/daf/butler/registry/dimensions/table.py
+++ b/python/lsst/daf/butler/registry/dimensions/table.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl
+
__all__ = ["TableDimensionRecordStorage"]
import dataclasses
@@ -36,19 +38,18 @@
import sqlalchemy
from lsst.daf.relation import Join, Relation, sql
-from ...core import (
+from ..._column_tags import DimensionKeyColumnTag
+from ..._column_type_info import LogicalColumn
+from ..._named import NamedKeyMapping
+from ..._timespan import TimespanDatabaseRepresentation
+from ...dimensions import (
DatabaseDimensionElement,
DataCoordinate,
DimensionElement,
- DimensionKeyColumnTag,
DimensionRecord,
GovernorDimension,
- LogicalColumn,
- NamedKeyMapping,
SkyPixDimension,
- TimespanDatabaseRepresentation,
addDimensionForeignKey,
- ddl,
)
from .. import queries
from ..interfaces import (
diff --git a/python/lsst/daf/butler/registry/interfaces/_bridge.py b/python/lsst/daf/butler/registry/interfaces/_bridge.py
index 1fae425cbb..3385be21a3 100644
--- a/python/lsst/daf/butler/registry/interfaces/_bridge.py
+++ b/python/lsst/daf/butler/registry/interfaces/_bridge.py
@@ -35,12 +35,14 @@
from lsst.utils.classes import immutable
-from ...core import DatasetId, DatasetRef
+from ..._dataset_ref import DatasetId, DatasetRef
from ._versioning import VersionedExtension, VersionTuple
if TYPE_CHECKING:
- from ...core import DatasetType, DimensionUniverse, StoredDatastoreItemInfo
- from ...core.datastore import DatastoreTransaction
+ from ..._dataset_type import DatasetType
+ from ...datastore import DatastoreTransaction
+ from ...datastore.stored_file_info import StoredDatastoreItemInfo
+ from ...dimensions import DimensionUniverse
from ._database import Database, StaticTablesContext
from ._datasets import DatasetRecordStorageManager
from ._opaque import OpaqueTableStorage, OpaqueTableStorageManager
diff --git a/python/lsst/daf/butler/registry/interfaces/_collections.py b/python/lsst/daf/butler/registry/interfaces/_collections.py
index 973a2b019b..2bc5bf30c6 100644
--- a/python/lsst/daf/butler/registry/interfaces/_collections.py
+++ b/python/lsst/daf/butler/registry/interfaces/_collections.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl
+
__all__ = [
"ChainedCollectionRecord",
"CollectionManager",
@@ -38,8 +40,9 @@
from collections.abc import Iterator, Set
from typing import TYPE_CHECKING, Any
-from ...core import DimensionUniverse, Timespan, ddl
-from .._collectionType import CollectionType
+from ..._timespan import Timespan
+from ...dimensions import DimensionUniverse
+from .._collection_type import CollectionType
from ..wildcards import CollectionWildcard
from ._versioning import VersionedExtension, VersionTuple
diff --git a/python/lsst/daf/butler/registry/interfaces/_database.py b/python/lsst/daf/butler/registry/interfaces/_database.py
index 76ca1f4715..438bf55613 100644
--- a/python/lsst/daf/butler/registry/interfaces/_database.py
+++ b/python/lsst/daf/butler/registry/interfaces/_database.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl, time_utils
+
__all__ = [
"Database",
"ReadOnlyDatabaseError",
@@ -47,8 +49,8 @@
import astropy.time
import sqlalchemy
-from ...core import TimespanDatabaseRepresentation, ddl, time_utils
-from ...core.named import NamedValueAbstractSet
+from ..._named import NamedValueAbstractSet
+from ..._timespan import TimespanDatabaseRepresentation
from .._exceptions import ConflictingDefinitionError
diff --git a/python/lsst/daf/butler/registry/interfaces/_datasets.py b/python/lsst/daf/butler/registry/interfaces/_datasets.py
index 6229dfc429..3424028804 100644
--- a/python/lsst/daf/butler/registry/interfaces/_datasets.py
+++ b/python/lsst/daf/butler/registry/interfaces/_datasets.py
@@ -27,6 +27,8 @@
from __future__ import annotations
+from ... import ddl
+
__all__ = ("DatasetRecordStorageManager", "DatasetRecordStorage")
from abc import ABC, abstractmethod
@@ -35,7 +37,10 @@
from lsst.daf.relation import Relation
-from ...core import DataCoordinate, DatasetId, DatasetIdGenEnum, DatasetRef, DatasetType, Timespan, ddl
+from ..._dataset_ref import DatasetId, DatasetIdGenEnum, DatasetRef
+from ..._dataset_type import DatasetType
+from ..._timespan import Timespan
+from ...dimensions import DataCoordinate
from .._exceptions import MissingDatasetTypeError
from ._versioning import VersionedExtension, VersionTuple
diff --git a/python/lsst/daf/butler/registry/interfaces/_dimensions.py b/python/lsst/daf/butler/registry/interfaces/_dimensions.py
index db48dfc772..a5c7516c2f 100644
--- a/python/lsst/daf/butler/registry/interfaces/_dimensions.py
+++ b/python/lsst/daf/butler/registry/interfaces/_dimensions.py
@@ -42,8 +42,9 @@
import sqlalchemy
from lsst.daf.relation import Join, Relation, sql
-from ...core import (
- ColumnTypeInfo,
+from ..._column_type_info import ColumnTypeInfo, LogicalColumn
+from ..._named import NamedKeyMapping
+from ...dimensions import (
DatabaseDimensionElement,
DataCoordinate,
DimensionElement,
@@ -51,10 +52,8 @@
DimensionRecord,
DimensionUniverse,
GovernorDimension,
- LogicalColumn,
SkyPixDimension,
)
-from ...core.named import NamedKeyMapping
from ._versioning import VersionedExtension, VersionTuple
if TYPE_CHECKING:
diff --git a/python/lsst/daf/butler/registry/interfaces/_obscore.py b/python/lsst/daf/butler/registry/interfaces/_obscore.py
index 001c7afd99..30d079a3ba 100644
--- a/python/lsst/daf/butler/registry/interfaces/_obscore.py
+++ b/python/lsst/daf/butler/registry/interfaces/_obscore.py
@@ -44,7 +44,8 @@
if TYPE_CHECKING:
from lsst.sphgeom import Region
- from ...core import DatasetRef, DimensionUniverse
+ from ..._dataset_ref import DatasetRef
+ from ...dimensions import DimensionUniverse
from ..queries import SqlQueryContext
from ._collections import CollectionRecord
from ._database import Database, StaticTablesContext
diff --git a/python/lsst/daf/butler/registry/interfaces/_opaque.py b/python/lsst/daf/butler/registry/interfaces/_opaque.py
index 354bdc8940..184ee4d043 100644
--- a/python/lsst/daf/butler/registry/interfaces/_opaque.py
+++ b/python/lsst/daf/butler/registry/interfaces/_opaque.py
@@ -37,12 +37,12 @@
from collections.abc import Iterable, Iterator, Mapping
from typing import TYPE_CHECKING, Any
-from ...core.ddl import TableSpec
+from ...ddl import TableSpec
from ._database import Database, StaticTablesContext
from ._versioning import VersionedExtension, VersionTuple
if TYPE_CHECKING:
- from ...core.datastore import DatastoreTransaction
+ from ...datastore import DatastoreTransaction
class OpaqueTableStorage(ABC):
diff --git a/python/lsst/daf/butler/registry/managers.py b/python/lsst/daf/butler/registry/managers.py
index c86b39ed63..1d80fcde51 100644
--- a/python/lsst/daf/butler/registry/managers.py
+++ b/python/lsst/daf/butler/registry/managers.py
@@ -27,6 +27,8 @@
from __future__ import annotations
+from .. import ddl
+
__all__ = (
"RegistryManagerInstances",
"RegistryManagerTypes",
@@ -40,7 +42,9 @@
import sqlalchemy
from lsst.utils import doImportType
-from ..core import ColumnTypeInfo, Config, DimensionConfig, DimensionUniverse, ddl
+from .._column_type_info import ColumnTypeInfo
+from .._config import Config
+from ..dimensions import DimensionConfig, DimensionUniverse
from ._config import RegistryConfig
from .interfaces import (
ButlerAttributeManager,
diff --git a/python/lsst/daf/butler/registry/obscore/_spatial.py b/python/lsst/daf/butler/registry/obscore/_spatial.py
index 7653bb5353..95bf6fd2fa 100644
--- a/python/lsst/daf/butler/registry/obscore/_spatial.py
+++ b/python/lsst/daf/butler/registry/obscore/_spatial.py
@@ -37,7 +37,7 @@
from lsst.utils import doImportType
if TYPE_CHECKING:
- from ...core import ddl
+ from ... import ddl
from ..interfaces import Database
from ._config import SpatialPluginConfig
from ._records import Record
diff --git a/python/lsst/daf/butler/registry/obscore/default_spatial.py b/python/lsst/daf/butler/registry/obscore/default_spatial.py
index 52db6e4058..c1d363617c 100644
--- a/python/lsst/daf/butler/registry/obscore/default_spatial.py
+++ b/python/lsst/daf/butler/registry/obscore/default_spatial.py
@@ -35,7 +35,7 @@
import sqlalchemy
from lsst.sphgeom import ConvexPolygon, LonLat, Region
-from ...core import ddl
+from ... import ddl
from ._spatial import RegionTypeError, SpatialObsCorePlugin
if TYPE_CHECKING:
diff --git a/python/lsst/daf/butler/registry/obscore/pgsphere.py b/python/lsst/daf/butler/registry/obscore/pgsphere.py
index 617899888a..3106819880 100644
--- a/python/lsst/daf/butler/registry/obscore/pgsphere.py
+++ b/python/lsst/daf/butler/registry/obscore/pgsphere.py
@@ -37,7 +37,7 @@
from sqlalchemy.dialects.postgresql.base import ischema_names
from sqlalchemy.types import UserDefinedType
-from ...core import ddl
+from ... import ddl
from ._spatial import MissingDatabaseError, RegionTypeError, SpatialObsCorePlugin
if TYPE_CHECKING:
diff --git a/python/lsst/daf/butler/registry/opaque.py b/python/lsst/daf/butler/registry/opaque.py
index ffdf156841..ebced76353 100644
--- a/python/lsst/daf/butler/registry/opaque.py
+++ b/python/lsst/daf/butler/registry/opaque.py
@@ -39,7 +39,7 @@
import sqlalchemy
-from ..core.ddl import FieldSpec, TableSpec
+from ..ddl import FieldSpec, TableSpec
from .interfaces import (
Database,
OpaqueTableStorage,
@@ -49,7 +49,7 @@
)
if TYPE_CHECKING:
- from ..core.datastore import DatastoreTransaction
+ from ..datastore import DatastoreTransaction
# This has to be updated on every schema change
_VERSION = VersionTuple(0, 2, 0)
diff --git a/python/lsst/daf/butler/registry/queries/_builder.py b/python/lsst/daf/butler/registry/queries/_builder.py
index 07aab10def..c8517e04a2 100644
--- a/python/lsst/daf/butler/registry/queries/_builder.py
+++ b/python/lsst/daf/butler/registry/queries/_builder.py
@@ -33,13 +33,9 @@
from lsst.daf.relation import ColumnExpression, ColumnTag, Diagnostics, Relation
-from ...core import (
- ColumnCategorization,
- DatasetColumnTag,
- DatasetType,
- DimensionKeyColumnTag,
- DimensionRecordColumnTag,
-)
+from ..._column_categorization import ColumnCategorization
+from ..._column_tags import DatasetColumnTag, DimensionKeyColumnTag, DimensionRecordColumnTag
+from ..._dataset_type import DatasetType
from ..wildcards import CollectionWildcard
from ._query import Query
from ._query_backend import QueryBackend
diff --git a/python/lsst/daf/butler/registry/queries/_query.py b/python/lsst/daf/butler/registry/queries/_query.py
index 1df4c0dbb1..29322aaa05 100644
--- a/python/lsst/daf/butler/registry/queries/_query.py
+++ b/python/lsst/daf/butler/registry/queries/_query.py
@@ -35,19 +35,11 @@
from lsst.daf.relation import ColumnError, ColumnTag, Diagnostics, Relation, Sort, SortTerm
-from ...core import (
- DataCoordinate,
- DatasetColumnTag,
- DatasetRef,
- DatasetType,
- Dimension,
- DimensionElement,
- DimensionGraph,
- DimensionKeyColumnTag,
- DimensionRecord,
- DimensionRecordColumnTag,
-)
-from .._collectionType import CollectionType
+from ..._column_tags import DatasetColumnTag, DimensionKeyColumnTag, DimensionRecordColumnTag
+from ..._dataset_ref import DatasetRef
+from ..._dataset_type import DatasetType
+from ...dimensions import DataCoordinate, Dimension, DimensionElement, DimensionGraph, DimensionRecord
+from .._collection_type import CollectionType
from ..wildcards import CollectionWildcard
from ._query_backend import QueryBackend
from ._query_context import QueryContext
diff --git a/python/lsst/daf/butler/registry/queries/_query_backend.py b/python/lsst/daf/butler/registry/queries/_query_backend.py
index d11ad7673a..52da8d43ef 100644
--- a/python/lsst/daf/butler/registry/queries/_query_backend.py
+++ b/python/lsst/daf/butler/registry/queries/_query_backend.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import _timespan
+
__all__ = ("QueryBackend",)
from abc import abstractmethod
@@ -43,17 +45,10 @@
UnaryOperationRelation,
)
-from ...core import (
- DataCoordinate,
- DatasetColumnTag,
- DatasetType,
- DimensionGraph,
- DimensionKeyColumnTag,
- DimensionRecord,
- DimensionUniverse,
- timespan,
-)
-from .._collectionType import CollectionType
+from ..._column_tags import DatasetColumnTag, DimensionKeyColumnTag
+from ..._dataset_type import DatasetType
+from ...dimensions import DataCoordinate, DimensionGraph, DimensionRecord, DimensionUniverse
+from .._collection_type import CollectionType
from .._exceptions import DatasetTypeError, MissingDatasetTypeError
from ..wildcards import CollectionWildcard
from ._query_context import QueryContext
@@ -505,10 +500,10 @@ def make_dataset_query_relation(
and any(r.type is CollectionType.CALIBRATION for r in collections)
):
base_timespan_tag = DatasetColumnTag(dataset_type.name, "timespan")
- rhs = ColumnExpression.reference(base_timespan_tag, dtype=timespan.Timespan)
+ rhs = ColumnExpression.reference(base_timespan_tag, dtype=_timespan.Timespan)
full_columns.add("timespan")
for timespan_tag in temporal_join_on:
- lhs = ColumnExpression.reference(timespan_tag, dtype=timespan.Timespan)
+ lhs = ColumnExpression.reference(timespan_tag, dtype=_timespan.Timespan)
join_predicates.append(lhs.predicate_method("overlaps", rhs))
# Delegate to the concrete QueryBackend subclass to do most of the
# work.
diff --git a/python/lsst/daf/butler/registry/queries/_query_context.py b/python/lsst/daf/butler/registry/queries/_query_context.py
index f6dcf7a086..d9cdacadea 100644
--- a/python/lsst/daf/butler/registry/queries/_query_context.py
+++ b/python/lsst/daf/butler/registry/queries/_query_context.py
@@ -46,7 +46,9 @@
iteration,
)
-from ...core import DataCoordinate, DimensionKeyColumnTag, SkyPixDimension, Timespan
+from ..._column_tags import DimensionKeyColumnTag
+from ..._timespan import Timespan
+from ...dimensions import DataCoordinate, SkyPixDimension
class QueryContext(Processor, AbstractContextManager["QueryContext"]):
diff --git a/python/lsst/daf/butler/registry/queries/_readers.py b/python/lsst/daf/butler/registry/queries/_readers.py
index 48afdaa6f3..203e8f5f7c 100644
--- a/python/lsst/daf/butler/registry/queries/_readers.py
+++ b/python/lsst/daf/butler/registry/queries/_readers.py
@@ -39,16 +39,10 @@
from lsst.utils.classes import cached_getter
-from ...core import (
- DataCoordinate,
- DatasetColumnTag,
- DatasetRef,
- DatasetType,
- DimensionElement,
- DimensionGraph,
- DimensionKeyColumnTag,
- DimensionRecord,
-)
+from ..._column_tags import DatasetColumnTag, DimensionKeyColumnTag
+from ..._dataset_ref import DatasetRef
+from ..._dataset_type import DatasetType
+from ...dimensions import DataCoordinate, DimensionElement, DimensionGraph, DimensionRecord
if TYPE_CHECKING:
from lsst.daf.relation import ColumnTag
diff --git a/python/lsst/daf/butler/registry/queries/_results.py b/python/lsst/daf/butler/registry/queries/_results.py
index 6ae69d63ab..e26287b4ac 100644
--- a/python/lsst/daf/butler/registry/queries/_results.py
+++ b/python/lsst/daf/butler/registry/queries/_results.py
@@ -41,11 +41,11 @@
from contextlib import AbstractContextManager, ExitStack, contextmanager
from typing import Any
-from ...core import (
+from ..._dataset_ref import DatasetRef
+from ..._dataset_type import DatasetType
+from ...dimensions import (
DataCoordinate,
DataCoordinateIterable,
- DatasetRef,
- DatasetType,
DimensionElement,
DimensionGraph,
DimensionRecord,
diff --git a/python/lsst/daf/butler/registry/queries/_sql_query_backend.py b/python/lsst/daf/butler/registry/queries/_sql_query_backend.py
index dfff0a21de..db574dde44 100644
--- a/python/lsst/daf/butler/registry/queries/_sql_query_backend.py
+++ b/python/lsst/daf/butler/registry/queries/_sql_query_backend.py
@@ -33,18 +33,11 @@
from lsst.daf.relation import ColumnError, ColumnExpression, ColumnTag, Join, Predicate, Relation
-from ...core import (
- ColumnCategorization,
- DataCoordinate,
- DatasetType,
- DimensionGraph,
- DimensionKeyColumnTag,
- DimensionRecord,
- DimensionRecordColumnTag,
- DimensionUniverse,
- SkyPixDimension,
-)
-from .._collectionType import CollectionType
+from ..._column_categorization import ColumnCategorization
+from ..._column_tags import DimensionKeyColumnTag, DimensionRecordColumnTag
+from ..._dataset_type import DatasetType
+from ...dimensions import DataCoordinate, DimensionGraph, DimensionRecord, DimensionUniverse, SkyPixDimension
+from .._collection_type import CollectionType
from .._exceptions import DataIdValueError
from ..interfaces import CollectionRecord, Database
from ._query_backend import QueryBackend
diff --git a/python/lsst/daf/butler/registry/queries/_sql_query_context.py b/python/lsst/daf/butler/registry/queries/_sql_query_context.py
index 79a094c831..2bb0539ed7 100644
--- a/python/lsst/daf/butler/registry/queries/_sql_query_context.py
+++ b/python/lsst/daf/butler/registry/queries/_sql_query_context.py
@@ -53,7 +53,9 @@
sql,
)
-from ...core import ColumnTypeInfo, LogicalColumn, TimespanDatabaseRepresentation, is_timespan_column
+from ..._column_tags import is_timespan_column
+from ..._column_type_info import ColumnTypeInfo, LogicalColumn
+from ..._timespan import TimespanDatabaseRepresentation
from ..nameShrinker import NameShrinker
from ._query_context import QueryContext
from .butler_sql_engine import ButlerSqlEngine
diff --git a/python/lsst/daf/butler/registry/queries/_structs.py b/python/lsst/daf/butler/registry/queries/_structs.py
index 3c50bf0cb8..072e71bfdc 100644
--- a/python/lsst/daf/butler/registry/queries/_structs.py
+++ b/python/lsst/daf/butler/registry/queries/_structs.py
@@ -37,19 +37,11 @@
from lsst.sphgeom import IntersectionRegion, Region
from lsst.utils.classes import cached_getter, immutable
-from ...core import (
- ColumnTypeInfo,
- DataCoordinate,
- DatasetType,
- DimensionElement,
- DimensionGraph,
- DimensionKeyColumnTag,
- DimensionRecordColumnTag,
- DimensionUniverse,
- NamedValueAbstractSet,
- NamedValueSet,
- SkyPixDimension,
-)
+from ..._column_tags import DimensionKeyColumnTag, DimensionRecordColumnTag
+from ..._column_type_info import ColumnTypeInfo
+from ..._dataset_type import DatasetType
+from ..._named import NamedValueAbstractSet, NamedValueSet
+from ...dimensions import DataCoordinate, DimensionElement, DimensionGraph, DimensionUniverse, SkyPixDimension
# We're not trying to add typing to the lex/yacc parser code, so MyPy
# doesn't know about some of these imports.
diff --git a/python/lsst/daf/butler/registry/queries/butler_sql_engine.py b/python/lsst/daf/butler/registry/queries/butler_sql_engine.py
index 251b12b788..cd2dca6978 100644
--- a/python/lsst/daf/butler/registry/queries/butler_sql_engine.py
+++ b/python/lsst/daf/butler/registry/queries/butler_sql_engine.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl
+
__all__ = ("ButlerSqlEngine",)
import dataclasses
@@ -36,14 +38,9 @@
import sqlalchemy
from lsst.daf.relation import ColumnTag, Relation, Sort, UnaryOperation, UnaryOperationRelation, sql
-from ...core import (
- ColumnTypeInfo,
- LogicalColumn,
- Timespan,
- TimespanDatabaseRepresentation,
- ddl,
- is_timespan_column,
-)
+from ..._column_tags import is_timespan_column
+from ..._column_type_info import ColumnTypeInfo, LogicalColumn
+from ..._timespan import Timespan, TimespanDatabaseRepresentation
from ..nameShrinker import NameShrinker
from .find_first_dataset import FindFirstDataset
diff --git a/python/lsst/daf/butler/registry/queries/expressions/_predicate.py b/python/lsst/daf/butler/registry/queries/expressions/_predicate.py
index a6f2cc7b38..d0d70558e5 100644
--- a/python/lsst/daf/butler/registry/queries/expressions/_predicate.py
+++ b/python/lsst/daf/butler/registry/queries/expressions/_predicate.py
@@ -50,17 +50,10 @@
# We import the timespan module rather than types within it because match
# syntax uses qualified names with periods to distinguish literals from
# captures.
-from ....core import (
- ColumnTypeInfo,
- DataCoordinate,
- DatasetColumnTag,
- Dimension,
- DimensionGraph,
- DimensionKeyColumnTag,
- DimensionRecordColumnTag,
- DimensionUniverse,
- timespan,
-)
+from .... import _timespan
+from ...._column_tags import DatasetColumnTag, DimensionKeyColumnTag, DimensionRecordColumnTag
+from ...._column_type_info import ColumnTypeInfo
+from ....dimensions import DataCoordinate, Dimension, DimensionGraph, DimensionUniverse
from ..._exceptions import UserExpressionError, UserExpressionSyntaxError
from .categorize import ExpressionConstant, categorizeConstant, categorizeElementId
from .check import CheckVisitor
@@ -283,13 +276,13 @@ def visitBinaryOp(
case [
"<",
ColumnExpression(dtype=astropy.time.Time) as lhs,
- ColumnExpression(dtype=timespan.Timespan) as rhs,
+ ColumnExpression(dtype=_timespan.Timespan) as rhs,
]:
return rhs.predicate_method(self.OPERATOR_MAP[">"], lhs)
case [
">",
ColumnExpression(dtype=astropy.time.Time) as lhs,
- ColumnExpression(dtype=timespan.Timespan) as rhs,
+ ColumnExpression(dtype=_timespan.Timespan) as rhs,
]:
return rhs.predicate_method(self.OPERATOR_MAP["<"], lhs)
# Enable other comparisons between times and Timespans (many of the
@@ -297,8 +290,8 @@ def visitBinaryOp(
# covered by a preceding branch).
case [
"<" | ">",
- ColumnExpression(dtype=timespan.Timespan | astropy.time.Time) as lhs,
- ColumnExpression(dtype=timespan.Timespan | astropy.time.Time) as rhs,
+ ColumnExpression(dtype=_timespan.Timespan | astropy.time.Time) as lhs,
+ ColumnExpression(dtype=_timespan.Timespan | astropy.time.Time) as rhs,
]:
return lhs.predicate_method(self.OPERATOR_MAP[operator], rhs)
# Enable "overlaps" operations between timespans, and between times
@@ -307,20 +300,20 @@ def visitBinaryOp(
# OVERLAPS in the string expression language to keep that simple.
case [
"OVERLAPS",
- ColumnExpression(dtype=timespan.Timespan) as lhs,
- ColumnExpression(dtype=timespan.Timespan) as rhs,
+ ColumnExpression(dtype=_timespan.Timespan) as lhs,
+ ColumnExpression(dtype=_timespan.Timespan) as rhs,
]:
return lhs.predicate_method("overlaps", rhs)
case [
"OVERLAPS",
- ColumnExpression(dtype=timespan.Timespan) as lhs,
+ ColumnExpression(dtype=_timespan.Timespan) as lhs,
ColumnExpression(dtype=astropy.time.Time) as rhs,
]:
return lhs.predicate_method("overlaps", rhs)
case [
"OVERLAPS",
ColumnExpression(dtype=astropy.time.Time) as lhs,
- ColumnExpression(dtype=timespan.Timespan) as rhs,
+ ColumnExpression(dtype=_timespan.Timespan) as rhs,
]:
return rhs.predicate_method("overlaps", lhs)
# Enable arithmetic operators on numeric types, without any type
@@ -395,8 +388,8 @@ def visitIdentifier(self, name: str, node: Node) -> VisitorResult:
if column is not None:
tag = DimensionRecordColumnTag(element.name, column)
dtype = (
- timespan.Timespan
- if column == timespan.TimespanDatabaseRepresentation.NAME
+ _timespan.Timespan
+ if column == _timespan.TimespanDatabaseRepresentation.NAME
else element.RecordClass.fields.standard[column].getPythonType()
)
return ColumnExpression.reference(tag, dtype)
@@ -470,7 +463,7 @@ def visitTupleNode(self, items: tuple[VisitorResult, ...], node: Node) -> Visito
ColumnLiteral(value=begin, dtype=astropy.time.Time | types.NoneType),
ColumnLiteral(value=end, dtype=astropy.time.Time | types.NoneType),
]:
- return ColumnExpression.literal(timespan.Timespan(begin, end), dtype=timespan.Timespan)
+ return ColumnExpression.literal(_timespan.Timespan(begin, end), dtype=_timespan.Timespan)
raise ExpressionTypeError(
f'Invalid type(s) ({items[0].dtype}, {items[1].dtype}) in timespan tuple "{node}" '
'(Note that date/time strings must be preceded by "T" to be recognized).'
diff --git a/python/lsst/daf/butler/registry/queries/expressions/categorize.py b/python/lsst/daf/butler/registry/queries/expressions/categorize.py
index dd2221a7ef..dfed5c3a76 100644
--- a/python/lsst/daf/butler/registry/queries/expressions/categorize.py
+++ b/python/lsst/daf/butler/registry/queries/expressions/categorize.py
@@ -31,7 +31,7 @@
import enum
from typing import cast
-from ....core import Dimension, DimensionElement, DimensionGraph, DimensionUniverse
+from ....dimensions import Dimension, DimensionElement, DimensionGraph, DimensionUniverse
class ExpressionConstant(enum.Enum):
diff --git a/python/lsst/daf/butler/registry/queries/expressions/check.py b/python/lsst/daf/butler/registry/queries/expressions/check.py
index e2dbd553bf..de2c762d3b 100644
--- a/python/lsst/daf/butler/registry/queries/expressions/check.py
+++ b/python/lsst/daf/butler/registry/queries/expressions/check.py
@@ -36,18 +36,15 @@
from collections.abc import Mapping, Sequence, Set
from typing import TYPE_CHECKING, Any
-from ....core import (
+from ...._column_tags import DatasetColumnTag, DimensionKeyColumnTag, DimensionRecordColumnTag
+from ...._named import NamedKeyDict, NamedValueSet
+from ....dimensions import (
DataCoordinate,
DataIdValue,
- DatasetColumnTag,
Dimension,
DimensionElement,
DimensionGraph,
- DimensionKeyColumnTag,
- DimensionRecordColumnTag,
DimensionUniverse,
- NamedKeyDict,
- NamedValueSet,
)
from ..._exceptions import UserExpressionError
from .categorize import ExpressionConstant, categorizeConstant, categorizeElementId
diff --git a/python/lsst/daf/butler/registry/queries/find_first_dataset.py b/python/lsst/daf/butler/registry/queries/find_first_dataset.py
index 6d93ac4da7..ea3b14b98a 100644
--- a/python/lsst/daf/butler/registry/queries/find_first_dataset.py
+++ b/python/lsst/daf/butler/registry/queries/find_first_dataset.py
@@ -35,7 +35,7 @@
from lsst.daf.relation import ColumnTag, Relation, RowFilter, UnaryCommutator, UnaryOperationRelation
from lsst.utils.classes import cached_getter
-from ...core import DatasetColumnTag, DimensionKeyColumnTag
+from ..._column_tags import DatasetColumnTag, DimensionKeyColumnTag
@final
diff --git a/python/lsst/daf/butler/registry/tests/_database.py b/python/lsst/daf/butler/registry/tests/_database.py
index a5f98c7ae2..21a2221c89 100644
--- a/python/lsst/daf/butler/registry/tests/_database.py
+++ b/python/lsst/daf/butler/registry/tests/_database.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl
+
__all__ = ["DatabaseTests"]
import asyncio
@@ -42,7 +44,7 @@
import sqlalchemy
from lsst.sphgeom import Circle, ConvexPolygon, UnitVector3d
-from ...core import Timespan, ddl
+from ..._timespan import Timespan
from ..interfaces import Database, DatabaseConflictError, ReadOnlyDatabaseError, SchemaAlreadyDefinedError
StaticTablesTuple = namedtuple("StaticTablesTuple", ["a", "b", "c"])
diff --git a/python/lsst/daf/butler/registry/tests/_registry.py b/python/lsst/daf/butler/registry/tests/_registry.py
index d2131f2b48..445a33bb19 100644
--- a/python/lsst/daf/butler/registry/tests/_registry.py
+++ b/python/lsst/daf/butler/registry/tests/_registry.py
@@ -26,6 +26,8 @@
# along with this program. If not, see .
from __future__ import annotations
+from ... import ddl
+
__all__ = ["RegistryTests"]
import itertools
@@ -51,23 +53,15 @@
import lsst.sphgeom
from lsst.daf.relation import Relation, RelationalAlgebraError, Transfer, iteration, sql
-from ...core import (
- DataCoordinate,
- DataCoordinateSet,
- DatasetAssociation,
- DatasetIdFactory,
- DatasetIdGenEnum,
- DatasetRef,
- DatasetType,
- DimensionGraph,
- NamedValueSet,
- SkyPixDimension,
- StorageClass,
- Timespan,
- ddl,
-)
+from ..._dataset_association import DatasetAssociation
+from ..._dataset_ref import DatasetIdFactory, DatasetIdGenEnum, DatasetRef
+from ..._dataset_type import DatasetType
+from ..._named import NamedValueSet
+from ..._storage_class import StorageClass
+from ..._timespan import Timespan
+from ...dimensions import DataCoordinate, DataCoordinateSet, DimensionGraph, SkyPixDimension
from .._collection_summary import CollectionSummary
-from .._collectionType import CollectionType
+from .._collection_type import CollectionType
from .._config import RegistryConfig
from .._exceptions import (
ArgumentError,
diff --git a/python/lsst/daf/butler/registry/wildcards.py b/python/lsst/daf/butler/registry/wildcards.py
index fe28ef1f30..13e8cbac46 100644
--- a/python/lsst/daf/butler/registry/wildcards.py
+++ b/python/lsst/daf/butler/registry/wildcards.py
@@ -44,8 +44,8 @@
from lsst.daf.butler._compat import PYDANTIC_V2
from lsst.utils.iteration import ensure_iterable
-from ..core import DatasetType
-from ..core.utils import globToRegex
+from .._dataset_type import DatasetType
+from ..utils import globToRegex
from ._exceptions import CollectionExpressionError, DatasetTypeExpressionError
diff --git a/python/lsst/daf/butler/core/repoRelocation.py b/python/lsst/daf/butler/repo_relocation.py
similarity index 95%
rename from python/lsst/daf/butler/core/repoRelocation.py
rename to python/lsst/daf/butler/repo_relocation.py
index 48a359f034..3a38f22689 100644
--- a/python/lsst/daf/butler/core/repoRelocation.py
+++ b/python/lsst/daf/butler/repo_relocation.py
@@ -45,7 +45,7 @@ def replaceRoot(configRoot: str, butlerRoot: ResourcePathExpression | None) -> s
No changes are made if the special root string is not found in the
configuration entry. The name of the tag is defined in
- the module variable `~lsst.daf.butler.core.repoRelocation.BUTLER_ROOT_TAG`.
+ the module variable `~lsst.daf.butler.repoRelocation.BUTLER_ROOT_TAG`.
Parameters
----------
@@ -54,7 +54,7 @@ def replaceRoot(configRoot: str, butlerRoot: ResourcePathExpression | None) -> s
butlerRoot : `lsst.resources.ResourcePathExpression` or `None`
Butler root directory. Absolute path is inserted into the
``configRoot`` where the
- `~lsst.daf.butler.core.repoRelocation.BUTLER_ROOT_TAG` string is
+ `~lsst.daf.butler.repoRelocation.BUTLER_ROOT_TAG` string is
found. Passing `None` here is allowed only as a convenient way to
raise an exception (`ValueError`).
diff --git a/python/lsst/daf/butler/script/certifyCalibrations.py b/python/lsst/daf/butler/script/certifyCalibrations.py
index 8a4f0ddf22..6f99f0fc06 100644
--- a/python/lsst/daf/butler/script/certifyCalibrations.py
+++ b/python/lsst/daf/butler/script/certifyCalibrations.py
@@ -29,7 +29,7 @@
import astropy.time
from .._butler import Butler
-from ..core import Timespan
+from .._timespan import Timespan
from ..registry import CollectionType
diff --git a/python/lsst/daf/butler/script/configDump.py b/python/lsst/daf/butler/script/configDump.py
index fb4a533388..e3af940efd 100644
--- a/python/lsst/daf/butler/script/configDump.py
+++ b/python/lsst/daf/butler/script/configDump.py
@@ -29,7 +29,7 @@
from typing import IO
-from .._butlerConfig import ButlerConfig
+from .._butler_config import ButlerConfig
def configDump(repo: str, subset: str, searchpath: str, outfile: IO) -> None:
diff --git a/python/lsst/daf/butler/script/configValidate.py b/python/lsst/daf/butler/script/configValidate.py
index 48f462e998..83b6c0b921 100644
--- a/python/lsst/daf/butler/script/configValidate.py
+++ b/python/lsst/daf/butler/script/configValidate.py
@@ -28,7 +28,7 @@
from __future__ import annotations
from .._butler import Butler
-from ..core import ValidationError
+from .._exceptions import ValidationError
def configValidate(repo: str, quiet: bool, dataset_type: list[str], ignore: list[str]) -> bool:
diff --git a/python/lsst/daf/butler/script/createRepo.py b/python/lsst/daf/butler/script/createRepo.py
index 31c3925a69..cd98c634ea 100644
--- a/python/lsst/daf/butler/script/createRepo.py
+++ b/python/lsst/daf/butler/script/createRepo.py
@@ -27,7 +27,7 @@
from __future__ import annotations
from .._butler import Butler
-from ..core import Config
+from .._config import Config
def createRepo(
diff --git a/python/lsst/daf/butler/script/ingest_files.py b/python/lsst/daf/butler/script/ingest_files.py
index f07aa793bd..df51f25da6 100644
--- a/python/lsst/daf/butler/script/ingest_files.py
+++ b/python/lsst/daf/butler/script/ingest_files.py
@@ -37,10 +37,12 @@
from lsst.utils import doImport
from .._butler import Butler
-from ..core import DatasetIdGenEnum, DatasetRef, FileDataset
+from .._dataset_ref import DatasetIdGenEnum, DatasetRef
+from .._file_dataset import FileDataset
if TYPE_CHECKING:
- from ..core import DatasetType, DimensionUniverse
+ from .._dataset_type import DatasetType
+ from ..dimensions import DimensionUniverse
log = logging.getLogger(__name__)
diff --git a/python/lsst/daf/butler/script/queryDimensionRecords.py b/python/lsst/daf/butler/script/queryDimensionRecords.py
index 2cff39e771..8f26af86be 100644
--- a/python/lsst/daf/butler/script/queryDimensionRecords.py
+++ b/python/lsst/daf/butler/script/queryDimensionRecords.py
@@ -34,7 +34,7 @@
from astropy.table import Table
from .._butler import Butler
-from ..core import Timespan
+from .._timespan import Timespan
def queryDimensionRecords(
diff --git a/python/lsst/daf/butler/script/register_dataset_type.py b/python/lsst/daf/butler/script/register_dataset_type.py
index f0c889fd34..4de6f31a6d 100644
--- a/python/lsst/daf/butler/script/register_dataset_type.py
+++ b/python/lsst/daf/butler/script/register_dataset_type.py
@@ -29,7 +29,7 @@
__all__ = ("register_dataset_type",)
from .._butler import Butler
-from ..core import DatasetType
+from .._dataset_type import DatasetType
def register_dataset_type(
diff --git a/python/lsst/daf/butler/server.py b/python/lsst/daf/butler/server.py
index fe530d7ed5..7ee3a387f5 100644
--- a/python/lsst/daf/butler/server.py
+++ b/python/lsst/daf/butler/server.py
@@ -47,13 +47,13 @@
SerializedDatasetType,
SerializedDimensionRecord,
)
-from lsst.daf.butler.core.serverModels import (
+from lsst.daf.butler.registry import CollectionType
+from lsst.daf.butler.server_models import (
ExpressionQueryParameter,
QueryDataIdsModel,
QueryDatasetsModel,
QueryDimensionRecordsModel,
)
-from lsst.daf.butler.registry import CollectionType
BUTLER_ROOT = "ci_hsc_gen3/DATA"
diff --git a/python/lsst/daf/butler/core/serverModels.py b/python/lsst/daf/butler/server_models.py
similarity index 99%
rename from python/lsst/daf/butler/core/serverModels.py
rename to python/lsst/daf/butler/server_models.py
index d6e1a12d7d..4cb4c5e929 100644
--- a/python/lsst/daf/butler/core/serverModels.py
+++ b/python/lsst/daf/butler/server_models.py
@@ -40,10 +40,10 @@
from typing import Any, ClassVar
import pydantic
-from lsst.daf.butler._compat import PYDANTIC_V2, _BaseModelCompat
from lsst.utils.iteration import ensure_iterable
from pydantic import Field
+from ._compat import PYDANTIC_V2, _BaseModelCompat
from .dimensions import DataIdValue, SerializedDataCoordinate
from .utils import globToRegex
diff --git a/python/lsst/daf/butler/tests/_dummyRegistry.py b/python/lsst/daf/butler/tests/_dummyRegistry.py
index d2741bcd63..fae14547ee 100644
--- a/python/lsst/daf/butler/tests/_dummyRegistry.py
+++ b/python/lsst/daf/butler/tests/_dummyRegistry.py
@@ -47,7 +47,7 @@
VersionTuple,
)
-from ..core.datastore import DatastoreTransaction
+from ..datastore import DatastoreTransaction
class DummyOpaqueTableStorage(OpaqueTableStorage):
diff --git a/python/lsst/daf/butler/tests/cliLogTestBase.py b/python/lsst/daf/butler/tests/cliLogTestBase.py
index dade4e2ffa..9db3f9ee6c 100644
--- a/python/lsst/daf/butler/tests/cliLogTestBase.py
+++ b/python/lsst/daf/butler/tests/cliLogTestBase.py
@@ -52,7 +52,7 @@
from lsst.daf.butler.cli.butler import cli as butlerCli
from lsst.daf.butler.cli.cliLog import CliLog
from lsst.daf.butler.cli.utils import LogCliRunner, clickResultMsg, command_test_env
-from lsst.daf.butler.core.logging import ButlerLogRecords
+from lsst.daf.butler.logging import ButlerLogRecords
from lsst.utils.logging import TRACE
try:
@@ -285,7 +285,7 @@ def testLongLog(self) -> None:
# When longlog=False, log lines start with the module name and
# log level, for example:
- # lsst.daf.butler.core.config DEBUG: ...
+ # lsst.daf.butler.config DEBUG: ...
modulesRegex = re.compile(r".* ([a-z]+\.)+[a-z]+ [A-Z]+: .*")
with self.runner.isolated_filesystem():
diff --git a/python/lsst/daf/butler/tests/deferredFormatter.py b/python/lsst/daf/butler/tests/deferredFormatter.py
index 0e55cb0d42..c5a2c2f2be 100644
--- a/python/lsst/daf/butler/tests/deferredFormatter.py
+++ b/python/lsst/daf/butler/tests/deferredFormatter.py
@@ -31,7 +31,7 @@
from typing import Any
-from ..core import Formatter
+from .._formatter import Formatter
class DeferredFormatter(Formatter):
diff --git a/python/lsst/daf/butler/tests/testFormatters.py b/python/lsst/daf/butler/tests/testFormatters.py
index 1cea973026..f26f46c341 100644
--- a/python/lsst/daf/butler/tests/testFormatters.py
+++ b/python/lsst/daf/butler/tests/testFormatters.py
@@ -42,11 +42,11 @@
import yaml
-from ..core import Formatter
+from .._formatter import Formatter
from ..formatters.yaml import YamlFormatter
if TYPE_CHECKING:
- from ..core import Location
+ from .._location import Location
class DoNothingFormatter(Formatter):
diff --git a/python/lsst/daf/butler/core/time_utils.py b/python/lsst/daf/butler/time_utils.py
similarity index 100%
rename from python/lsst/daf/butler/core/time_utils.py
rename to python/lsst/daf/butler/time_utils.py
diff --git a/python/lsst/daf/butler/transfers/_context.py b/python/lsst/daf/butler/transfers/_context.py
index 1adadba91c..e3aef26f94 100644
--- a/python/lsst/daf/butler/transfers/_context.py
+++ b/python/lsst/daf/butler/transfers/_context.py
@@ -33,17 +33,12 @@
from collections.abc import Callable, Iterable, Set
from typing import TYPE_CHECKING
-from ..core import (
- DataCoordinate,
- DatasetAssociation,
- DatasetId,
- DatasetRef,
- DatasetType,
- Datastore,
- DimensionElement,
- DimensionRecord,
- FileDataset,
-)
+from .._dataset_association import DatasetAssociation
+from .._dataset_ref import DatasetId, DatasetRef
+from .._dataset_type import DatasetType
+from .._file_dataset import FileDataset
+from ..datastore import Datastore
+from ..dimensions import DataCoordinate, DimensionElement, DimensionRecord
from ..registry import CollectionType, _ButlerRegistry
from ..registry.interfaces import ChainedCollectionRecord, CollectionRecord
from ._interfaces import RepoExportBackend
diff --git a/python/lsst/daf/butler/transfers/_interfaces.py b/python/lsst/daf/butler/transfers/_interfaces.py
index 5dfa36c924..78c2a752eb 100644
--- a/python/lsst/daf/butler/transfers/_interfaces.py
+++ b/python/lsst/daf/butler/transfers/_interfaces.py
@@ -33,15 +33,12 @@
from collections.abc import Iterable
from typing import TYPE_CHECKING
-from ..core import (
- ConfigSubset,
- DatasetAssociation,
- DatasetType,
- Datastore,
- DimensionElement,
- DimensionRecord,
- FileDataset,
-)
+from .._config import ConfigSubset
+from .._dataset_association import DatasetAssociation
+from .._dataset_type import DatasetType
+from .._file_dataset import FileDataset
+from ..datastore import Datastore
+from ..dimensions import DimensionElement, DimensionRecord
from ..registry import CollectionType
from ..registry.interfaces import CollectionRecord
diff --git a/python/lsst/daf/butler/transfers/_yaml.py b/python/lsst/daf/butler/transfers/_yaml.py
index c2272edc73..1f88a575f9 100644
--- a/python/lsst/daf/butler/transfers/_yaml.py
+++ b/python/lsst/daf/butler/transfers/_yaml.py
@@ -43,19 +43,14 @@
from lsst.utils.introspection import find_outside_stacklevel
from lsst.utils.iteration import ensure_iterable
-from ..core import (
- DatasetAssociation,
- DatasetId,
- DatasetRef,
- DatasetType,
- Datastore,
- DimensionElement,
- DimensionRecord,
- DimensionUniverse,
- FileDataset,
- Timespan,
-)
-from ..core.named import NamedValueSet
+from .._dataset_association import DatasetAssociation
+from .._dataset_ref import DatasetId, DatasetRef
+from .._dataset_type import DatasetType
+from .._file_dataset import FileDataset
+from .._named import NamedValueSet
+from .._timespan import Timespan
+from ..datastore import Datastore
+from ..dimensions import DimensionElement, DimensionRecord, DimensionUniverse
from ..registry import CollectionType, Registry
from ..registry.interfaces import ChainedCollectionRecord, CollectionRecord, RunRecord, VersionTuple
from ..registry.versions import IncompatibleVersionError
diff --git a/python/lsst/daf/butler/core/utils.py b/python/lsst/daf/butler/utils.py
similarity index 100%
rename from python/lsst/daf/butler/core/utils.py
rename to python/lsst/daf/butler/utils.py
diff --git a/tests/config/basic/storageClasses.yaml b/tests/config/basic/storageClasses.yaml
index 6b12b4ea1c..39953256d3 100644
--- a/tests/config/basic/storageClasses.yaml
+++ b/tests/config/basic/storageClasses.yaml
@@ -100,7 +100,7 @@ storageClasses:
# Add some entries that will fail to import.
lsst.daf.butler.bad.type: lsst.daf.butler.tests.MetricsExampleModel.from_metrics
lsst.daf.butler.tests.MetricsExampleModel: lsst.daf.butler.bad.function
- lsst.daf.butler.Butler: lsst.daf.butler.core.location.__all__
+ lsst.daf.butler.Butler: lsst.daf.butler.location.__all__
MetricsConversion:
# Special storage class to test conversions with components and params.
pytype: lsst.daf.butler.tests.MetricsExampleModel
diff --git a/tests/test_butler.py b/tests/test_butler.py
index f966f17cd7..9d185221ce 100644
--- a/tests/test_butler.py
+++ b/tests/test_butler.py
@@ -80,14 +80,12 @@ def mock_s3(*args: Any, **kwargs: Any) -> Any: # type: ignore[no-untyped-def]
DatasetRef,
DatasetType,
FileDataset,
- FileTemplate,
- FileTemplateValidationError,
- NullDatastore,
StorageClassFactory,
ValidationError,
script,
)
-from lsst.daf.butler.core.repoRelocation import BUTLER_ROOT_TAG
+from lsst.daf.butler.datastore import NullDatastore
+from lsst.daf.butler.datastore.file_templates import FileTemplate, FileTemplateValidationError
from lsst.daf.butler.datastores.fileDatastore import FileDatastore
from lsst.daf.butler.registries.sql import SqlRegistry
from lsst.daf.butler.registry import (
@@ -98,6 +96,7 @@ def mock_s3(*args: Any, **kwargs: Any) -> Any: # type: ignore[no-untyped-def]
MissingCollectionError,
OrphanedRecordError,
)
+from lsst.daf.butler.repo_relocation import BUTLER_ROOT_TAG
from lsst.daf.butler.tests import MetricsExample, MultiDetectorFormatter
from lsst.daf.butler.tests.utils import TestCaseMixin, makeTestTempDir, removeTestTempDir, safeTestTempDir
from lsst.resources import ResourcePath
@@ -1302,13 +1301,13 @@ def testPutTemplates(self) -> None:
# Use a template that has a typo in dimension record metadata.
# Easier to test with a butler that has a ref with records attached.
template = FileTemplate("a/{visit.name}/{id}_{visit.namex:?}.fits")
- with self.assertLogs("lsst.daf.butler.core.fileTemplates", "INFO"):
+ with self.assertLogs("lsst.daf.butler.datastore.file_templates", "INFO"):
path = template.format(ref)
self.assertEqual(path, f"a/v423/{ref.id}_fits")
template = FileTemplate("a/{visit.name}/{id}_{visit.namex}.fits")
with self.assertRaises(KeyError):
- with self.assertLogs("lsst.daf.butler.core.fileTemplates", "INFO"):
+ with self.assertLogs("lsst.daf.butler.datastore.file_templates", "INFO"):
template.format(ref)
# Now use a file template that will not result in unique filenames
diff --git a/tests/test_composites.py b/tests/test_composites.py
index 0075bd6aaf..1be2f1ce4d 100644
--- a/tests/test_composites.py
+++ b/tests/test_composites.py
@@ -28,7 +28,8 @@
import os
import unittest
-from lsst.daf.butler import CompositesConfig, CompositesMap, DatasetType, DimensionUniverse, StorageClass
+from lsst.daf.butler import DatasetType, DimensionUniverse, StorageClass
+from lsst.daf.butler.datastore.composites import CompositesConfig, CompositesMap
TESTDIR = os.path.dirname(__file__)
diff --git a/tests/test_constraints.py b/tests/test_constraints.py
index cd0324eca3..59d079345a 100644
--- a/tests/test_constraints.py
+++ b/tests/test_constraints.py
@@ -29,7 +29,8 @@
import unittest
-from lsst.daf.butler import Constraints, ConstraintsConfig, DimensionUniverse, StorageClass, ValidationError
+from lsst.daf.butler import DimensionUniverse, StorageClass, ValidationError
+from lsst.daf.butler.datastore.constraints import Constraints, ConstraintsConfig
from lsst.daf.butler.tests import DatasetTestHelper
diff --git a/tests/test_datastore.py b/tests/test_datastore.py
index 9466c77ec2..c89ae17265 100644
--- a/tests/test_datastore.py
+++ b/tests/test_datastore.py
@@ -45,22 +45,21 @@
DataCoordinate,
DatasetIdGenEnum,
DatasetRef,
- DatasetRefURIs,
DatasetType,
DatasetTypeNotSupportedError,
Datastore,
- DatastoreCacheManager,
- DatastoreCacheManagerConfig,
- DatastoreConfig,
- DatastoreDisabledCacheManager,
- DatastoreValidationError,
DimensionUniverse,
FileDataset,
- NullDatastore,
StorageClass,
StorageClassFactory,
- StoredFileInfo,
)
+from lsst.daf.butler.datastore import DatasetRefURIs, DatastoreConfig, DatastoreValidationError, NullDatastore
+from lsst.daf.butler.datastore.cache_manager import (
+ DatastoreCacheManager,
+ DatastoreCacheManagerConfig,
+ DatastoreDisabledCacheManager,
+)
+from lsst.daf.butler.datastore.stored_file_info import StoredFileInfo
from lsst.daf.butler.formatters.yaml import YamlFormatter
from lsst.daf.butler.tests import (
BadNoWriteFormatter,
diff --git a/tests/test_dimensions.py b/tests/test_dimensions.py
index 79f469684e..46ea12a8c7 100644
--- a/tests/test_dimensions.py
+++ b/tests/test_dimensions.py
@@ -176,7 +176,7 @@ def testCompatibility(self):
clone = self.universe.dimensionConfig.copy()
clone["version"] = clone["version"] + 1_000_000 # High version number
universe_clone = DimensionUniverse(config=clone)
- with self.assertLogs("lsst.daf.butler.core.dimensions", "INFO") as cm:
+ with self.assertLogs("lsst.daf.butler.dimensions", "INFO") as cm:
self.assertTrue(self.universe.isCompatibleWith(universe_clone))
self.assertIn("differing versions", "\n".join(cm.output))
diff --git a/tests/test_logFormatter.py b/tests/test_logFormatter.py
index 723d3c867a..8f3d0a4d1d 100644
--- a/tests/test_logFormatter.py
+++ b/tests/test_logFormatter.py
@@ -35,7 +35,7 @@
from logging import FileHandler
from lsst.daf.butler import Butler, DatasetRef, DatasetType, FileDataset
-from lsst.daf.butler.core.logging import ButlerLogRecordHandler, JsonLogFormatter
+from lsst.daf.butler.logging import ButlerLogRecordHandler, JsonLogFormatter
from lsst.daf.butler.tests.utils import makeTestTempDir, removeTestTempDir
TESTDIR = os.path.abspath(os.path.dirname(__file__))
diff --git a/tests/test_logging.py b/tests/test_logging.py
index 9b0af5fc44..89f8373f18 100644
--- a/tests/test_logging.py
+++ b/tests/test_logging.py
@@ -32,7 +32,7 @@
from logging import FileHandler, StreamHandler
import lsst.utils.logging
-from lsst.daf.butler.core.logging import (
+from lsst.daf.butler.logging import (
ButlerLogRecord,
ButlerLogRecordHandler,
ButlerLogRecords,
diff --git a/tests/test_progress.py b/tests/test_progress.py
index bbdc5a11f7..57a7302d4a 100644
--- a/tests/test_progress.py
+++ b/tests/test_progress.py
@@ -33,7 +33,7 @@
import click
from lsst.daf.butler.cli.progress import ClickProgressHandler
from lsst.daf.butler.cli.utils import clickResultMsg
-from lsst.daf.butler.core.progress import Progress, ProgressHandler
+from lsst.daf.butler.progress import Progress, ProgressHandler
class MockProgressBar:
diff --git a/tests/test_quantumBackedButler.py b/tests/test_quantumBackedButler.py
index 94ac9a1473..d03166ddaa 100644
--- a/tests/test_quantumBackedButler.py
+++ b/tests/test_quantumBackedButler.py
@@ -369,7 +369,7 @@ def test_extract_provenance_data(self) -> None:
self.assertEqual(set(provenance.datastore_records.keys()), {datastore_name})
datastore_records = provenance.datastore_records[datastore_name]
self.assertEqual(set(datastore_records.dataset_ids), output_ids)
- class_name = "lsst.daf.butler.core.storedFileInfo.StoredFileInfo"
+ class_name = "lsst.daf.butler.datastore.stored_file_info.StoredFileInfo"
table_name = "file_datastore_records"
self.assertEqual(set(datastore_records.records.keys()), {class_name})
self.assertEqual(set(datastore_records.records[class_name].keys()), {table_name})
diff --git a/tests/test_storageClass.py b/tests/test_storageClass.py
index bfeedd3e04..b4ab845397 100644
--- a/tests/test_storageClass.py
+++ b/tests/test_storageClass.py
@@ -101,7 +101,7 @@ def testCreation(self):
self.assertIn("comp1", scc.components)
r = repr(scc)
self.assertIn("comp1", r)
- self.assertIn("lsst.daf.butler.core.storageClassDelegate.StorageClassDelegate", r)
+ self.assertIn("lsst.daf.butler.StorageClassDelegate", r)
# Ensure that we have a delegate
self.assertIsInstance(scc.delegate(), StorageClassDelegate)
@@ -118,9 +118,9 @@ def testCreation(self):
# Check we can create a storageClass using the name of an importable
# type.
- sc2 = StorageClass("TestImage2", "lsst.daf.butler.core.storageClass.StorageClassFactory")
+ sc2 = StorageClass("TestImage2", "lsst.daf.butler.StorageClassFactory")
self.assertIsInstance(sc2.pytype(), StorageClassFactory)
- self.assertIn("butler.core", repr(sc2))
+ self.assertIn("butler", repr(sc2))
def testParameters(self):
"""Test that we can set parameters and validate them"""
@@ -184,7 +184,7 @@ def testTypeEquality(self):
self.assertTrue(sc1.is_type(dict), repr(sc1))
self.assertFalse(sc1.is_type(str), repr(sc1))
- sc2 = StorageClass("TestImage2", "lsst.daf.butler.core.storageClass.StorageClassFactory")
+ sc2 = StorageClass("TestImage2", "lsst.daf.butler.StorageClassFactory")
self.assertTrue(sc2.is_type(StorageClassFactory), repr(sc2))
def testRegistry(self):
@@ -331,7 +331,7 @@ def testConverters(self):
# Add some entries that will fail to import.
"lsst.daf.butler.bad.type": "lsst.daf.butler.tests.MetricsExampleModel.from_metrics",
"lsst.daf.butler.tests.MetricsExampleModel": "lsst.daf.butler.bad.function",
- "lsst.daf.butler.Butler": "lsst.daf.butler.core.location.__all__",
+ "lsst.daf.butler.Butler": "lsst.daf.butler.location.__all__",
"list": get_full_type_name(self._convert_type),
}
sc = StorageClass(className, pytype=dict, converters=converters)
diff --git a/tests/test_templates.py b/tests/test_templates.py
index a2aec20627..27e14923bf 100644
--- a/tests/test_templates.py
+++ b/tests/test_templates.py
@@ -38,11 +38,13 @@
DatasetType,
DimensionGraph,
DimensionUniverse,
+ StorageClass,
+)
+from lsst.daf.butler.datastore.file_templates import (
FileTemplate,
FileTemplates,
FileTemplatesConfig,
FileTemplateValidationError,
- StorageClass,
)
TESTDIR = os.path.abspath(os.path.dirname(__file__))
diff --git a/tests/test_time_utils.py b/tests/test_time_utils.py
index 2252a43932..aedb176004 100644
--- a/tests/test_time_utils.py
+++ b/tests/test_time_utils.py
@@ -40,7 +40,7 @@
import astropy.utils.exceptions
from astropy.time import Time, TimeDelta
-from lsst.daf.butler.core.time_utils import TimeConverter
+from lsst.daf.butler.time_utils import TimeConverter
class TimeTestCase(unittest.TestCase):
diff --git a/tests/test_timespan.py b/tests/test_timespan.py
index 481a93a7fa..379017cbe0 100644
--- a/tests/test_timespan.py
+++ b/tests/test_timespan.py
@@ -40,7 +40,7 @@
erfa = None
from lsst.daf.butler import Timespan
-from lsst.daf.butler.core.time_utils import TimeConverter
+from lsst.daf.butler.time_utils import TimeConverter
class TimespanTestCase(unittest.TestCase):
diff --git a/tests/test_utils.py b/tests/test_utils.py
index d665402749..e778df6c44 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -31,7 +31,7 @@
from collections import namedtuple
from lsst.daf.butler import NamedKeyDict, NamedValueSet
-from lsst.daf.butler.core.utils import globToRegex
+from lsst.daf.butler.utils import globToRegex
TESTDIR = os.path.dirname(__file__)