Version 2.0.0
2.0.0 (16 March 2026) — "Six impossible things before breakfast" edition:
IMPORTANT:
- Python version support: 3.10–3.14 (dropped 3.8, 3.9; added 3.13, 3.14). PyPy 3.11.
- If you need
unpythonicfor Python 3.8 or 3.9, use version 1.0.0.
- If you need
- Requires mcpyrate >= 4.0.0.
- mcpyrate 4.0.0 dropped the
Str,Num,NameConstantAST compatibility shims and thegetconstanthelper. Useast.Constantdirectly, and.valueto get the constant's value.
- mcpyrate 4.0.0 dropped the
New:
- Python 3.13 and 3.14 support.
autoreturnmacro now handlesmatch/casestatements. Each case branch has its own tail position.- New scope analyzer tests for
match/casepatterns andtry/except*. - New
unpythonic.test.runnermodule: reusable test runner with module discovery, version-suffix gating (e.g.test_foo_3_11.pyskipped on Python < 3.11), and integration with the test framework's warning system. Other projects usingunpythonic.test.fixturescan import it directly. - New
emit_warning()function inunpythonic.test.fixturesfor signaling test warnings from infrastructure code (outsidetest[]/warn[]macros). Used by the test runner for version-suffix skips, which show in the warning count for the innermost enclosing testset. - Missing optional dependencies (sympy, mpmath) in tests emit
warn[]instead oferror[], correctly reflecting that these are expected skips, not failures. - Runtime type checker (
unpythonic.typecheck): new supported typing features —NoReturn,Never(3.11+),Literal,Type,ClassVar,Final,DefaultDict,OrderedDict,Counter,ChainMap,IO/TextIO/BinaryIO(mapped toiomodule ABCs),Pattern[T]/Match[T](string type checked when parametric),ContextManager,AsyncContextManager,Awaitable,Coroutine,AsyncIterable,AsyncIterator,Generator,AsyncGenerator. - Runtime type checker:
TypedDictsupport — structural checking of required/optional keys and value types. - Runtime type checker:
Protocolsupport —@runtime_checkableProtocols work viaisinstance; non-runtime-checkable Protocols raiseTypeErrorwith an actionable message. - Runtime type checker: parametric forms of abstract ABCs —
Iterable[T],Collection[T],Reversible[T]perform best-effort element checking (elements checked when value isSized; ABC-only for opaque iterators).Iterator[T]andContainer[T]accept parametric form with type arg silently ignored (iterating anIteratorwould consume it;Containeronly has__contains__, so elements can't be enumerated).
Fixed:
- Runtime type checker (
unpythonic.typecheck): fixed compatibility with Python 3.14, wheretyping.Unionis no longer a_GenericAlias. Now usestyping.get_origin(available since 3.8). - Runtime type checker: fixed
TypeVardetection to useisinstance(T, typing.TypeVar)instead of a fragilerepr-based heuristic. - Runtime type checker:
typing.Reversiblecheck now usesisinstanceinstead of ahasattr("__reversed__")workaround from the Python 3.5 era. - Runtime type checker: removed redundant
safeissubclassfallbacks for generic types —typing.get_originhandles both bare and parameterized generics on 3.10+. - Scope analyzer: fixed
MatchCapturesCollectorbug where class references (e.g.Pointincase Point(x, y):) were incorrectly collected as captured variable names. - Macro layer: updated all
hasattr(tree, "ctx")checks to usegetattrwith defaults, for correct behavior on Python 3.13+ where AST fields always exist with default values.- Important: Since Python 3.13, the default of
ctxisLoad(), hence no AST node has itsctxin a "not set yet" state anymore. Hence, any macro-createdNamenodes that appear in aStoreorDelposition MUST have theirctxset appropriately by the macro author. Failing to do so will cause mysterious errors during macro expansion.
- Important: Since Python 3.13, the default of
- Macro layer: updated
arguments()constructor calls to always includeposonlyargs=[], avoiding aDeprecationWarningon Python 3.13 (will become an error in 3.15). - MS Windows:
unpythonic.net.utilfailed to load, due to missingtermiosmodule (which is *nix only) being loaded byunpythonic.net.__init__when it importsunpythonic.net.ptyproxy.- Fixed by catching
ModuleNotFoundError, disablingptyproxyon MS Windows systems. Thus the remote REPL functionalityunpythonic.net.client/serveris not available on MS Windows, but the rest ofunpythonicworks fine.
- Fixed by catching
Deprecated:
- Parenthesis syntax for macro arguments (e.g.
let((x, 1), (y, 2))). Use bracket syntax instead:let[[x, 1], [y, 2]]. The parenthesis syntax is kept for backward compatibility for now. - Runtime type checker:
typing.Text(deprecated since Python 3.11) andtyping.ByteString(deprecated since Python 3.12) support is now marked for removal when the floor bumps to Python 3.12.