Skip to main content

Python Dependency Manager

Project description

pydm 🐍

A Python package designed to streamline dependency injection and parameter management for Python applications.


Features

  • Service Container: Manage services and dependencies with ease.
  • Interface Bindings: Bind interfaces to implementations for seamless dependency management.
  • Parameters Bag: Access application parameters from memory or environment variables.
  • Factory Bindings: Create services dynamically using factory methods.

📦 Installation

Install from source:

pip install git+https://github.com/ariana126/pydm.git

or PyPI

pip install pydmpro

🚀 Quick Start

An example in your project:

from pydm import ServiceContainer, EnvParametersBag
from dotenv import load_dotenv

class DatabaseConnectionInterface:
    pass
class MySQLConnection:
    def __init__(self, base_url: str):
        self.__base_url = base_url
class Repository:
    def __init__(self, conn: DatabaseConnectionInterface):
        self.__conn = conn

def boot() -> None:
    service_container: ServiceContainer = ServiceContainer.get_instance()

    load_dotenv()
    service_container.set_parameters(EnvParametersBag())

    service_container.bind_parameters(MySQLConnection, {'base_url': 'MYSQL_URL'})
    service_container.bind(DatabaseConnectionInterface, MySQLConnection)

boot()
repository = ServiceContainer.get_instance().get_service(Repository) # Repositoy instance

🧪 Running Tests

pytest

📄 License

This project is licensed under the MIT License – see the LICENSE file for details.


🤝 Contributing

Contributions are welcome!
If you have an improvement or find a bug:

  1. Fork the repo
  2. Create your branch
  3. Submit a pull request

💡 About

pydm is a lightweight dependency management package designed to simplify service container management and parameter handling in Python projects. Originally created by Ariana, it provides tools to maintain clean, scalable architecture and streamline the injection of dependencies and configuration parameters.

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

pydmpro-0.1.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

pydmpro-0.1.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pydmpro-0.1.2.tar.gz.

File metadata

  • Download URL: pydmpro-0.1.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for pydmpro-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bb1c98664c1a19d5ac53a5de9e4600f91075995202aff03d14bfc28fa9223541
MD5 69051f4ce8e607e9d5ea4f318a58a96c
BLAKE2b-256 a5ede328574ad02b474501e2312fe43e2b4e4c6ac5ab744b0f7e59034ba65e4c

See more details on using hashes here.

File details

Details for the file pydmpro-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pydmpro-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for pydmpro-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5a1ef5fd2297348b8bee6d797f9c42058a90f1ae457fcae0d53912cfc29e22b3
MD5 406f8d9c95d6070b63384d77c47666d1
BLAKE2b-256 836168600edec378734ad08ba311cbd0c7f1378021c57c837b48e5760e8e7802

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