diff --git a/CHANGES.rst b/CHANGES.rst index de057088..35832c60 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,12 +3,12 @@ - Remove use of deprecated ``pytest-openfiles`` ``pytest`` plugin. This has been replaced by catching ``ResourceWarning`` s. [#90] - - Start using ``pre-commit`` to handle style checks. [#79] - Apply the ``isort`` and ``black`` code formatters and reduce the line length maximum to 88 characters. [#80] - Add spell checking through the ``codespell`` tool. [#81] - Drop support for Python 3.8 [#93] +- Remove ``stdatamodels`` dependency, as it is no longer used. [#91] 0.4.6 (2023-03-27) ================== diff --git a/pyproject.toml b/pyproject.toml index 45d200f7..3ee4ac07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ dependencies = [ 'asdf>=2.13', 'crds>=7.4.1.3', 'astropy>=5.0.4', - 'stdatamodels>=0.2.4', 'importlib_metadata>=4.11.4', ] dynamic = ['version'] diff --git a/src/stpipe/config_parser.py b/src/stpipe/config_parser.py index d4301aae..7c69fb3c 100644 --- a/src/stpipe/config_parser.py +++ b/src/stpipe/config_parser.py @@ -9,7 +9,6 @@ from asdf import ValidationError as AsdfValidationError from asdf import open as asdf_open -from stdatamodels import s3_utils from . import utilities from .config import StepConfig @@ -102,13 +101,6 @@ def load_config_file(config_file): """ Read the file `config_file` and return the parsed configuration. """ - if s3_utils.is_s3_uri(config_file): - return _load_config_file_s3(config_file) - else: - return _load_config_file_filesystem(config_file) - - -def _load_config_file_filesystem(config_file): if not os.path.isfile(config_file): raise ValueError(f"Config file {config_file} not found.") try: @@ -121,22 +113,6 @@ def _load_config_file_filesystem(config_file): return ConfigObj(config_file, raise_errors=True) -def _load_config_file_s3(config_file): - if not s3_utils.object_exists(config_file): - raise ValueError(f"Config file {config_file} not found.") - - content = s3_utils.get_object(config_file) - try: - with asdf_open(content) as asdf_file: - return _config_obj_from_asdf(asdf_file) - except (AsdfValidationError, ValueError): - logger.debug( - "Config file did not parse as ASDF. Trying as ConfigObj: %s", config_file - ) - content.seek(0) - return ConfigObj(content, raise_errors=True) - - def _config_obj_from_asdf(asdf_file): config = StepConfig.from_asdf(asdf_file) return _config_obj_from_step_config(config) diff --git a/src/stpipe/crds_client.py b/src/stpipe/crds_client.py index b8ed83ff..24b44ad8 100644 --- a/src/stpipe/crds_client.py +++ b/src/stpipe/crds_client.py @@ -12,7 +12,6 @@ import crds from crds.core import config, crds_cache_locking, heavy_client, log from crds.core.exceptions import CrdsError -from stdatamodels import s3_utils __all__ = [ "check_reference_open", @@ -33,7 +32,7 @@ def get_multiple_reference_paths(parameters, reference_file_types, observatory): ---------- parameters : dict Parameters used by CRDS to compute best references. Can - be obtained from `~stdatamodels.DataModel.get_crds_parameters`. + be obtained from `DataModel.get_crds_parameters`. reference_file_types : list of str List of reference file types. @@ -81,12 +80,8 @@ def check_reference_open(refpath): Ignore reference path values of "N/A" or "" for checking. """ if refpath != "N/A" and refpath.strip() != "": - if s3_utils.is_s3_uri(refpath): - if not s3_utils.object_exists(refpath): - raise RuntimeError("S3 object does not exist: " + refpath) - else: - with open(refpath, "rb"): - pass + with open(refpath, "rb"): + pass return refpath diff --git a/src/stpipe/extern/configobj/validate.py b/src/stpipe/extern/configobj/validate.py index f0d10d62..bfe728ee 100644 --- a/src/stpipe/extern/configobj/validate.py +++ b/src/stpipe/extern/configobj/validate.py @@ -163,9 +163,6 @@ import re import sys -from pprint import pprint - -from stdatamodels import DataModel #TODO - #21 - six is part of the repo now, but we didn't switch over to it here # this could be replaced if six is used for compatibility, or there are no