Skip to content

chore: Reintroduce Python 3.11 support#3

Merged
Yolley merged 1 commit intoYolley:mainfrom
nahua-aignx:chore/reintroduce-python-311-support
Jan 28, 2026
Merged

chore: Reintroduce Python 3.11 support#3
Yolley merged 1 commit intoYolley:mainfrom
nahua-aignx:chore/reintroduce-python-311-support

Conversation

@nahua-aignx
Copy link
Copy Markdown

Hello @Yolley, first of all thank you for forking and creating this package. My team is currently looking for a package that supports dynamic TTL calculation and distributed locking and fastapi-cache2-fork satisfies these needs. Unfortunately, some of our services are still on py3.11.

I took a quick look and the code changes to bring back py3.11 support should be minimal, e.g. dec_hook[T] → dec_hook which uses the TypeVar that's still available in the coder.py module. The rest I could found would just be config changes (pyproject.toml, tox.ini, CI matrix).

May I ask if you'd be open to a PR to restore Python 3.11 support? Thanks in any case!

@Yolley
Copy link
Copy Markdown
Owner

Yolley commented Jan 28, 2026

Hey, thank you for contribution, I'll merge the changes, but then also make some adjustments and make a release.

  • we also use new generic syntax in Cached, so we should also fallback to old syntax there;
  • python3.11 does not have markcoroutinefunction, and also I didn't find a proper way to make inspect.iscoroutinefunction recognize Cached decorator as a coroutine. I think I found a workaround, but it will work only for asyncio.iscoroutinefunction sadly;
  • also I found a bug with type annotations that I need to fix - cached technically does support sync functions, but we annotate only async functions as decorator argument, so I need to fix this.

@Yolley Yolley merged commit f94e5b0 into Yolley:main Jan 28, 2026
1 check passed
@nahua-aignx
Copy link
Copy Markdown
Author

It seems due to my lack of familiarity with the code changes that I underestimated the scope of changes. I'd like to apologize and reiterate my thanks for your time and help here!

@Yolley
Copy link
Copy Markdown
Owner

Yolley commented Jan 29, 2026

@nahua-aignx 2.3.0 is released with 3.11 support https://pypi.org/project/fastapi-cache2-fork/

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.

2 participants