Skip to main content

haps PyPI Build Status

Haps [χaps] is a simple DI library, with IoC container included. It is written in pure Python with no external dependencies.

Look how easy it is to use:

from haps import Container as IoC, Inject, inject

# import interfaces
from my_application.core import IDatabase, IUserService


class MyApp:
    db: IDatabase = Inject()  # dependency as a property

    @inject  # or passed to the constructor
    def __init__(self, user_service: IUserService) -> None:
        self.user_service = user_service

IoC.autodiscover('my_application')  # find all interfaces and implementations

if __name__ == '__main__':
    app = MyApp()
    assert isinstance(app.db, IDatabase)
    assert isinstance(app.user_service, IUserService)

Installation

pip install haps

Documentation

See https://haps.readthedocs.io/en/latest/

Usage examples

See https://github.com/lunarwings/haps/tree/master/samples

Testing

Install requirements.test.txt and run py.test in main directory.

Changelog

1.1.3 (2022-02-04)

  • Add >> operator
  • Add DI alias
  • Update .travis.yml

1.1.1 (2018-07-27)

  • Fix bug with optional arguments for functions decorated with @inject

1.1.0 (2018-07-26)

  • Add configuration module
  • Add application class and runner
  • Add profiles
  • Minor fixes

1.0.5 (2018-07-12)

  • @egg decorator can be used without function invocation

1.0.4 (2018-06-30)

  • Add support for python 3.7
  • Fix autodiscover sample

1.0.0 (2018-06-15)

  • First stable release

Metadata

Release files for haps 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for haps 1.1.3
File Size Uploaded Provenance
haps-1.1.3.tar.gz 12.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for haps 1.1.3
File Interpreter ABI Platform
haps-1.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 29.8 kB

Release files / haps-1.1.3.tar.gz

Download URL haps-1.1.3.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
03797570d3698df17848a7198659edcb478d5ec4746ef42348725697e3d90e2b
BLAKE2b-256 checksum
How to use checksums
866ba05adf5b6165c181c0d08b4356d523410fcaa78c9f1a803ba1846fd8d03d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release files / haps-1.1.3-py3-none-any.whl

Download URL haps-1.1.3-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
623f8668b93854fc893b533e2a8aba54baa42bb3f68d78ba586140c9d67599ca
BLAKE2b-256 checksum
How to use checksums
dfb45436f867b6d05400c98cfcc4e1029d9eadb00f0df8a1c452d44d5146dab1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Security for haps 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page