Skip to main content

Prereq is a dependency injection library for Python that is uncomplicated, and async-first.

Project description

Prereq

Prereq is a dependency injection library for Python that is uncomplicated, and async-first.

Full Documentation Here

Installation

Use your favorite package manager to install prereq.

pip install prereq
# Or
uv add prereq

Usage

To get started with Prereq, you just need to create a Provider, and a Resolver. Behavior is inferred based on typing.

import asyncio
from prereq import provides, Resolver

class User: ...

@provides
def user_factory() -> User:
    return User()

def update_user(user: User) -> None:
    print(f"Updated {user}")

resolver = Resolver()
resolver.add_providers(user_factory)

async def main() -> None:
    async with resolver.resolve(update_user) as kwargs:
        update_user(**kwargs)

asyncio.run(main())

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Pull requests must pass ruff, and avoid ignoring pyright errors (but it may be needed, I understand.). You may need to add tests to maintain Prereq's 100% coverage.

License

Prepreq is free and open source using the MIT license.

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

prereq-0.1.0b0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

prereq-0.1.0b0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file prereq-0.1.0b0.tar.gz.

File metadata

  • Download URL: prereq-0.1.0b0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prereq-0.1.0b0.tar.gz
Algorithm Hash digest
SHA256 86dae26e8e72fe0b5a4db8d96c98709d7f75bdbcef7ae93107a7c7d55bc6a7aa
MD5 ec9cf46984903e7cd1e2790d968be9f6
BLAKE2b-256 799723f821ab612cbd0373c78e72b8f8ed75857155b0b3006295dfd132d8b212

See more details on using hashes here.

Provenance

The following attestation bundles were made for prereq-0.1.0b0.tar.gz:

Publisher: ci-cd.yaml on Zwork101/prereq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prereq-0.1.0b0-py3-none-any.whl.

File metadata

  • Download URL: prereq-0.1.0b0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prereq-0.1.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba122762a37b9853aac9205882d1215162390c82a9ff90c436bcabba0d128206
MD5 9865180cd93652f376cda15a0bba1f94
BLAKE2b-256 5da767ff9a92d457445297ba96371c6adf3af3d0ba0a691c1666828995772f40

See more details on using hashes here.

Provenance

The following attestation bundles were made for prereq-0.1.0b0-py3-none-any.whl:

Publisher: ci-cd.yaml on Zwork101/prereq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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