Skip to main content

A lightweight library with an implementation of IoC

Project description

Simple IoC

Build Status License GPLv3 Python versions

Install

pipenv install simple-ioc

or

pip install simple-ioc

Usage

In order to have the IoC (Inversion of Control) working in your application, you must register your services in the IoC container:

from simple_ioc import Container

class AService:
    # Your service implementation comes here

Container().register('an_identifier', lambda: AService())

Then, from any point in your application, you can retrieve the service by calling get:

a_service = Container().get('an_identifier')

Publishing to PyPI

Follow these steps to publish a new version of the package to PyPI:

  1. Update the version number in setup.py

  2. Install build tools (if not already installed):

    pip install build twine
    
  3. Build the distribution packages:

    python setup.py sdist
    

    This creates both source distribution (.tar.gz) and wheel (.whl) in the dist/ directory.

  4. Verify the build:

    twine check dist/*
    
  5. Upload to PyPI using twine:

    twine upload dist/*
    

    Note: Use an API token instead of username/password. Configure it in ~/.pypirc:

    [pypi]
    username = __token__
    password = pypi-YOUR-API-TOKEN-HERE
    
  6. Clean up the build artifacts (optional):

    rm -rf build/ dist/ *.egg-info/
    

Best Practices

  • Use version tags: After publishing, tag the release in git:

    git tag -a X.Y.Z -m "Release X.Y.Z"
    git push origin --tags
    

Prerequisites

  • You need a PyPI account with the appropriate permissions to upload this package

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

simple_ioc-3.1.tar.gz (15.2 kB view details)

Uploaded Source

File details

Details for the file simple_ioc-3.1.tar.gz.

File metadata

  • Download URL: simple_ioc-3.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for simple_ioc-3.1.tar.gz
Algorithm Hash digest
SHA256 b515352984939b501a444e4f7526f900be8fb9e3dfb6af38191e2ac3af697a2a
MD5 64c1a0135047abc875578b2ee365b8ff
BLAKE2b-256 d2042cb6721ba7634d956205ef44c1ad5e127d8a5fd97eb945b6c7cc89c79319

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