![cuplogo](http://cup.iobusy.com/cup.logo.png)
## Notice
- Visit http://cup.iobusy.com for more details
- **访问 http://cup.iobusy.com 获取更多信息**
- **From now (Version 3.3.1) on, CUP will only support Python3 **
- If you want use cup in Python2.7.x, plz install it with version < 3.3
- e.g. # python -m pip install cup==3.2.31
- cup 3.2.X versions will only maintain bug fixes for Python2. Will not add any new features.
- If you want to try new features, pls use cup under Python3.
- If you use cup under Python3, pls refer to the `Installation` part.
- 从 3.3.1 版本开始,Cup 新版本只对 Python3提供支持。如果你想继续在python2.7中使用它,请使用3.2.X版本。
- 后续 3.2.X版本对继续提供对Python2.7的bug fix 支持,但不会再增加新的功能。
- 推荐大家在Python3中使用Cup
## Quick Start
### 1. Download
- git clone CUP or download the released tar balls
### 2. Installation
Install from pip
```bash
pip install cup
```
Install from source code:
```bash
python setup.py install
```
### 3. Doc & Wiki
Visit Wiki to see more details: https://github.com/Baidu/CUP/wiki
Visit Doc site to see py-docs: [http://cup.iobusy.com/api-ref/](https://cup.iobusy.com/api-ref/)
```python
# Examples:
# 1. Get system info
import cup
# count cpu usage in interval, by default 60 seconds
from cup.res import linux
cpuinfo = linux.get_cpu_usage(intvl_in_sec=60)
print cpuinfo.usr
# total, available, percent, used, free, active, inactive, buffers, cached
from cup.res import linux
meminfo = linux.get_meminfo()
print meminfo.total
print meminfo.available
```
## Tests
- Install python-nose before running the tests
- run `cd ./cup_tests; nosetests -s`
## Contribute To CUP
- Commit code to GITHUB, https://github.com/baidu/CUP
- Need to check pep8 and pylint rules before you start a pull request
## Discussion
- Github Issues
## Reference
* Pexpect http://pexpect.sourceforge.net/ (under MIT license)
* Httplib2 http://code.google.com/p/httplib2/ (under MIT license)
* requests https://github.com/kennethreitz/requests (under Apache V2 license)
* pymysql https://github.com/PyMySQL/PyMySQL (under MIT license)
## WIKI
https://github.com/Baidu/CUP/wiki
## code directory tree:
```text
cup
|-- cache.py module Memory cache related module
|-- decorators.py module Decorators of python
|-- err.py module Exception classes for CUP
|-- __init__.py module Default __init__.py
|-- log.py module CUP logging
|-- mail.py module CUP Email module (send emails)
|-- net package Network operations, such as net handler parameter tuning
|-- oper.py module Mixin operations
|-- platforms.py module Cross-platform operations
|-- res package Resource usage queries (in /proc)、Process query、etc
|-- shell package Shell Operations、cross-hosts execution
|-- services package Heartbeat、Threadpool based executors、file service、etc
|-- thirdp package Third-party modules: pexpect、httplib2
|-- timeplus.py module Time related module
|-- unittest.py module Unittest、assert、noseClass
|-- util package ThreadPool、Interruptable-Thread、Rich configuration、etc
|-- version.py module CUP Version
```
## 快速开始
### 1. 下载
- 克隆git代码或者下载已发布的tar包
### 2. 安装
- pip 安装 `pip install cup`
- 源码安装 `python setup.py install`
### 3. 使用说明
- Visit Wiki to see more details: https://github.com/Baidu/CUP/wiki
- Visit Doc site to see py-docs: http://cup.iobusy.com/api-ref
举例说明:
```python
# Examples:
# 1. Get system info
import cup
# count cpu usage in interval, by default 60 seconds
from cup.res import linux
cpuinfo = linux.get_cpu_usage(intvl_in_sec=60)
print cpuinfo.usr
# total, available, percent, used, free, active, inactive, buffers, cached
from cup.res import linux
meminfo = linux.get_meminfo()
print meminfo.total
print meminfo.available
```
## Tests
- Install python-nose before running the tests
- run `cd ./cup_tests; nosetests -s`
## 向CUP贡献代码
直接在github中提交patch就可以了
- Commit code to GITHUB, https://github.com/baidu/CUP
- Need to check pep8 and pylint rules before you start a pull request
## Discussion
- Github Issues
## Reference
* Pexpect http://pexpect.sourceforge.net/ (under MIT license)
* Httplib2 http://code.google.com/p/httplib2/ (under MIT license)
* requests https://github.com/kennethreitz/requests (under Apache V2 license)
* pymysql https://github.com/PyMySQL/PyMySQL (under MIT license)
## 代码树结构:
```text
cup
|-- cache.py module 缓存相关模块 (Memory cache related module)
|-- decorators.py module python修饰符,比如@Singleton单例模式 (Decorators of python)
|-- err.py module 异常exception类, Exception classes for CUP
|-- __init__.py module 默认__init__.py, Default __init__.py
|-- log.py module 打印日志类,CUP的打印日志比较简洁、规范,设置统一、简单(cup logging module)
|-- mail.py module 发送邮件 (CUP Email module (send emails))
|-- net package 网络相关操作(Network operations, such as net handler parameter tuning)
|-- oper.py module 一些混杂操作(Mixin operations)
|-- platforms.py module 跨平台、平台相关操作函数(Cross-platform operations)
|-- res package 资源获取、实时用量统计等,所有在/proc可获得的系统资源、进程、设备等信息 (Resource usage queries (in /proc)、Process query、etc)
|-- shell package 命令Shell操作pakcage(Shell Operations、cross-hosts execution)
|-- services package 构建服务支持的类(比如心跳、线程池based执行器等等)Heartbeat、Threadpool based executors、file service、etc
|-- thirdp package 第三方依赖纯Py模块(Third-party modules: pexpect、httplib2)
|-- timeplus.py module 时间相关的模块(Time related module)
|-- unittest.py module 单元测试支持模块(Unittest、assert、noseClass)
|-- util package 线程池、可打断线程、语义丰富的配置文件支持(ThreadPool、Interruptable-Thread、Rich configuration、etc)
|-- version.py module 内部版本文件,CUP Version
```
Raw data
{
"_id": null,
"home_page": "https://github.com/baidu/CUP",
"name": "cup",
"maintainer": "Guannan Ma",
"docs_url": null,
"requires_python": "<4.0,>=3.7",
"maintainer_email": "mythmgn@hotmail.com",
"keywords": "pylib, lib, common, cup",
"author": "CUP Dev Team lead by Guannan Ma",
"author_email": "mythmgn@hotmail.com",
"download_url": null,
"platform": null,
"description": "![cuplogo](http://cup.iobusy.com/cup.logo.png)\n\n## Notice \n\n- Visit http://cup.iobusy.com for more details\n - **\u8bbf\u95ee http://cup.iobusy.com \u83b7\u53d6\u66f4\u591a\u4fe1\u606f**\n- **From now (Version 3.3.1) on, CUP will only support Python3 ** \n - If you want use cup in Python2.7.x, plz install it with version < 3.3\n - e.g. # python -m pip install cup==3.2.31\n - cup 3.2.X versions will only maintain bug fixes for Python2. Will not add any new features.\n - If you want to try new features, pls use cup under Python3.\n - If you use cup under Python3, pls refer to the `Installation` part.\n - \u4ece 3.3.1 \u7248\u672c\u5f00\u59cb\uff0cCup \u65b0\u7248\u672c\u53ea\u5bf9 Python3\u63d0\u4f9b\u652f\u6301\u3002\u5982\u679c\u4f60\u60f3\u7ee7\u7eed\u5728python2.7\u4e2d\u4f7f\u7528\u5b83\uff0c\u8bf7\u4f7f\u75283.2.X\u7248\u672c\u3002\n - \u540e\u7eed 3.2.X\u7248\u672c\u5bf9\u7ee7\u7eed\u63d0\u4f9b\u5bf9Python2.7\u7684bug fix \u652f\u6301\uff0c\u4f46\u4e0d\u4f1a\u518d\u589e\u52a0\u65b0\u7684\u529f\u80fd\u3002\n - \u63a8\u8350\u5927\u5bb6\u5728Python3\u4e2d\u4f7f\u7528Cup\n\n## Quick Start\n### 1. Download\n - git clone CUP or download the released tar balls\n\n### 2. Installation\n\nInstall from pip\n\n```bash\npip install cup\n```\n\nInstall from source code:\n\n```bash\npython setup.py install\n```\n\n### 3. Doc & Wiki\n\nVisit Wiki to see more details: https://github.com/Baidu/CUP/wiki\n\nVisit Doc site to see py-docs: [http://cup.iobusy.com/api-ref/](https://cup.iobusy.com/api-ref/)\n\n```python\n# Examples:\n# 1. Get system info\nimport cup\n# count cpu usage in interval, by default 60 seconds\nfrom cup.res import linux\ncpuinfo = linux.get_cpu_usage(intvl_in_sec=60)\nprint cpuinfo.usr\n\n# total, available, percent, used, free, active, inactive, buffers, cached\nfrom cup.res import linux\nmeminfo = linux.get_meminfo()\nprint meminfo.total\nprint meminfo.available\n```\n\n\n## Tests\n - Install python-nose before running the tests\n - run `cd ./cup_tests; nosetests -s`\n\n## Contribute To CUP\n - Commit code to GITHUB, https://github.com/baidu/CUP\n - Need to check pep8 and pylint rules before you start a pull request\n\n## Discussion\n - Github Issues\n\n## Reference\n * Pexpect http://pexpect.sourceforge.net/ (under MIT license)\n * Httplib2 http://code.google.com/p/httplib2/ (under MIT license)\n * requests https://github.com/kennethreitz/requests (under Apache V2 license)\n * pymysql https://github.com/PyMySQL/PyMySQL (under MIT license)\n\n## WIKI\nhttps://github.com/Baidu/CUP/wiki\n\n## code directory tree:\n\n```text\ncup\n |-- cache.py module Memory cache related module\n |-- decorators.py module Decorators of python\n |-- err.py module Exception classes for CUP\n |-- __init__.py module Default __init__.py\n |-- log.py module CUP logging\n |-- mail.py module CUP Email module (send emails)\n |-- net package Network operations, such as net handler parameter tuning\n |-- oper.py module Mixin operations\n |-- platforms.py module Cross-platform operations\n |-- res package Resource usage queries (in /proc)\u3001Process query\u3001etc\n |-- shell package Shell Operations\u3001cross-hosts execution\n |-- services package Heartbeat\u3001Threadpool based executors\u3001file service\u3001etc\n |-- thirdp package Third-party modules\uff1a pexpect\u3001httplib2\n |-- timeplus.py module Time related module\n |-- unittest.py module Unittest\u3001assert\u3001noseClass\n |-- util package ThreadPool\u3001Interruptable-Thread\u3001Rich configuration\u3001etc\n |-- version.py module CUP Version\n```\n\n\n\n## \u5feb\u901f\u5f00\u59cb\n### 1. \u4e0b\u8f7d\n - \u514b\u9686git\u4ee3\u7801\u6216\u8005\u4e0b\u8f7d\u5df2\u53d1\u5e03\u7684tar\u5305\n\n### 2. \u5b89\u88c5\n - pip \u5b89\u88c5 `pip install cup`\n - \u6e90\u7801\u5b89\u88c5 `python setup.py install`\n\n### 3. \u4f7f\u7528\u8bf4\u660e\n- Visit Wiki to see more details: https://github.com/Baidu/CUP/wiki\n- Visit Doc site to see py-docs: http://cup.iobusy.com/api-ref\n\n\u4e3e\u4f8b\u8bf4\u660e\uff1a\n\n```python\n# Examples:\n# 1. Get system info\nimport cup\n# count cpu usage in interval, by default 60 seconds\nfrom cup.res import linux\ncpuinfo = linux.get_cpu_usage(intvl_in_sec=60)\nprint cpuinfo.usr\n\n# total, available, percent, used, free, active, inactive, buffers, cached\nfrom cup.res import linux\nmeminfo = linux.get_meminfo()\nprint meminfo.total\nprint meminfo.available\n```\n\n\n## Tests\n - Install python-nose before running the tests\n - run `cd ./cup_tests; nosetests -s`\n\n## \u5411CUP\u8d21\u732e\u4ee3\u7801\n\u76f4\u63a5\u5728github\u4e2d\u63d0\u4ea4patch\u5c31\u53ef\u4ee5\u4e86\n - Commit code to GITHUB, https://github.com/baidu/CUP\n - Need to check pep8 and pylint rules before you start a pull request\n\n## Discussion\n - Github Issues\n\n## Reference\n * Pexpect http://pexpect.sourceforge.net/ (under MIT license)\n * Httplib2 http://code.google.com/p/httplib2/ (under MIT license)\n * requests https://github.com/kennethreitz/requests (under Apache V2 license)\n * pymysql https://github.com/PyMySQL/PyMySQL (under MIT license)\n\n## \u4ee3\u7801\u6811\u7ed3\u6784:\n\n```text\ncup\n |-- cache.py module \u7f13\u5b58\u76f8\u5173\u6a21\u5757 \uff08Memory cache related module\uff09\n |-- decorators.py module python\u4fee\u9970\u7b26\uff0c\u6bd4\u5982@Singleton\u5355\u4f8b\u6a21\u5f0f (Decorators of python)\n |-- err.py module \u5f02\u5e38exception\u7c7b, Exception classes for CUP\n |-- __init__.py module \u9ed8\u8ba4__init__.py, Default __init__.py\n |-- log.py module \u6253\u5370\u65e5\u5fd7\u7c7b\uff0cCUP\u7684\u6253\u5370\u65e5\u5fd7\u6bd4\u8f83\u7b80\u6d01\u3001\u89c4\u8303\uff0c\u8bbe\u7f6e\u7edf\u4e00\u3001\u7b80\u5355(cup logging module)\n |-- mail.py module \u53d1\u9001\u90ae\u4ef6 \uff08CUP Email module (send emails)\uff09\n |-- net package \u7f51\u7edc\u76f8\u5173\u64cd\u4f5c\uff08Network operations, such as net handler parameter tuning\uff09\n |-- oper.py module \u4e00\u4e9b\u6df7\u6742\u64cd\u4f5c(Mixin operations)\n |-- platforms.py module \u8de8\u5e73\u53f0\u3001\u5e73\u53f0\u76f8\u5173\u64cd\u4f5c\u51fd\u6570(Cross-platform operations)\n |-- res package \u8d44\u6e90\u83b7\u53d6\u3001\u5b9e\u65f6\u7528\u91cf\u7edf\u8ba1\u7b49\uff0c\u6240\u6709\u5728/proc\u53ef\u83b7\u5f97\u7684\u7cfb\u7edf\u8d44\u6e90\u3001\u8fdb\u7a0b\u3001\u8bbe\u5907\u7b49\u4fe1\u606f \uff08Resource usage queries (in /proc)\u3001Process query\u3001etc\uff09\n |-- shell package \u547d\u4ee4Shell\u64cd\u4f5cpakcage\uff08Shell Operations\u3001cross-hosts execution\uff09\n |-- services package \u6784\u5efa\u670d\u52a1\u652f\u6301\u7684\u7c7b\uff08\u6bd4\u5982\u5fc3\u8df3\u3001\u7ebf\u7a0b\u6c60based\u6267\u884c\u5668\u7b49\u7b49\uff09Heartbeat\u3001Threadpool based executors\u3001file service\u3001etc\n |-- thirdp package \u7b2c\u4e09\u65b9\u4f9d\u8d56\u7eafPy\u6a21\u5757\uff08Third-party modules\uff1a pexpect\u3001httplib2\uff09\n |-- timeplus.py module \u65f6\u95f4\u76f8\u5173\u7684\u6a21\u5757(Time related module)\n |-- unittest.py module \u5355\u5143\u6d4b\u8bd5\u652f\u6301\u6a21\u5757\uff08Unittest\u3001assert\u3001noseClass\uff09\n |-- util package \u7ebf\u7a0b\u6c60\u3001\u53ef\u6253\u65ad\u7ebf\u7a0b\u3001\u8bed\u4e49\u4e30\u5bcc\u7684\u914d\u7f6e\u6587\u4ef6\u652f\u6301\uff08ThreadPool\u3001Interruptable-Thread\u3001Rich configuration\u3001etc\uff09\n |-- version.py module \u5185\u90e8\u7248\u672c\u6587\u4ef6\uff0cCUP Version\n```\n\n",
"bugtrack_url": null,
"license": "Apache License V2",
"summary": "A common useful python library",
"version": "3.2.33",
"project_urls": {
"Homepage": "https://github.com/baidu/CUP"
},
"split_keywords": [
"pylib",
" lib",
" common",
" cup"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bffdd6cf8762d0beba86bd70e6008fbee642f911e7d7450797417ad022da6d15",
"md5": "c331a1d64d5fbbf6b557905530edc532",
"sha256": "f43bf5f7a9d61cb4d72ab6d23c750957fd98abf2f1539423859e534877869eb9"
},
"downloads": -1,
"filename": "cup-3.2.33-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c331a1d64d5fbbf6b557905530edc532",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.7",
"size": 132743,
"upload_time": "2024-03-26T11:07:51",
"upload_time_iso_8601": "2024-03-26T11:07:51.938521Z",
"url": "https://files.pythonhosted.org/packages/bf/fd/d6cf8762d0beba86bd70e6008fbee642f911e7d7450797417ad022da6d15/cup-3.2.33-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-26 11:07:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "baidu",
"github_project": "CUP",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cup"
}