Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop bundling configobj #122

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
==================

- Update style and linting checking [#103]
- Fix regex issue in internal configobj [#108]
- Remove bundled ``configobj`` package in favor of the ``configobj`` package
bundled into ``astropy``. [#122]

0.5.1 (2023-10-02)
==================
Expand All @@ -11,7 +14,6 @@
- Move ``strun`` to entrypoints [#101]
- Deprecate ``preserve_comments`` fix spec parsing for inline comments with
a closing parenthesis [#107]
- Fix regex issue in internal configobj [#108]

0.5.0 (2023-04-19)
==================
Expand Down
8 changes: 0 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ addopts = [
"-ra",
"--color=yes"
]
norecursedirs = [
'src/stpipe/extern',
]
testpaths = [
'tests',
]
Expand All @@ -96,7 +93,6 @@ src = [
line-length = 88
extend-exclude = [
'docs',
'src/stpipe/extern',
'scripts/strun',
]

Expand Down Expand Up @@ -156,14 +152,10 @@ force-exclude = '''
| \.git
| \.pytest_cache
| \.tox
| src/stpipe/extern
)/
)
'''

[tool.flynt]
exclude = ["src/stpipe/extern/*"]

[tool.codespell]
skip="*.pdf,*.fits,*.asdf,.tox,build,./tags,.git,docs/_build"
# ignore-words-list="""
Expand Down
12 changes: 6 additions & 6 deletions src/stpipe/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

from asdf import ValidationError as AsdfValidationError
from asdf import open as asdf_open

from . import utilities
from .config import StepConfig
from .datamodel import AbstractDataModel
from .extern.configobj.configobj import (
from astropy.extern.configobj.configobj import (
ConfigObj,
Section,
flatten_errors,
get_extra_values,
)
from .extern.configobj.validate import ValidateError, Validator, VdtTypeError
from astropy.extern.configobj.validate import ValidateError, Validator, VdtTypeError

from . import utilities
from .config import StepConfig
from .datamodel import AbstractDataModel
from .utilities import _not_set

# Configure logger
Expand Down Expand Up @@ -70,9 +70,9 @@
path = os.path.join(root_dir, path)

path = os.path.abspath(path)
dir_ = os.path.dirname(path)
if dir_ and not os.path.exists(dir_):
os.makedirs(dir_)

Check warning on line 75 in src/stpipe/config_parser.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/config_parser.py#L73-L75

Added lines #L73 - L75 were not covered by tests

return path

Expand All @@ -84,7 +84,7 @@
if isinstance(value, AbstractDataModel):
return value

raise VdtTypeError(value)

Check warning on line 87 in src/stpipe/config_parser.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/config_parser.py#L87

Added line #L87 was not covered by tests


def _is_string_or_datamodel(value):
Expand All @@ -94,10 +94,10 @@
if isinstance(value, AbstractDataModel):
return value

if isinstance(value, str):

Check warning on line 97 in src/stpipe/config_parser.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/config_parser.py#L97

Added line #L97 was not covered by tests
return value

raise VdtTypeError(value)

Check warning on line 100 in src/stpipe/config_parser.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/config_parser.py#L100

Added line #L100 was not covered by tests


def load_config_file(config_file):
Expand Down Expand Up @@ -361,7 +361,7 @@
config[key] = spec[key]
continue

err = "missing"

Check warning on line 364 in src/stpipe/config_parser.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/config_parser.py#L364

Added line #L364 was not covered by tests

messages.append(f"Config parameter {section_string!r}: {err}")

Expand Down
8 changes: 0 additions & 8 deletions src/stpipe/extern/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
"""
This package contains python package(s) that are bundled with jwst but are
external to jwst, and hence are developed in a separate source tree.

Currently the bundled external dependencies are:

.. _ConfigObj: https://github.com/DiffSK/configobj
"""
20 changes: 20 additions & 0 deletions src/stpipe/extern/configobj.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import inspect
import sys
import warnings

Check warning on line 3 in src/stpipe/extern/configobj.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/extern/configobj.py#L1-L3

Added lines #L1 - L3 were not covered by tests

from astropy.extern import configobj

Check warning on line 5 in src/stpipe/extern/configobj.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/extern/configobj.py#L5

Added line #L5 was not covered by tests

# Add submodules to system modules so they are available under the same path
for mod in inspect.getmembers(configobj, inspect.ismodule):

Check warning on line 8 in src/stpipe/extern/configobj.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/extern/configobj.py#L8

Added line #L8 was not covered by tests
# add as a local variable
locals()[mod[0]] = mod[1]

Check warning on line 10 in src/stpipe/extern/configobj.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/extern/configobj.py#L10

Added line #L10 was not covered by tests
# Add the submodule to the system modules so it can be imported
sys.modules[f"stpipe.extern.configobj.{mod[0]}"] = mod[1]

Check warning on line 12 in src/stpipe/extern/configobj.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/extern/configobj.py#L12

Added line #L12 was not covered by tests


warnings.warn(

Check warning on line 15 in src/stpipe/extern/configobj.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/extern/configobj.py#L15

Added line #L15 was not covered by tests
"stpipe.extern.configobj is deprecated in favor of astropy.extern.configobj, "
"please use that instead.",
DeprecationWarning,
stacklevel=2,
)
Empty file.
Loading
Loading