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

Remove legacy extension api #1637

Merged
merged 23 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f322d09
switch BulitinExtension check to check for core extensions
braingram Aug 28, 2023
04f2503
remove check for BuiltinExtension
braingram Aug 28, 2023
3f90a48
remove test_tag_without_schema CustomType test
braingram Aug 28, 2023
a05300f
update test_nonexistent_tag test to not use old api
braingram Aug 28, 2023
4eb6a13
remove test_get_default_resolver
braingram Aug 28, 2023
5f6617d
update test_schema_resolved_via_entry_points to use new api
braingram Aug 28, 2023
1ee2c5c
remove legacy extension entry point
braingram Aug 28, 2023
b606690
remove default resolver
braingram Aug 28, 2023
bf741a4
remove assert_extension_correctness
braingram Aug 28, 2023
ad42d66
remove proxying of AsdfExtension
braingram Aug 29, 2023
107fe40
remove deprecated get_cached_asdf_extension_list and _legacy.default_…
braingram Aug 29, 2023
9e57c0a
remove BuiltinExtension
braingram Aug 29, 2023
e93c0b0
remove AsdfExtensionList
braingram Aug 29, 2023
3178b69
remove extension._legacy
braingram Aug 29, 2023
14b3376
remove BuiltinExtension class name kludge
braingram Aug 29, 2023
fa8955b
remove _resolver
braingram Aug 29, 2023
3728478
remove _tests.objects
braingram Aug 29, 2023
4fa22b8
remove _type_index
braingram Aug 29, 2023
5036b84
remove _types
braingram Aug 29, 2023
ad9499c
update changelog
braingram Aug 29, 2023
f3e3afc
ignore missing BuiltinExtension
braingram Aug 31, 2023
0bb89bf
cleanup after rebase
braingram Sep 20, 2023
fbcc1f9
use legacy_class_names instead of ignoring missing BuiltinExtension
braingram Sep 20, 2023
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
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The ASDF Standard is at v1.6.0

- Add support for python 3.12 [#1641]
- Move IntegerType to converter and drop cache of converted values. [#1527]
- Remove legacy extension API [#1637]

2.15.1 (2023-08-07)
-------------------
Expand Down
171 changes: 0 additions & 171 deletions asdf/_resolver.py

This file was deleted.

43 changes: 3 additions & 40 deletions asdf/_tests/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@

import asdf
from asdf import generic_io, versioning
from asdf._resolver import Resolver, ResolverChain
from asdf.asdf import AsdfFile, get_asdf_library_info
from asdf.constants import YAML_TAG_PREFIX
from asdf.exceptions import AsdfConversionWarning, AsdfDeprecationWarning
from asdf.extension import _legacy
from asdf.exceptions import AsdfConversionWarning
from asdf.tags.core import AsdfObject
from asdf.versioning import (
AsdfVersion,
Expand Down Expand Up @@ -97,20 +95,14 @@ def assert_tree_match(old_tree, new_tree, ctx=None, funcname="assert_equal", ign
ignore_keys = ["asdf_library", "history"]
ignore_keys = set(ignore_keys)

if ctx is None:
version_string = str(versioning.default_version)
ctx = _legacy.default_extensions.extension_list
else:
version_string = ctx.version_string

def recurse(old, new):
if id(old) in seen or id(new) in seen:
return
seen.add(id(old))
seen.add(id(new))

old_type = ctx._type_index.from_custom_type(type(old), version_string)
new_type = ctx._type_index.from_custom_type(type(new), version_string)
old_type = None
new_type = None

if (
old_type is not None
Expand Down Expand Up @@ -418,35 +410,6 @@ def assert_no_warnings(warning_class=None):
)


def assert_extension_correctness(extension):
"""
Assert that an ASDF extension's types are all correctly formed and
that the extension provides all of the required schemas.

Parameters
----------
extension : asdf._AsdfExtension
The extension to validate
"""
__tracebackhide__ = True

warnings.warn(
"assert_extension_correctness is deprecated and depends "
"on the deprecated type system. Please use the new "
"extension API: "
"https://asdf.readthedocs.io/en/stable/asdf/extending/converters.html",
AsdfDeprecationWarning,
)

resolver = ResolverChain(
Resolver(extension.tag_mapping, "tag"),
Resolver(extension.url_mapping, "url"),
)

for extension_type in extension.types:
_assert_extension_type_correctness(extension, extension_type, resolver)


def _assert_extension_type_correctness(extension, extension_type, resolver):
__tracebackhide__ = True

Expand Down
6 changes: 4 additions & 2 deletions asdf/_tests/commands/tests/test_extension.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

from asdf.commands import find_extensions
from asdf.versioning import supported_versions


@pytest.mark.parametrize("summary", [True, False])
Expand All @@ -10,7 +11,8 @@ def test_parameter_combinations(summary, tags_only):
find_extensions(summary, tags_only)


def test_builtin_extension_included(capsys):
@pytest.mark.parametrize("standard_version", supported_versions)
def test_builtin_extension_included(capsys, standard_version):
find_extensions(True, False)
captured = capsys.readouterr()
assert "asdf.extension.BuiltinExtension" in captured.out
assert f"core-{standard_version}" in captured.out
2 changes: 0 additions & 2 deletions asdf/_tests/commands/tests/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ def test_all_tags_present():
tags = {line.strip() for line in iostream.readlines()}

af = AsdfFile()
for tag in af._type_index._type_by_tag:
assert tag in tags
for tag in af.extension_manager._converters_by_tag:
assert tag in tags
11 changes: 0 additions & 11 deletions asdf/_tests/data/custom_flow-1.0.0.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions asdf/_tests/data/custom_flow-1.1.0.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions asdf/_tests/data/custom_style-1.0.0.yaml

This file was deleted.

55 changes: 0 additions & 55 deletions asdf/_tests/data/default-1.0.0.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions asdf/_tests/data/foreign_tag_reference-1.0.0.yaml

This file was deleted.

Loading
Loading