Skip to main content

Builder for a service host.

Project description


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

def setup_services(ctx: ISrvHostContext, services: StaticContainerBuilder):

if __name__ == "__main__":
    SrvHostBuilder("App") \
        .config_configuration(setup_config) \
        .config_services(setup_services) \
        .build() \

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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dnry-srvhost-builder, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size dnry_srvhost_builder-0.2.0-py3-none-any.whl (7.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dnry_srvhost-builder-0.2.0.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page