Skip to content

refactor: Update ScopedInjectable to use SlotKey for caching logic#294

Merged
remimd merged 1 commit intodevfrom
scope
Nov 24, 2025
Merged

refactor: Update ScopedInjectable to use SlotKey for caching logic#294
remimd merged 1 commit intodevfrom
scope

Conversation

@remimd
Copy link
Copy Markdown
Member

@remimd remimd commented Nov 24, 2025

No description provided.

Copy link
Copy Markdown

Copilot AI left a 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 refactors the ScopedInjectable class to use SlotKey instances as cache keys instead of using the injectable instance itself (self). This architectural improvement better separates concerns by decoupling the cache key from the injectable instance.

Key Changes

  • Added a key: SlotKey[T] field to ScopedInjectable for use as the cache key
  • Updated all cache-related method calls to use self.key instead of self
  • Updated type signatures in scope.py to properly reflect that SlotKey[Any] is the cache key type
  • Updated dependency versions: secretstorage (3.4.1 → 3.5.0) and type-analyzer (0.1.0 → 0.1.1)

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
uv.lock Updates secretstorage from 3.4.1 to 3.5.0 and type-analyzer from 0.1.0 to 0.1.1
injection/_core/scope.py Updates type signatures for in_scope_cache, remove_scoped_values, and cache fields to use SlotKey[Any] as the key type
injection/_core/injectables.py Adds key: SlotKey[T] field to ScopedInjectable and updates all cache operations to use self.key instead of self

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@remimd remimd merged commit 8ad8760 into dev Nov 24, 2025
12 checks passed
@remimd remimd deleted the scope branch November 24, 2025 09:08
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