pipenv install simple-iocor
pip install simple-iocIn 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')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 -m build
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/
-
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
- You need a PyPI account with the appropriate permissions to upload this package