Skip to content

Commit 8c11e6c

Browse files
committed
Remove some deprecated code
1 parent 02917cf commit 8c11e6c

File tree

6 files changed

+21
-135
lines changed

6 files changed

+21
-135
lines changed

docs/releases/development.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,7 @@ Next release (in development)
5151
By dropping geometry the results are more consistent across all conventions
5252
and do not contain potentially fragmented geometry information.
5353
(:issue:`106`, :pr:`146`).
54+
* Remove support for the deprecated `emsarray.formats` module,
55+
the `emsarray.formats` entry point,
56+
and filtered warnings for old dependencies no longer supported
57+
(:pr:`146`).

pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ addopts = [
9797
testpaths = ["tests"]
9898
filterwarnings = [
9999
"error",
100-
"ignore:GeometryTypeError will derive from ShapelyError:shapely.errors.ShapelyDeprecationWarning",
101-
# xarray.backends.plugins uses a deprecated interface
102-
# Fixed in xarray >= v2022.06.0
103-
"ignore:SelectableGroups dict interface is deprecated. Use select.:DeprecationWarning",
104100
]
105101
markers = [
106102
"matplotlib: Tests that involve matplotlib and plotting",

src/emsarray/conventions/_registry.py

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
import warnings
32
from collections.abc import Iterable
43
from contextlib import suppress
54
from functools import cached_property
@@ -138,35 +137,23 @@ def entry_point_conventions() -> Iterable[type[Convention]]:
138137
Finds conventions registered using entry points
139138
"""
140139
seen = set()
141-
142-
groups = [
143-
('emsarray.conventions', False),
144-
('emsarray.formats', True),
145-
]
146-
for group, deprecated in groups:
147-
entry_points = metadata.entry_points(group=group)
148-
149-
for entry_point in entry_points:
150-
if deprecated:
151-
warnings.warn(
152-
'`emsarray.formats` entrypoint has been renamed to `emsarray.conventions`. '
153-
f'Update `{entry_point.name} = {entry_point.value}` to use the new entrypoint name.',
154-
category=DeprecationWarning)
155-
try:
156-
obj = entry_point.load()
157-
except (AttributeError, ImportError):
158-
logger.exception("Error loading entry point %s", entry_point)
159-
continue
160-
161-
if not (isinstance(obj, type) and issubclass(obj, Convention)):
162-
logger.error(
163-
"Entry point `%s = %s` refers to %r not a Convention subclass",
164-
entry_point.name, entry_point.value, obj)
165-
continue
166-
167-
if obj not in seen:
168-
yield obj
169-
seen.add(obj)
140+
entry_points = metadata.entry_points(group='emsarray.conventions')
141+
for entry_point in entry_points:
142+
try:
143+
obj = entry_point.load()
144+
except (AttributeError, ImportError):
145+
logger.exception("Error loading entry point %s", entry_point)
146+
continue
147+
148+
if not (isinstance(obj, type) and issubclass(obj, Convention)):
149+
logger.error(
150+
"Entry point `%s = %s` refers to %r not a Convention subclass",
151+
entry_point.name, entry_point.value, obj)
152+
continue
153+
154+
if obj not in seen:
155+
yield obj
156+
seen.add(obj)
170157

171158

172159
def register_convention(convention: type[Convention]) -> type[Convention]:

src/emsarray/formats.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

tests/conventions/test_registry.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"""
44
from importlib import metadata
55

6-
import pytest
7-
86
from emsarray.conventions import (
97
ArakawaC, CFGrid1D, CFGrid2D, ShocSimple, ShocStandard, UGrid, _registry
108
)
@@ -84,23 +82,6 @@ def test_mock_entry_points(caplog, monkeypatch):
8482
assert len(caplog.records) == 0
8583

8684

87-
def test_mock_entry_points_deprecated(caplog, monkeypatch):
88-
monkeypatch_entrypoint(monkeypatch, {
89-
'emsarray.conventions': [
90-
('CFGrid1D', 'emsarray.conventions.grid:CFGrid1D'),
91-
],
92-
'emsarray.formats': [
93-
('CFGrid2D', 'emsarray.conventions.grid:CFGrid2D'),
94-
],
95-
})
96-
with pytest.warns(DeprecationWarning) as captured_warnings:
97-
assert list(entry_point_conventions()) == [CFGrid1D, CFGrid2D]
98-
assert str(captured_warnings[0].message) == (
99-
'`emsarray.formats` entrypoint has been renamed to `emsarray.conventions`. '
100-
'Update `CFGrid2D = emsarray.conventions.grid:CFGrid2D` to use the new entrypoint name.')
101-
assert len(caplog.records) == 0
102-
103-
10485
def test_mock_entry_points_duplicate(caplog, monkeypatch):
10586
monkeypatch_entrypoint(monkeypatch, {'emsarray.conventions': [
10687
('CFGrid1D', 'emsarray.conventions.grid:CFGrid1D'),

tests/test_formats.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)