Skip to content

Commit

Permalink
update dev notes
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnik512 committed Nov 23, 2024
1 parent 9733827 commit 046281b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
23 changes: 19 additions & 4 deletions docs/dev/development-notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# Development Notes
## Main decisions
1. Dependency resolving is async and sync:
- if resolving requires event loop in sync mode `RuntimeError` is raised;
- framework was developed mostly for usage with async python applications;
- sync resolving is also possible, but it will fail in runtime in case of unresolved async dependencies;
2. Resources and singletons are safe for concurrent resolving:
- in async resolving `asyncio.Lock` is used;
- in sync resolving `threading.Lock` is used;
3. No global state -> all state lives in containers:
- it's needed for scopes to work;
4. Focus on maximum compatibility with mypy:
- no need for `# type: ignore`
- no need for `typing.cast`

## Base parts
### Scope
- any int enum, starting from 1 with step 1;
Expand All @@ -9,6 +23,8 @@
- resolved dependencies;
- context stacks for resources;
- overrides;
- must have scope;
- can have link to parent container;

### Providers
- completely stateless
Expand All @@ -19,8 +35,7 @@
### Graph
- Cannot be instantiated
- Contains graph of `Providers`
- Can initialize its resources and factories to container
- Can initialize its resources and singletons to container

### Questions
1. Thread-safety
2. Configuration without global object
## Questions
1. Is configuration needed inside DI or global object is OK?
10 changes: 0 additions & 10 deletions docs/dev/main-decisions.md

This file was deleted.

0 comments on commit 046281b

Please sign in to comment.