Metadata-Version: 2.4
Name: sashimono
Version: 2.0.0
Summary: A lean dependency injection container
Author-email: Jesús Enrique Fuentes González <jesusefg12@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Jesús Enrique Fuentes González
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest-cov>=6.0.0; extra == "dev"
Requires-Dist: pytest>=8.3.4; extra == "dev"
Dynamic: license-file

# Sashimono

![Coverage Status](https://github.com/gaspect/sashimono/actions/workflows/coverage.yml/badge.svg) [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)

> 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

```python
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 providers
- `singleton(x)` caches one instance
- `transient(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:

```python
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! 👋
