Skip to content

badbye/startpro

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Startpro

Use startpro script to build a Python script project quickly.

Getting Started

pip install startpro

raise pkg_resources.DistributionNotFound? ( Homebrew/legacy-homebrew#26900 )

Usage

startpro command [-options] [option_value]

Available command:
  create
  list
  pkg
  start

New Features*

from startpro.common.utils.log4py import log
from startpro.core.utils.loader import safe_init_run
from startpro.core.utils.loader import get_settings

@safe_init_run
def run(**kw):
	pass
  1. Add safe init run model
  2. Add log config for mail service in config.ini (safe_init_run model only),if the log error logging more than [log_error_limit], it will be sent to your e-mail.
[common]
mail_to = 
mail_un = 
mail_pw = 
mail_host = 
log_error_limit = 50
# seconds for keep log error time window to send notify
log_error_window = 0

# custom config
# [test]
# lol = LOL

Help

startpro [command] -help

Build a project

startpro cretae -name pro

Settings

cd pro

vim startpro.cfg

# [settings]
# default = 'execute module match pattern name'
# [package]
# name = 'package main process name'

Example

➜ startpro create -name pro
➜ cd pro
➜ mkdir script
➜ touch script/__init__.py
➜ vim script/test.py
➜ startpro list
  [INFO]:script list:
  ----> 0: test.run
➜ startpro start test.run
  {'paths': ['script'], 'load_paths': ['script.test']}
➜ startpro start 0 # use number instead of function name(to type faster)
  {'paths': ['script'], 'load_paths': ['script.test']}

test.py (function)

function name startswith "run":

def run(**k):
	print k

or

class extends Process & has attribute "name" and overwrite:

def run(self, **kwargvs):
        raise NotImplementedError

test.py (class)

# encoding: utf8
from startpro.core.process import Process

class Test(Process):

	name = "testpro"

	def __init__(self):
		pass

	def run(self, **k):
		print k

Start a program

➜ startpro list
  [INFO]:script list:
  ----> 0: testpro
➜ startpro start testpro
➜ startpro start 0 # use number instead of function name(to type faster)
...

Package

➜ startpro pkg -name pro
➜ ./dist/pro list
  [INFO]:script list:
  ----> 0: testpro
➜ ./dist/pro start testpro

Thanks

Thanks to ChengZhang https://github.com/sing1ee and @LL

About

build a script project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%