Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

injectdep-0.0.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

injectdep-0.0.1-py3.11.egg (4.9 kB view details)

Uploaded Egg

injectdep-0.0.1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

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

Hashes for injectdep-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fb9fa7c1b61115d17815d18fcda563204edb1c8d53af4d641c7a6aa64a3c9de9
MD5 9ba48f6db928e32269189f587c5bd338
BLAKE2b-256 9e0fc2a5aedb1c5f31d69d881417027453c20cf1ebcf4610984f3f2c9802add7

See more details on using hashes here.

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

Hashes for injectdep-0.0.1-py3.11.egg
Algorithm Hash digest
SHA256 a12153ba99f44f00edd3ab2935cd11caa1de9b159472c9ca995c470259d8893c
MD5 0679d79b9cab10f13b2e97a50db6ba88
BLAKE2b-256 167f3a2bd4579a2b301a97da0034050ea3cb9b6de599fb4f4e1253fdf8ce350c

See more details on using hashes here.

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

Hashes for injectdep-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad86f959e92ad62e36112ab4e6aa062d58e814fb9d06f4d13693d5e877765f5c
MD5 052d162e3738c499e9650a3dafd0617c
BLAKE2b-256 4fffafe7d51739b13680f507678ae538e18b743760bee887a2f6445001019796

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page