Skip to content

fix: relax docstring-parser constraint to support Python 3.14#319

Open
umutonuryasar wants to merge 1 commit into
andrewyng:mainfrom
umutonuryasar:fix/python-3.14-support
Open

fix: relax docstring-parser constraint to support Python 3.14#319
umutonuryasar wants to merge 1 commit into
andrewyng:mainfrom
umutonuryasar:fix/python-3.14-support

Conversation

@umutonuryasar

Copy link
Copy Markdown

aisuite fails on import on Python 3.14 with:
AttributeError: module 'ast' has no attribute 'NameConstant'

This is caused by the docstring-parser dependency. Version 0.15 relies on ast.NameConstant, ast.Str, and ast.Num, which were deprecated since Python 3.8 and removed entirely in Python 3.14.

pyproject.toml pinned docstring-parser with a caret constraint:

docstring-parser = { version = "^0.15.0" }

Under Poetry's semantics for 0.x versions, ^0.15.0 resolves to >=0.15.0,<0.16.0, so the resolver could never pick up a release with the fix (the deprecated ast classes were removed in a later 0.x release; current latest is 0.18.0).

Relax the constraint to >=0.16,<1.0, allowing resolution to 0.18.0, which removes the deprecated ast usage. poetry.lock regenerated accordingly (docstring-parser 0.15 → 0.18.0).

Verified:

  • import aisuite as ai succeeds with no AttributeError or DeprecationWarning.
  • Full test suite: 348 passed, 1 skipped (pre-existing failures from missing optional extras such as mcp/cohere/deepgram are unaffected and identical with/without this change).

Fixes #265

aisuite fails on import on Python 3.14 with:
    AttributeError: module 'ast' has no attribute 'NameConstant'

This is caused by the docstring-parser dependency. Version 0.15 relies
on ast.NameConstant, ast.Str, and ast.Num, which were deprecated since
Python 3.8 and removed entirely in Python 3.14.

pyproject.toml pinned docstring-parser with a caret constraint:
    docstring-parser = { version = "^0.15.0" }

Under Poetry's semantics for 0.x versions, ^0.15.0 resolves to
>=0.15.0,<0.16.0, so the resolver could never pick up a release with
the fix (the deprecated ast classes were removed in a later 0.x
release; current latest is 0.18.0).

Relax the constraint to >=0.16,<1.0, allowing resolution to 0.18.0,
which removes the deprecated ast usage. poetry.lock regenerated
accordingly (docstring-parser 0.15 -> 0.18.0).

Verified:
- `import aisuite as ai` succeeds with no AttributeError or
  DeprecationWarning.
- Full test suite: 348 passed, 1 skipped (pre-existing failures from
  missing optional extras such as mcp/cohere/deepgram are unaffected
  and identical with/without this change).

Fixes andrewyng#265
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python 3.14 support

1 participant