python脚本工具箱

pytoolbox的Python项目详细描述


https://badge.fury.io/py/pytoolbox.pnghttps://secure.travis-ci.org/davidfischer-ch/pytoolbox.pnghttps://coveralls.io/repos/davidfischer-ch/pytoolbox/badge.pnghttps://landscape.io/github/davidfischer-ch/pytoolbox/master/landscape.png'Stories in Ready'

害怕红色身份?请点击链接,有时这不是我的错;-)

这个模块是python脚本的工具箱。

文档:https://pytoolbox.readthedocs.org

储存库:https://github.com/davidfischer-ch/pytoolbox

这个库支持python 2.7、3.3、3.4、3.5、3.6和pypy。 并尝试支持2.6和3.2,请参见Travis CI构建矩阵。

发行号代表什么?

我尽我所能遵循这个有趣的建议:Semantic Versioning 2.0.0

如何安装(Python2.7)?

安装一些pip不处理的包:

sudo apt-get install gir1.2-gexiv2-0.10 libexiv2-dev liblzma-dev libxml2-dev libxslt-dev libyaml-dev libz-dev
sudo apt-get install ffmpeg git-core python-dev python-gi python-pip screen

确保pip是最新的(pipeption):

sudo pip-2.7 install --upgrade pip

然后,您只需要运行setup.py

python2 setup.py test
sudo python2 setup.py install

如何安装(Python3.5)?

安装一些pip不处理的包:

sudo apt-get install gir1.2-gexiv2-0.10 libexiv2-dev liblzma-dev libxml2-dev libxslt-dev libyaml-dev libz-dev
sudo apt-get install ffmpeg git-core python3-dev python3-gi python3-pip screen

确保pip是最新的(pipeption):

sudo pip-3.5 install --upgrade pip

然后,您只需要运行setup.py

python3 setup.py test
sudo python3 setup.py install

如何启用功能/模块?

示例:

python setup.py install --help

Common commands: (see '--help-commands' for more)

  setup.py build      will build the package underneath 'build/'
  setup.py install    will install the package

Global options:
  --verbose (-v)  run verbosely (default)
  --quiet (-q)    run quietly (turns verbosity off)
  --dry-run (-n)  don't actually do anything
  --help (-h)     show detailed help message
  --no-user-cfg   ignore pydistutils.cfg in your home directory

Options for 'WithExtra' command:
  --prefix                             installation prefix
  --exec-prefix                        (Unix only) prefix for platform-specific files
  --home                               (Unix only) home directory to install under
  --user                               install in user site-package '...'
  --install-base                       base installation directory (instead of --prefix or --home)
  --install-platbase                   base installation directory for platform-specific files (...)
  --root                               install everything relative to this alternate root directory
  --install-purelib                    installation directory for pure Python module distributions
  --install-platlib                    installation directory for non-pure module distributions
  --install-lib                        installation directory for all module distributions (...)
  --install-headers                    installation directory for C/C++ headers
  --install-scripts                    installation directory for Python scripts
  --install-data                       installation directory for data files
  --compile (-c)                       compile .py to .pyc [default]
  --no-compile                         don't compile .py files
  --optimize (-O)                      also compile with optimization: -O1 for "python -O", (...)
  --force (-f)                         force installation (overwrite any existing files)
  --skip-build                         skip rebuilding everything (for testing/debugging)
  --record                             filename in which to record list of installed files
  --install-layout                     installation layout to choose (known values: deb, unix)
  --old-and-unmanageable               Try not to use this!
  --single-version-externally-managed  used by system package builders to create 'flat' eggs

  --extra-all                          Install dependencies for all features.
  --extra-atlassian                    Install dependencies for the feature atlassian.
  --extra-django                       Install dependencies for the feature django.
  --extra-django-filter                Install dependencies for the feature django_filter.
  --extra-django-formtools             Install dependencies for the feature django_formtools.
  --extra-flask                        Install dependencies for the feature flask.
  --extra-imaging                      Install dependencies for the feature imaging.
  --extra-jinja2                       Install dependencies for the feature jinja2.
  --extra-logging                      Install dependencies for the feature logging.
  --extra-mongo                        Install dependencies for the feature mongo.
  --extra-network                      Install dependencies for the feature network.
  --extra-rest-framework               Install dependencies for the feature rest_framework.
  --extra-selenium                     Install dependencies for the feature selenium.
  --extra-smpte2022                    Install dependencies for the feature smpte2022.
  --extra-unittest                     Install dependencies for the feature unittest.
  --extra-voluptuous                   Install dependencies for the feature voluptuous.

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help


sudo python setup.py install --extra-smpte2022

另一种方法,使用pip

sudo pip install -e .[django,flask,mongo,smpte2022] --use-mirrors

如何检查保险范围?

python setup.py test
xdg-open tests/cover/index.html

备注:

  • 所有与django相关的模块都被排除在测试之外!
  • 不过,我使用他们与django高达1.11.8。

如何使用?

下面是使用pytoolbox提供的cmd函数的hello.py示例:

from pytoolbox.subprocess import cmd

print(cmd('echo Hello World!')['stdout'])

如何生成文档?

文档由Sphinx生成。 实际上,大多数文档都是从代码的docstrings中提取的。

程序如下:

python setup.py docs
xdg-open docs/build/html/index.html

如何将它添加到我自己项目的依赖项中?

下面是一个名为my cool project的项目的示例setup.py

from setuptools import setup

setup(name='my-cool-project',
          version='0.8',
          author='Firstname Lastname',
          author_email='author@something.com',
          install_requires=['...', 'pytoolbox', '...'],
          tests_require=['nose'],
          license='GPLv3',
          url='https://github.com/nickname/my-cool-project',
          packages=['my_cool_project'])

请参阅pip vcs support以获取有关此的详细信息。

您还需要安装git-core,但可能已经是这样了,至少在开发计算机上是这样;-)

2014年-大卫·费舍尔

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用split函数分割字符串,但没有得到期望的结果   未找到包含derby数据库嵌入架构的sql Java桌面应用程序错误   java elasticsearch vs solr用于定制全文搜索系统   java Android:创建没有startOffset的动画延迟?   java如何查看其他应用程序接收的数据?   java如何在Linux中使用D和classpath选项运行jar文件   java和域设计最佳实践   具有相同内存位置的java数组,将显示为输出   连接到java中的elasticsearch?   Java Playframework重定向到带有Json负载的外部url   java无法在Android平台上使用InputStream为蓝牙socket创建ObjectInputStream   使用POI将Excel日期转换为Java日期,年份未正确显示   oracle从数据库层还是Java层调用webservice?