python-injector / python-injector/injector
How to handle resources?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 94
- PR merge metrics
- No merged PRs in 30d
Description
Hi all,
I come from the dependency injector library, and recently I've been exploring another library to see if it could potentially replace dependency injector altogether.
I find it quite interesting, but I still have some doubts. For instance, how can I manage resource releases with this new library?
Let's consider a scenario where I have a client that needs to be released in a certain time (out of scope, raising an exception or at the end of a job to clean all resources):
def get_sqs_client_gen() -> Generator[SQSClient, None, None]:
client: Optional[SQSClient] = None
try:
client = get_sqs_client()
yield client
finally:
if client:
client.close()
Is there a provider within this library to handle such resources, or should I manually handle acquisition and release by passing it as a context manager?
Thank you for your support!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the library's provider APIs and any existing guidance for context managers or resource lifecycles. Determine whether resource acquisition and release are already supported, and whether the appropriate outcome would be a documented usage pattern or a new capability.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100