Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove aiocache.Cache and alias support #948

Merged
merged 13 commits into from
Jan 18, 2025

Conversation

mikeoconnor0308
Copy link
Contributor

What do these changes do?

Removes factory.py and associated factory tooling. Updates all the tests and documentation to reflect the changes.

Added a Migration guide to start documenting the changes for a v1 release.

Are there changes in behavior for the user?

  • The aiocache.Cache class has been removed. Instead, use the specific cache class directly. For example, use aiocache.RedisCache instead of aiocache.Cache.REDIS.
  • Caches should be fully instantiated when passed to decorators, rather than being instantiated with a factory function
  • Cache aliases have been removed. Create an instance of the cache class directly instead.

Related issue number

Closes #677

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

aiocache/__init__.py Outdated Show resolved Hide resolved
docs/index.rst Outdated Show resolved Hide resolved
docs/v1_migration.rst Outdated Show resolved Hide resolved
Copy link
Member

@Dreamsorcerer Dreamsorcerer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking at this. Seems to a very thorough PR.

Co-authored-by: Sam Bull <aa6bs0@sambull.org>
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 96.38554% with 3 lines in your changes missing coverage. Please review.

Project coverage is 99.64%. Comparing base (fe28c47) to head (7962e33).
Report is 114 commits behind head on master.

Files with missing lines Patch % Lines
tests/performance/server.py 70.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #948      +/-   ##
==========================================
- Coverage   99.76%   99.64%   -0.12%     
==========================================
  Files          36       33       -3     
  Lines        3794     3396     -398     
==========================================
- Hits         3785     3384     -401     
- Misses          9       12       +3     
Flag Coverage Δ
unit 99.64% <96.38%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
aiocache/__init__.py 100.00% <100.00%> (ø)
aiocache/decorators.py 100.00% <100.00%> (ø)
tests/acceptance/conftest.py 100.00% <100.00%> (ø)
tests/acceptance/test_decorators.py 100.00% <100.00%> (ø)
tests/performance/conftest.py 100.00% <100.00%> (ø)
tests/ut/conftest.py 100.00% <ø> (ø)
tests/ut/test_decorators.py 100.00% <100.00%> (ø)
tests/performance/server.py 92.85% <70.00%> (-7.15%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce1efa9...7962e33. Read the comment docs.

@mikeoconnor0308 mikeoconnor0308 marked this pull request as ready for review January 10, 2025 21:11
@mikeoconnor0308
Copy link
Contributor Author

@Dreamsorcerer could you run the lint again?

@Dreamsorcerer
Copy link
Member

Yep, sorry, missed the last change.

@mikeoconnor0308
Copy link
Contributor Author

Apologies - some bad testing on my part, but also the linter on CI is different to make lint.

We should update the docs with precommit support and add a make format (but not in this PR).

Please run the lint again @Dreamsorcerer , it should be good now.

@Dreamsorcerer
Copy link
Member

We should update the docs with precommit support and add a make format (but not in this PR).

Yeah, that'd be good. Also hoping to find some time to start some org-wide work on this stuff in future, so we can keep all repos in sync.

examples/multicached_decorator.py Outdated Show resolved Hide resolved
examples/multicached_decorator.py Outdated Show resolved Hide resolved
examples/frameworks/aiohttp_example.py Outdated Show resolved Hide resolved
examples/frameworks/aiohttp_example.py Outdated Show resolved Hide resolved
examples/alt_key_builder.py Outdated Show resolved Hide resolved
examples/alt_key_builder.py Outdated Show resolved Hide resolved
examples/alt_key_builder.py Outdated Show resolved Hide resolved
examples/alt_key_builder.py Outdated Show resolved Hide resolved
examples/alt_key_builder.py Outdated Show resolved Hide resolved
examples/alt_key_builder.py Outdated Show resolved Hide resolved
@Dreamsorcerer Dreamsorcerer merged commit 67f367b into aio-libs:master Jan 18, 2025
15 of 16 checks passed
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.

Remove factory
2 participants