From 187bf176dd09fec8aa67b42200156d8a493f877a Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Fri, 9 Jan 2026 16:55:17 -0700 Subject: [PATCH 1/2] Modify applyConfigOverrides to be able to use ResourcePath URIs --- python/lsst/pipe/base/_instrument.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/lsst/pipe/base/_instrument.py b/python/lsst/pipe/base/_instrument.py index 16c74a531..bd2f19f5c 100644 --- a/python/lsst/pipe/base/_instrument.py +++ b/python/lsst/pipe/base/_instrument.py @@ -31,7 +31,6 @@ import contextlib import datetime -import os.path from abc import ABCMeta, abstractmethod from collections.abc import Sequence from typing import TYPE_CHECKING, Any, Self, cast, final @@ -39,6 +38,7 @@ from lsst.daf.butler import DataCoordinate, DataId, DimensionPacker, DimensionRecord, Formatter from lsst.daf.butler.registry import DataIdError from lsst.pex.config import Config, RegistryField +from lsst.resources import ResourcePath, ResourcePathExpression from lsst.utils import doImportType from lsst.utils.introspection import get_full_type_name @@ -65,7 +65,7 @@ class Instrument(metaclass=ABCMeta): the base class. """ - configPaths: Sequence[str] = () + configPaths: Sequence[ResourcePathExpression] = () """Paths to config files to read for specific Tasks. The paths in this list should contain files of the form `task.py`, for @@ -366,9 +366,10 @@ def applyConfigOverrides(self, name: str, config: Config) -> None: Config instance to which overrides should be applied. """ for root in self.configPaths: - path = os.path.join(root, f"{name}.py") - if os.path.exists(path): - config.load(path) + resource = ResourcePath(root, forceDirectory=True, forceAbsolute=True) + uri = resource.join(f"{name}.py", forceDirectory=False) + if uri.exists(): + config.load(uri) @staticmethod def formatCollectionTimestamp(timestamp: str | datetime.datetime) -> str: From 6b8e12c2043402246ab929265d4d11d15ffc8c51 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Mon, 12 Jan 2026 14:35:27 -0700 Subject: [PATCH 2/2] Add news fragment --- doc/changes/DM-33226.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changes/DM-33226.misc.rst diff --git a/doc/changes/DM-33226.misc.rst b/doc/changes/DM-33226.misc.rst new file mode 100644 index 000000000..a81334c22 --- /dev/null +++ b/doc/changes/DM-33226.misc.rst @@ -0,0 +1 @@ +The ``Instrument.configPaths`` property can now refer to ``lsst.resources.ResourcePath`` URIs as well as strings (paths or URI strings).