Skip to content

Commit f50029d

Browse files
authored
Fix import of deprecated() annotation on Python >= 3.13 (#107)
* Run all CI jobs to completion even if some fails * Fix import of `deprecated()` annotation on Python >= 3.13 It is part of the `warnings` module, not the `typing` module. Fixes #106
1 parent fa05ac0 commit f50029d

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
pytest:
2121
runs-on: ubuntu-latest
2222
strategy:
23+
fail-fast: false
2324
matrix:
2425
python-version:
2526
- "3.10"
@@ -39,6 +40,7 @@ jobs:
3940
mypy:
4041
runs-on: ubuntu-latest
4142
strategy:
43+
fail-fast: false
4244
matrix:
4345
python-version: ["3.10", "3.11", "3.12", "3.13"]
4446
steps:
@@ -53,6 +55,7 @@ jobs:
5355
pyright:
5456
runs-on: ubuntu-latest
5557
strategy:
58+
fail-fast: false
5659
matrix:
5760
python-version: ["3.10", "3.11", "3.12", "3.13"]
5861
steps:

docs/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 25.4.2 - 2025-04-16
4+
- Fix import of `@deprecated()` annotation on Python >= 3.13. It is part of the `warnings` module, not the `typing` module. Fixes [issue #106]. [PR #107]
5+
36
## 25.4.1 - 2025-04-12
47
- Add the `Renderable` protocol, a consistent API to render an `htpy` object as HTML or to iterate over it. `Element`, `Fragment`, `ContextProvider`, and `ContextConsumer` are all `Renderable`. [PR #92](https://github.com/pelme/htpy/pull/92). Thanks to [Stein Magnus Jodal (@jodal)](https://github.com/jodal) and [Dave Peck (@davepeck)](https://github.com/davepeck).
58
- Deprecate `render_node()` and `iter_node()` and direct iteration over elements. Call `Renderable.__str__()` or `Renderable.iter_chunks()` instead. [Read the Usage docs for more details](usage.md#renderable).

htpy/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from markupsafe import escape as _escape
1111

1212
try:
13-
from typing import deprecated # type: ignore[attr-defined]
13+
from warnings import deprecated # type: ignore[attr-defined,unused-ignore]
1414
except ImportError:
1515
from typing_extensions import deprecated
1616

@@ -135,7 +135,7 @@ class ContextProvider(t.Generic[T]):
135135
value: T
136136
node: Node
137137

138-
@deprecated(
138+
@deprecated( # type: ignore[misc,unused-ignore]
139139
"iterating over a context provider is deprecated and will be removed in a future release. "
140140
"Please use the context_provider.iter_chunks() method instead."
141141
) # pyright: ignore [reportUntypedFunctionDecorator]
@@ -203,7 +203,7 @@ def wrapper(*args: P.args, **kwargs: P.kwargs) -> ContextConsumer[T]:
203203
return wrapper
204204

205205

206-
@deprecated(
206+
@deprecated( # type: ignore[misc,unused-ignore]
207207
"iter_node is deprecated and will be removed in a future release. "
208208
"Please use the .iter_chunks() method on elements/fragments instead."
209209
) # pyright: ignore [reportUntypedFunctionDecorator]
@@ -306,7 +306,7 @@ def __call__(self: BaseElementSelf, *args: t.Any, **kwargs: t.Any) -> BaseElemen
306306
self._children,
307307
)
308308

309-
@deprecated(
309+
@deprecated( # type: ignore[misc,unused-ignore]
310310
"iterating over an element is deprecated and will be removed in a future release. "
311311
"Please use the element.iter_chunks() method instead."
312312
) # pyright: ignore [reportUntypedFunctionDecorator]
@@ -386,7 +386,7 @@ def __init__(self) -> None:
386386
# node directly via the constructor.
387387
self._node: Node = None
388388

389-
@deprecated(
389+
@deprecated( # type: ignore[misc,unused-ignore]
390390
"iterating over a fragment is deprecated and will be removed in a future release. "
391391
"Please use the fragment.iter_chunks() method instead."
392392
) # pyright: ignore [reportUntypedFunctionDecorator]
@@ -419,7 +419,7 @@ def _chunks_as_markup(renderable: Renderable) -> _Markup:
419419
return _Markup("".join(renderable.iter_chunks()))
420420

421421

422-
@deprecated(
422+
@deprecated( # type: ignore[misc,unused-ignore]
423423
"render_node is deprecated and will be removed in a future release. "
424424
"Please use fragment instead: https://htpy.dev/usage/#fragments"
425425
) # pyright: ignore [reportUntypedFunctionDecorator]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ requires-python = ">=3.10"
55
dynamic = ["version"]
66
dependencies = [
77
"markupsafe>=2.0.0",
8-
# typing_extensions is used for @typing.deprecated introduced in Python 3.13
8+
# typing_extensions is used for @warnings.deprecated introduced in Python 3.13
99
"typing_extensions>=4.13.2 ; python_version<'3.13'",
1010
]
1111
readme = "docs/README.md"

0 commit comments

Comments
 (0)