Sashimono
Tiny, explicit dependency injection for Python.
Sashimono is a minimal DI container with zero dependencies. Use it to wire values, factories, and classes with predictable singleton and transient behavior.
Quick start
from sashimono import container, singleton, transient
class Foo:
def __init__(self, number):
self.number = number
c = container()
c["number"] = singleton(5)
c[Foo] = transient(lambda c: Foo(c["number"]))
print(c[Foo].number)
# 5
Key ideas
container()behaves like a dictionary of providerssingleton(x)caches one instancetransient(x)returns a fresh value each time- raw values are wrapped as singletons automatically
- keys can be strings or types
Scoped wiring
Use scope to isolate temporary bindings:
from sashimono import scope, provide, inject
with scope():
provide("user", "alice")
print(inject("user"))
Why use Sashimono?
- tiny API, easy to understand
- explicit wiring instead of magic
- no external dependencies
- useful for small apps, scripts, and portable libraries
Happy coding! 👋
Metadata
Release files for sashimono 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sashimono-2.0.0.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sashimono-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / sashimono-2.0.0.tar.gz
| Download URL | sashimono-2.0.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fd4506248cf063acfa0ef5089bc043e2c8525cb1ec12a0f0373f5bef0bdce88
|
|
BLAKE2b-256 checksum How to use checksums |
5bdc358d5330ef600bbacc51992fc20452c5a7deeeeee864f4b083ab554c44fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|
Release files / sashimono-2.0.0-py3-none-any.whl
| Download URL | sashimono-2.0.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78c96bf3b8166daed9f078da5df0f620d0f7df695c0e682d7cbf563d95e1c6c7
|
|
BLAKE2b-256 checksum How to use checksums |
0d7ad181b3cc9ba53e9c931881d6e863b5f3a00864ad15681585ab83487b1f71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|