Skip to content
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
5 changes: 4 additions & 1 deletion .github/workflows/test-upstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: pipx install poetry
run: pipx install poetry==1.*

- name: Check Poetry version
run: poetry --version

- name: Install dynamic versioning plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![PyPIDownloadsMonth](https://img.shields.io/pypi/dm/linkml-runtime?logo=PyPI&color=blue)](https://pypi.org/project/linkml-runtime)
[![codecov](https://codecov.io/gh/linkml/linkml-runtime/branch/main/graph/badge.svg?token=FOBHNSK5WG)](https://codecov.io/gh/linkml/linkml-runtime)

Runtime support for linkml generated data classes
Runtime support for linkml generated data classes.

## About

Expand Down
15 changes: 15 additions & 0 deletions linkml_runtime/utils/dataclass_extensions_376.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import sys
import warnings
import dataclasses

warnings.warn(
"The LinkML dataclass extension patch is deprecated and will be removed in a future release.\n"
"If you're currently using Python < 3.13, where this patch still applies, you should:\n"
" • Upgrade your LinkML tooling to version >= 1.9.0 (which no longer needs this patch), OR\n"
" • Migrate to Pydantic models if you're using LinkML's generated classes at runtime.\n",
DeprecationWarning,
stacklevel=2
)

dataclasses_init_fn_with_kwargs = dataclasses._init_fn
DC_CREATE_FN = False
27 changes: 27 additions & 0 deletions tests/test_issues/test_dataclass_extensions_376.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import sys
import pytest
import importlib.util
import dataclasses


def import_patch_module():
"""Fresh import to ensure warning is triggered"""
spec = importlib.util.find_spec("linkml_runtime.utils.dataclass_extensions_376")
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
return mod

def test_patch_module_emits_deprecation_warning():
"""All Python versions: emits DeprecationWarning and defines compatibility symbols"""
with pytest.warns(DeprecationWarning):
mod = import_patch_module()

assert hasattr(mod, "DC_CREATE_FN")
assert hasattr(mod, "dataclasses_init_fn_with_kwargs")
assert mod.DC_CREATE_FN is False

# Check consistency with actual dataclasses module
init_fn = getattr(dataclasses, "_init_fn", None)
assert mod.dataclasses_init_fn_with_kwargs == init_fn