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
22 changes: 16 additions & 6 deletions bc2/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import typing

from . import common as _common
from .common.all import AnyConfig as _AnyConfig
from .common.all import AnyIOConfig as _AnyIOConfig
from .common.all import AnyProcessingConfig as _AnyProcessingConfig
Expand All @@ -15,31 +16,40 @@
#
# We further define these with `typing.TypeAlias` to silence warnings about using
# a variable as a type.
#
# The forward references (e.g. "ChunkConfig", "ComposeConfig") are declared inside
# `bc2.core.common.all` and only become resolvable after that module's bottom-of-file
# circular-import imports complete. We therefore evaluate them against that module's
# globals rather than the globals of this module. Prior to Python 3.14 the standard
# library was more lenient about looking up forward refs (in particular it consulted
# `ForwardRef.__forward_module__` more aggressively), which is why passing this
# module's `globals()` happened to work on 3.12 but raises `NameError` on 3.14+.
_fwd_globals = vars(_common.all)

AnyConfig: typing.TypeAlias = typing.cast(
typing.Type[_AnyConfig],
typing._eval_type( # type: ignore[attr-defined]
_AnyConfig,
globals(),
locals(),
_fwd_globals,
None,
),
)

AnyProcessingConfig: typing.TypeAlias = typing.cast(
typing.Type[_AnyProcessingConfig],
typing._eval_type( # type: ignore[attr-defined]
_AnyProcessingConfig,
globals(),
locals(),
_fwd_globals,
None,
),
)

AnyIOConfig: typing.TypeAlias = typing.cast(
typing.Type[_AnyIOConfig],
typing._eval_type( # type: ignore[attr-defined]
_AnyIOConfig,
globals(),
locals(),
_fwd_globals,
None,
),
)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors = [
{name = "Alex Chohlas-Wood", email = "acw438@nyu.edu"},
]
license = {text = "MIT"}
requires-python = "<4.0,>=3.10"
requires-python = "<3.15,>=3.12"
dependencies = [
"pydantic>=2.13.4",
"pydantic-settings==2.14.0",
Expand Down
Loading
Loading