A lightweight library with an implementation of IoC
Project description
Simple IoC
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:
-
Update the version number in
setup.py -
Install build tools (if not already installed):
pip install build twine
-
Build the distribution packages:
python setup.py sdist
This creates both source distribution (.tar.gz) and wheel (.whl) in the
dist/directory. -
Verify the build:
twine check dist/*
-
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
-
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
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b515352984939b501a444e4f7526f900be8fb9e3dfb6af38191e2ac3af697a2a
|
|
| MD5 |
64c1a0135047abc875578b2ee365b8ff
|
|
| BLAKE2b-256 |
d2042cb6721ba7634d956205ef44c1ad5e127d8a5fd97eb945b6c7cc89c79319
|