The hackable dependency injection framework
Project description
logos_cdi
LogosCDI is a dependency injection tool that allows you to create extensible and maintainable applications
How to install
pip install logos_cdi
Basic usage
First you need to create an object of the Application class
from logos_cdi.application import Application
app = Application(
modules=[
]
)
You may want to use some modules to improve productivity
from logos_cdi.application import Application
from logos_cdi.command import Commands
app = Application(
modules=[
Commands()
]
)
The Commands Module gives you a basis for creating commands to be executed in the terminal.
You can call it with:
$ logos
usage: logos [--app-url APP_URL] {} ...
logos: error: the following arguments are required: command
Create your own modules with commands
from logos_cdi.command import Commands, AbstractCommand, CommandModule
class TestCommand(AbstractCommand):
def define_arguments(self, argument_parser):
argument_parser.add_argument('--name', default='Anonymous')
return super().define_arguments(argument_parser)
def execute(self):
return print('Hello', self.arguments.name)
class Tests(CommandModule, BaseModule):
def define_commands(self):
return {
'test': Service(
class_path='test_module.TestCommand',
parameters={}
)
}
Add to your application
from logos_cdi.application import Application
from logos_cdi.command import Commands
from test_module import Tests
app = Application(
modules=[
Commands(),
Tests()
]
)
$ logos
usage: logos [--app-url APP_URL] {test} ...
logos: error: the following arguments are required: command
$ logos test --help
usage: logos test [-h] [--name NAME]
options:
-h, --help show this help message and exit
--name NAME
$ logos test
Hello Anonymous
$ logo test --name=foo
Hello foo
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logos_cdi-1.1.0.tar.gz.
File metadata
- Download URL: logos_cdi-1.1.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0d9b86e64a9767cbd59409e99287088fbcc962edf750749c5f20f6fbf1cc60c
|
|
| MD5 |
3537ec99bebc180cc47d6aecd71f9a67
|
|
| BLAKE2b-256 |
be15889b602b4d6773adf5d83974f90365bd74560ac8ab8a8bcfc29a611a7912
|
File details
Details for the file logos_cdi-1.1.0-py3-none-any.whl.
File metadata
- Download URL: logos_cdi-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b47aa1e75fee649c440762c91d157837bf0ddfe1eb4451515405001c64ff8e6
|
|
| MD5 |
c39599aa814cae91dd454cb3b05ad4a6
|
|
| BLAKE2b-256 |
c3a2ec43f1299093b801cc957e86dcaf93f1f14e644196a1c9db2b20960b4b5c
|