Injección de dependencias para python
Project description
Probando injection dependency
Librareria para la inyección de dependencias para python
Porqué usarlo ?
Pues esta librerÃa está hecha para proyectos pequeños que no necesiten testear la applicación o que quieran probar la inyección de dependencias
Cómo usarlo ?
Aquà es un ejemplo de inyección de forma global con la librerÃa
from injectdep import global_module
@global_module.register
class MyDB:
def find_all():
return ["Jhon", "Pepe", "Carlos"]
def main(db: MyDB):
results = db.find_all()
print(results) # ["Jhon", "Pepe", "Carlos"]
if __name__ == "__main__":
injected = global_module.inject(main)
injected()
Puede construir su propio módulo
from injectdep import Module
database_module = Module()
@database_module.register
class MyDB:
def find_all():
return ["Jhon", "Pepe", "Carlos"]
def main(db: MyDB):
results = db.find_all()
print(results) # ["Jhon", "Pepe", "Carlos"]
if __name__ == "__main__":
injected = database_module.inject(main)
injected()
Inspirado en AngularModules
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file injectdep-0.0.1.tar.gz.
File metadata
- Download URL: injectdep-0.0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb9fa7c1b61115d17815d18fcda563204edb1c8d53af4d641c7a6aa64a3c9de9
|
|
| MD5 |
9ba48f6db928e32269189f587c5bd338
|
|
| BLAKE2b-256 |
9e0fc2a5aedb1c5f31d69d881417027453c20cf1ebcf4610984f3f2c9802add7
|
File details
Details for the file injectdep-0.0.1-py3.11.egg.
File metadata
- Download URL: injectdep-0.0.1-py3.11.egg
- Upload date:
- Size: 4.9 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a12153ba99f44f00edd3ab2935cd11caa1de9b159472c9ca995c470259d8893c
|
|
| MD5 |
0679d79b9cab10f13b2e97a50db6ba88
|
|
| BLAKE2b-256 |
167f3a2bd4579a2b301a97da0034050ea3cb9b6de599fb4f4e1253fdf8ce350c
|
File details
Details for the file injectdep-0.0.1-py3-none-any.whl.
File metadata
- Download URL: injectdep-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad86f959e92ad62e36112ab4e6aa062d58e814fb9d06f4d13693d5e877765f5c
|
|
| MD5 |
052d162e3738c499e9650a3dafd0617c
|
|
| BLAKE2b-256 |
4fffafe7d51739b13680f507678ae538e18b743760bee887a2f6445001019796
|