those common functions of package for inner corporation
Project description
天智信达的库
用法
- 此库作为git项目管理,凡是修改完后应及时通知到开发团队
- 需要使用库中的方法,使用pip install,这时候就可以在项目中引用库中的方法
- 引用的方法举例:
generation - 更新库
Make sure you installed setuptools and wheel.
Important: You must modify the version of the package in setup.py and delete folders (build, dist, egg-info)
- python setup.py sdist bdist_wheel
upload - 上传代码
Install twine before doing this
- twine upload dist/*
install - 安装
- pip install wisdoms
find the latest package of wisdoms - 发现最新版本
- pip list --outdated
upgrade - 升级到最新包
- pip install wisdoms --upgrade
packets usage:
auth.py:
from wisdoms.auth import permit
host ={'AMQP_URI': "amqp://guest:guest@localhost"}
auth = permit(host)
class A:
@auth
def func():
pass
config.py
from wisdoms.config import c
# gains item of YML config
print(c.get('name'))
# transforms class into dict
d = c.to_dict()
print(d['name'])
commons package
from wisdoms.commons import revert, codes, success
def func():
# do something
# revert(codes.code) or revert(number)
# return revert(1)
return revert(codes.ERROR)
def foo():
# return revert(code, data, desc)
return revert(codes.SUCCESS, {'data':'data'},'返回成功描述信息')
def done():
# simplified revert where success execute
# return success(data) or success()
return success()
util.py
# 多个字符串连接成路径
from wisdoms.utils import joint4path
print(joint4path('abc','dac','ccc'))
# $: abc/dac/ccc
# 对象转字典
from wisdoms.utils import o2d
o2d(obj)
# 捕获异常装饰器
from wisdoms.utils import exception
@exception()
def func():
pass
ms.py
from wisdoms.ms import ms_base
MsBase = ms_base(config)
class A(MsBase):
pass
如何设计包
- 顶级包:wisdom,代表天智,智慧
- 现阶段的约定:采用一级包的方式
- 不同的功能放在不同的文件(模块)即可做好方法的分类
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
wisdoms-0.0.16.tar.gz
(8.8 kB
view details)
Built Distribution
wisdoms-0.0.16-py3-none-any.whl
(13.7 kB
view details)
File details
Details for the file wisdoms-0.0.16.tar.gz
.
File metadata
- Download URL: wisdoms-0.0.16.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37cd0cb3f9a0d45328c0a22deaaccdc70f246cd5ed8b15bead9bc38a84386a83 |
|
MD5 | c2b403bd32eeccf6d961d9ecde8f543a |
|
BLAKE2b-256 | 439bc454343ea3ec17fcecbb38798eb6ec1523bd91429419552ccc866cfcd309 |
File details
Details for the file wisdoms-0.0.16-py3-none-any.whl
.
File metadata
- Download URL: wisdoms-0.0.16-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c5d36894d8b05a52b94f1cb0cf13b955107a3d574ddf94da7c775f19accd437 |
|
MD5 | e96c2dd86c7394b8072c7c990d36da29 |
|
BLAKE2b-256 | 34579f9f04b5cc09731133a3e866ec3b1af2d7160f47ca0ed2676a530152c41f |