Skip to content

feat: ✨ Add threadsafe parameter for LazyInstance#252

Merged
remimd merged 1 commit intodevfrom
threadsafe
May 26, 2025
Merged

feat: ✨ Add threadsafe parameter for LazyInstance#252
remimd merged 1 commit intodevfrom
threadsafe

Conversation

@remimd
Copy link
Copy Markdown
Member

@remimd remimd commented May 26, 2025

No description provided.

@remimd remimd requested a review from Copilot May 26, 2025 14:11
@remimd remimd self-assigned this May 26, 2025
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 introduces a new parameter, threadsafe, to the LazyInstance functionality in order to allow clients to opt‑in to using thread‑safe lazy initialization via the module’s get_lazy_instance API.

  • Added a threadsafe parameter (defaulting to False) to the LazyInstance implementation in descriptors and its type signatures in the stubs
  • Updated the basic usage documentation to reflect the use of threading.RLock for threadsafe injection

Reviewed Changes

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

File Description
injection/_core/descriptors.py Updated init to pass the new threadsafe flag
injection/init.pyi Adjusted LazyInstance type annotations to include threadsafe
documentation/basic-usage.md Modified documentation to note that RLock is now used

Comment thread injection/_core/descriptors.py
Comment thread documentation/basic-usage.md
@remimd remimd merged commit 56affd9 into dev May 26, 2025
5 checks passed
@remimd remimd deleted the threadsafe branch May 26, 2025 14:13
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