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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
python-version:
['3.10', '3.11', '3.12', '3.13', '3.14', 'pypy3.10', 'pypy3.11']
['3.10', '3.11', '3.12', '3.13', '3.14', '3.15', 'pypy3.10', 'pypy3.11']
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v8.2.0
Expand Down
17 changes: 17 additions & 0 deletions _python_utils_tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,20 @@ def test_types_all_entries_are_unique() -> None:
)

assert duplicates == []


def test_types_all_entries_exist() -> None:
"""Resolve every name in ``__all__`` so star imports keep working."""
missing: list[str] = [
name for name in types.__all__ if not hasattr(types, name)
]

assert missing == []


def test_types_star_import() -> None:
"""Import the public facade with ``from python_utils.types import *``."""
namespace: dict[str, object] = {}
exec('from python_utils.types import *', namespace) # noqa: S102

assert set(types.__all__) <= namespace.keys()
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ classifiers = [
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Programming Language :: Python :: 3.15',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
Expand Down
8 changes: 6 additions & 2 deletions python_utils/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# `from python_utils.types import datetime, decimal` worked in 3.x.
import datetime as datetime
import decimal as decimal
import sys
from re import Match, Pattern
from types import * # pragma: no cover # noqa: F403
from typing import * # pragma: no cover # noqa: F403
Expand Down Expand Up @@ -70,7 +71,6 @@
'BinaryIO',
'BuiltinFunctionType',
'BuiltinMethodType',
'ByteString',
'Callable',
# Concrete collection types.
'ChainMap',
Expand Down Expand Up @@ -168,10 +168,14 @@
'is_typeddict',
'new_class',
'no_type_check',
'no_type_check_decorator',
'overload',
'prepare_class',
'resolve_bases',
'runtime_checkable',
'timestamp_type',
]

# Python 3.15 removed these from `typing`. Exporting them there would make
# `from python_utils.types import *` raise `AttributeError`.
if sys.version_info < (3, 15): # pragma: no cover
__all__.extend(['ByteString', 'no_type_check_decorator'])
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires =
# PyPy) isn't installed; CI provides each interpreter via tox-gh-actions.
skip_missing_interpreters = true
env_list =
py{310,311,312,313,314}
py{310,311,312,313,314,315}
pypy{310,311}
lint
mypy
Expand All @@ -16,7 +16,7 @@ env_list =
docs
coverage
labels =
test = py{310,311,312,313,314}, pypy{310,311}
test = py{310,311,312,313,314,315}, pypy{310,311}
check = lint, mypy, pyright, pyrefly, codespell

[gh-actions]
Expand All @@ -26,6 +26,7 @@ python =
3.12: py312
3.13: py313
3.14: py314
3.15: py315
pypy-3.10: pypy310
pypy-3.11: pypy311

Expand Down
Loading