-
Notifications
You must be signed in to change notification settings - Fork 32
🎨 Updates all aiohttp state application keys from string-based keys to type-safe web.AppKey instances
#8405
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
🎨 Updates all aiohttp state application keys from string-based keys to type-safe web.AppKey instances
#8405
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #8405 +/- ##
==========================================
+ Coverage 87.38% 87.82% +0.44%
==========================================
Files 1953 1526 -427
Lines 76047 63401 -12646
Branches 1341 679 -662
==========================================
- Hits 66452 55683 -10769
+ Misses 9194 7482 -1712
+ Partials 401 236 -165
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
🧪 CI InsightsHere's what we observed from your CI run for 63de04f. 🟢 All jobs passed!But CI Insights is watching 👀 |
1d3bf93 to
c56a1e1
Compare
aiohttp state application keys from string-based keys to type-safe web.AppKey instances
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates all aiohttp application keys from string-based keys to type-safe web.AppKey instances as recommended by aiohttp for enhanced type safety and mypy support. The change enables mypy to properly type-check app key access and provides better IDE support.
Key changes:
- Replace string-based application keys with
web.AppKeyinstances throughout the codebase - Import path updates: move from
servicelibto local relative imports for constants - Define keys with specific types where possible (e.g.,
Engine,ClientSession,RedisClientsManager)
Reviewed Changes
Copilot reviewed 113 out of 113 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| services/web/server/src/simcore_service_webserver/constants.py | Define type-safe application keys using web.AppKey |
| services/web/server/src/simcore_service_webserver/application_setup.py | Create wrapper for servicelib app setup with proper app settings key |
| Multiple plugin files | Update imports to use relative paths and new app setup function |
| Multiple service files | Replace string key imports with type-safe key imports |
| packages/service-library/src/servicelib/aiohttp/application_keys.py | Update to use web.AppKey for type safety |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
services/api-server/src/simcore_service_api_server/api/dependencies/rabbitmq.py
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/invitations/_client.py
Outdated
Show resolved
Hide resolved
… in multiple modules
…tings_key parameter
cb4c368 to
d5dca47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and you forgot to say that it will reduce the zillion warnings in the webserver
|
|
@mergify queue |
🛑 Configuration not compatible with a branch protection settingThe branch protection setting |



What do these changes do?
This PR updates all application keys from string-based keys to type-safe
web.AppKeyinstances as recommended byaiohttpfor type safety. In other words, this means thatmypywill recognize the type of the value returned by thatapp's state.This is the pattern used
Before:
After:
Type Improvements
Where possible, we've used specific types instead of generic
object:APP_AIOPG_ENGINE_KEYusesEngine(from aiopg)APP_CLIENT_SESSION_KEYusesaiohttp.ClientSessionAPP_DOCKER_ENGINE_KEYusesaiodocker.DockerAPP_REDIS_CLIENT_KEYusesRedisClientsManagerAPP_CONFIG_KEYusesdict[str, object]APP_JSON_SCHEMA_SPECS_KEYusesdict[str, object]APP_FIRE_AND_FORGET_TASKS_KEYusesset[object]APP_SLOW_CALLBACKS_MONITOR_KEYusesLimitedOrderedStack[SlowCallback]Benefits
Related issue/s
How to test
mypywill consider also types returned byapp[SOME_KEY]