Skip to main content

Python command line tasks router

Project description

Pyouter

Pyouter is a tasks router by hierarchy and layered tasks, which may come from command line or http restful api

pyouter

INSTALL

install pyouter

pip install pyouter

examples

minimal example code for pyouoter:

from typing import Any
from pyouter.app import App
from pyouter.router import Router

import json

def hello(config, options):
    print("hello function")

class Hello:
    def __init__(self) -> None:
        pass 
        
    def __call__(self, config, options) -> Any:
        self.config = config
        self.options = options
        self.inner()
    
    def inner(self):
        print(f"hello class object, self.options.debug:{self.options.debug}")
        if self.options.debug:
            print('debug')
    

if __name__=="__main__":
    '''
    Usage:
        * python test.py test.hello.func
        * python test.py test.hello.obj
    '''
    
    app = App(config='config.json')
    
    app.option(
        '-d', '--debug',
        dest='debug',
        action="store_true",
        help='debug'
    )
    
    app.use(
        router=Router(
            test=Router(
                hello=Router(
                    func=hello,
                    obj=Hello()
                )
            )
        )
    )
    
    print("run")
    app.run()

What's new

0.1.0

  • fix executor bug

0.0.9

  • improve -v, --view, -i, --insepect option for path debug

0.0.8

  • add app.option support
  • improve App(config=), support config patth
  • add aysnc support
  • will execute all routers pallarent by using async ThreadPoolExecutor

0.0.7

  • add pyouter self completion of bash and fish

0.0.6

  • fixed bug in fish completion install

0.0.5

  • pass config if need

0.04

  • custom parser

0.0.3

  • support pyouter completion
  • pyouter as entry points of package

0.0.2

  • rename plugin to pyouter

0.0.1

  • project init
  • add pypi settings
  • add installer

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

pyouter-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

File details

Details for the file pyouter-0.1.0.tar.gz.

File metadata

  • Download URL: pyouter-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for pyouter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d2681508a19ccfe0c9def6c8dc7fb931c3e404cf1c15288487bf1b6172bc7e74
MD5 632b4f9f6eadf9bce0f8e4fee6166a0e
BLAKE2b-256 c9db1b37ef2ba9fa51af35d188f49fbd163a409275cd717250e237d621ff1cf8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page