DNRY-SrvHost-Builder
A library for building a long running service in python.
This library is inspired by ASPNETCORE. This package provides a set of classes and interfaces that simplify the initialization of a service by integrating configuration management from dnry.config and container based dependency injection using pyioc3.
This library was intended as a platform on which to create long-running services and reduce boiler plate code. You can create your own service host use one from the DNRY.SrvHost library.
Quick Start
Install dnry-srvhost-builder
pip install dnry-srvhost-builder
Create your own own service host
from dnry.srvhost.builder import SrvHostBase
class AppHost(SrvHostBase):
def run(self, *args, **kwargs):
print('Do something cool!')
Build your program
from dnry.config import IConfigFactory
from dnry.srvhost.builder import SrvHostBuilder, ISrvHostContext, ISrvHost
from pyioc3 import StaticContainerBuilder
def setup_config(ctx: ISrvHostContext, conf: IConfigFactory):
# Add configuration files here
pass
def setup_services(ctx: ISrvHostContext, services: StaticContainerBuilder):
services.bind(
annotation=ISrvHost,
implementation=AppHost)
if __name__ == "__main__":
SrvHostBuilder("App") \
.config_configuration(setup_config) \
.config_services(setup_services) \
.build() \
.run()
That's it! You are ready to build something cool. You can do much more
How What?
in setup_service and setup_config. For information on how to use the
IConfigFactory, see the documentation at en0/dnry-config.
For more information on how to use StaticContainerBuilder, see the
documentation at en0/pyioc3.
Metadata
Release files for dnry-srvhost-builder 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dnry_srvhost-builder-0.2.0.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dnry_srvhost_builder-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.3 kB
Release files / dnry_srvhost-builder-0.2.0.tar.gz
| Download URL | dnry_srvhost-builder-0.2.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f00e5e8c9fc270b5031a269969882f41413fafb87f8e750a7a8568b683100ee9
|
|
BLAKE2b-256 checksum How to use checksums |
be4689ebcf722bcb589c9211836f8c143bc7552ed68ffcd8202e2ac72d60872e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.9
|
Release files / dnry_srvhost_builder-0.2.0-py3-none-any.whl
| Download URL | dnry_srvhost_builder-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc867ecc3e7b572029bd0604376e48732c83830c3491f4716c238d1efc5f203d
|
|
BLAKE2b-256 checksum How to use checksums |
34b46f29b28cd858a43c7d9e83b4dbb73ef6d11e2cf00bf6c0abfc9c65951feb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.9
|