# 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
```py
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
```py
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()
```
<p align="center">Inspirado en AngularModules</p>
Raw data
{
"_id": null,
"home_page": "https://github.com/jbuendia1y/py-injectdep",
"name": "injectdep",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,injection,dependency,jbuendia1y,library",
"author": "jbuendia1y - jbuendia1y@gmail.com",
"author_email": "jbuendia1y@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9e/0f/c2a5aedb1c5f31d69d881417027453c20cf1ebcf4610984f3f2c9802add7/injectdep-0.0.1.tar.gz",
"platform": null,
"description": "# Probando injection dependency\r\n\r\nLibrareria para la inyecci\u00c3\u00b3n de dependencias para python\r\n\r\n## Porqu\u00c3\u00a9 usarlo ?\r\n\r\nPues esta librer\u00c3\u00ada est\u00c3\u00a1 hecha para proyectos peque\u00c3\u00b1os que no necesiten testear la applicaci\u00c3\u00b3n o que quieran probar la inyecci\u00c3\u00b3n de dependencias\r\n\r\n\r\n## C\u00c3\u00b3mo usarlo ?\r\n\r\nAqu\u00c3\u00ad es un ejemplo de inyecci\u00c3\u00b3n de forma global con la librer\u00c3\u00ada\r\n\r\n```py\r\nfrom injectdep import global_module\r\n\r\n\r\n@global_module.register\r\nclass MyDB:\r\n def find_all():\r\n return [\"Jhon\", \"Pepe\", \"Carlos\"]\r\n\r\ndef main(db: MyDB):\r\n results = db.find_all()\r\n print(results) # [\"Jhon\", \"Pepe\", \"Carlos\"]\r\n\r\n\r\nif __name__ == \"__main__\":\r\n injected = global_module.inject(main)\r\n injected()\r\n```\r\n\r\n## Puede construir su propio m\u00c3\u00b3dulo\r\n\r\n```py\r\nfrom injectdep import Module\r\n\r\ndatabase_module = Module()\r\n\r\n@database_module.register\r\nclass MyDB:\r\n def find_all():\r\n return [\"Jhon\", \"Pepe\", \"Carlos\"]\r\n\r\ndef main(db: MyDB):\r\n results = db.find_all()\r\n print(results) # [\"Jhon\", \"Pepe\", \"Carlos\"]\r\n\r\n\r\nif __name__ == \"__main__\":\r\n injected = database_module.inject(main)\r\n injected()\r\n```\r\n\r\n<p align=\"center\">Inspirado en AngularModules</p>\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Injecci\u00f3n de dependencias para python",
"version": "0.0.1",
"split_keywords": [
"python",
"injection",
"dependency",
"jbuendia1y",
"library"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "167f3a2bd4579a2b301a97da0034050ea3cb9b6de599fb4f4e1253fdf8ce350c",
"md5": "0679d79b9cab10f13b2e97a50db6ba88",
"sha256": "a12153ba99f44f00edd3ab2935cd11caa1de9b159472c9ca995c470259d8893c"
},
"downloads": -1,
"filename": "injectdep-0.0.1-py3.11.egg",
"has_sig": false,
"md5_digest": "0679d79b9cab10f13b2e97a50db6ba88",
"packagetype": "bdist_egg",
"python_version": "0.0.1",
"requires_python": null,
"size": 4945,
"upload_time": "2023-02-06T02:12:03",
"upload_time_iso_8601": "2023-02-06T02:12:03.295529Z",
"url": "https://files.pythonhosted.org/packages/16/7f/3a2bd4579a2b301a97da0034050ea3cb9b6de599fb4f4e1253fdf8ce350c/injectdep-0.0.1-py3.11.egg",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4fffafe7d51739b13680f507678ae538e18b743760bee887a2f6445001019796",
"md5": "052d162e3738c499e9650a3dafd0617c",
"sha256": "ad86f959e92ad62e36112ab4e6aa062d58e814fb9d06f4d13693d5e877765f5c"
},
"downloads": -1,
"filename": "injectdep-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "052d162e3738c499e9650a3dafd0617c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2710,
"upload_time": "2023-02-06T02:12:00",
"upload_time_iso_8601": "2023-02-06T02:12:00.646176Z",
"url": "https://files.pythonhosted.org/packages/4f/ff/afe7d51739b13680f507678ae538e18b743760bee887a2f6445001019796/injectdep-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9e0fc2a5aedb1c5f31d69d881417027453c20cf1ebcf4610984f3f2c9802add7",
"md5": "9ba48f6db928e32269189f587c5bd338",
"sha256": "fb9fa7c1b61115d17815d18fcda563204edb1c8d53af4d641c7a6aa64a3c9de9"
},
"downloads": -1,
"filename": "injectdep-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "9ba48f6db928e32269189f587c5bd338",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2409,
"upload_time": "2023-02-06T02:12:08",
"upload_time_iso_8601": "2023-02-06T02:12:08.156038Z",
"url": "https://files.pythonhosted.org/packages/9e/0f/c2a5aedb1c5f31d69d881417027453c20cf1ebcf4610984f3f2c9802add7/injectdep-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-06 02:12:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "jbuendia1y",
"github_project": "py-injectdep",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "injectdep"
}