Skip to content

Releases: zerlok/astlab

v0.6.0

07 Mar 23:25

Choose a tag to compare

v0.6.0 Pre-release
Pre-release

v0.6.0

New Features

  • Click integration (astlab[click])

  • A new optional extra adds PythonVersionParamType, a click.ParamType for parsing Python version CLI options:

  import click
  from astlab.click import PythonVersionParamType

  @click.option("--python", type=PythonVersionParamType(), default=None)
  def generate(python):
      ...
  • The metavar displays all supported versions (e.g. 3.9|3.10|3.11|3.12|3.13|3.14) and invalid input produces a clear error message.

  • PythonVersion improvements

  • PythonVersion.get_current() — returns the PythonVersion matching the running interpreter
  • PythonVersion.get_all_supported(*, ignore_outdated_runtime=False) — iterates over all supported versions, optionally including those newer than the current runtime
  • PythonVersion.parse() now accepts None (resolves to current runtime version) and respects the ignore_outdated_runtime flag

Bug Fixes

  • Fixed typing.Union and typing.Optional not being correctly loaded, inspected, and annotated — they are now consistently represented as UnionTypeInfo
  • Fixed Optional annotation to emit Optional[X] on Python < 3.10 (instead of X | None)
  • Fixed get_metavar signature in PythonVersionParamType for Python 3.9 compatibility (click 8.3+ changed the signature on 3.10+)
  • Fixed mypy errors on Python 3.9 and 3.10 in version.py and click tests

Installation

  # Core library
  pip install astlab

  # With click integration
  pip install astlab[click]

v0.5.2

21 Dec 20:47

Choose a tag to compare

v0.5.2 Pre-release
Pre-release

New Features

  • Support for Python Version Customization
    • Introduce the PythonVersion enum to provide flexibility in specifying the desired Python version for the project's runtime.

Improvements

  • AST Generation Simplification
    • Modifications made to AST builder, default AST resolver, type loader, and annotator to adjust their behavior based on the specified Python version. This allows for generating AST code optimized for versions older than the current runtime (e.g., using astlab for Python 3.14 while generating code for Python 3.10).

v0.5.1

07 Dec 17:46

Choose a tag to compare

v0.5.1 Pre-release
Pre-release

New Features

  • Union Type Support (Python >= 3.10)
    • Introduces support for union types in the project, enabling more flexible type handling.

Improvements

  • AST Inspector Union Case
    • Modifies the AST inspector to return t.Optional[T] instead of t.Union[T, None].
  • AST Builders Refactor
    • Implemented TypeDefinitionBuilder to improve TypeRefBuilder.
    • Added _normalize_type_ref and incorporated it in builders for normalizing type references.
    • Improved type inspector support for literal and union types.
  • Test Case Refactor
    • Moved test cases related to types and builders to respective files (case_types.py, case_builder.py) using the pytest-case-provider plugin.
  • Builder Test Cases Improvement
    • Fixed Ruff issues in builder test cases.
  • AST Builders Bug Fixes
    • Various improvements and bug fixes to address issues introduced by new features in AST builders.
  • Fix Indented Flag in parse_module function
    • Corrected the parse_module function for proper handling of indented flag.
  • Compatibility Fix
    • Omitted union type support for Python 3.9 to maintain compatibility with older versions.

v0.5.0

17 Oct 23:01
c2cb227

Choose a tag to compare

v0.5.0 Pre-release
Pre-release

Release Notes

New Features

  • Added type alias AST builder with full support for defining and rendering TypeAlias constructs.
  • Introduced type variable (TypeVar) and enum support within the AST model.
  • Implemented comprehensive handling of type variables and aliases across all Python versions (<3.12 and ≥3.12).
  • Enabled forward reference resolution in AST generation, limited to Python 3.14 and above.

Improvements

  • Enhanced TypeLoader error reporting for clearer diagnostics.

  • Refactored DefaultASTResolver to use DFS post-order traversal and partially support forward references.

  • Simplified and improved ASTResolver interface:

    • Removed Expr from TypeRef alias.
    • Introduced a dedicated TypeExpr alias.
    • Removed redundant resolve_annotation method.

Documentation

  • Updated README.md to reflect new type alias, enum, and TypeVar features.
  • Bumped minor version to mark API enhancement.

Full Changelog: v0.4.5...v0.5.0

v0.4.5

15 Oct 18:24
d9c6dc2

Choose a tag to compare

v0.4.5 Pre-release
Pre-release

What's Changed

  • fix TypeInspector for type XXX = YYY expressions in python >=3.12 by @zerlok in #14

Full Changelog: v0.4.4...v0.4.5

v0.4.4

14 Oct 21:20
8665208

Choose a tag to compare

v0.4.4 Pre-release
Pre-release

Release Notes – v0.x.x

Features:

  • Added support for Python 3.14.
  • Added index and slice expression support.

Bug Fixes:

  • Fixed TypeInspector optional handling for Python 3.14 compatibility.

Dependency Updates:

  • mypy updated from 1.17.1 → 1.18.2
  • pytest updated from 8.4.1 → 8.4.2
  • pytest-cov updated from 6.2.1 → 7.0.0
  • ruff updated from 0.12.11 → 0.13.2

Other:

  • Patch version bump.

v0.4.3

25 Sep 16:58

Choose a tag to compare

v0.4.3 Pre-release
Pre-release

Release Notes – v0.4.3

Bug Fixes:

  • Fixed handling of union and None annotations.

Dependency Updates:

  • ruff updated from 0.12.7 → 0.12.11

v0.4.2

02 Aug 22:00

Choose a tag to compare

v0.4.2 Pre-release
Pre-release

Features:

  • Added await support to attribute and scope builders.

v0.4.1

02 Aug 20:17

Choose a tag to compare

v0.4.1 Pre-release
Pre-release

Features:

  • Added ModuleInfo as part of the TypeInfo union.
  • Added support for in and not in comparison expressions.

Bug Fixes:

  • Fixed mypy type issues after dependency updates.
  • Fixed mypy handling of ellipsis (...) for Python 3.9.

Dependency Updates:

  • mypy updated from 1.16.1 → 1.17.1
  • ruff updated from 0.12.1 → 0.12.7

v0.4.0

12 Jul 10:22

Choose a tag to compare

v0.4.0 Pre-release
Pre-release

Release Notes – v0.4.0

Refactoring and Code Improvements:

  • Restructured info.py into a dedicated types package.
  • Refactored BuildContext, ASTResolver, and builder.py for improved clarity and correctness.
  • Improved dependency resolution logic and import path handling.
  • Fixed TypeInspector and TypeLoader compatibility for Python versions < 3.11.
  • Resolved mypy and docstring issues to improve static analysis compatibility, including fixes for Python 3.9.

Development Dependencies Updated:

  • ruff updated from 0.9.5 → 0.9.7 → 0.11.4 → 0.12.1
  • pytest updated from 8.3.4 → 8.3.5 → 8.4.1
  • pytest-cov updated from 6.0.0 → 6.1.1 → 6.2.1
  • mypy updated from 1.15.0 → 1.16.1