Skip to main content

Toolbox for Python scripts

Project description

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

Afraid of red status ? Please click on the link, sometimes this is not my fault ;-)

This module is a Toolbox for Python scripts.

Documentation: https://pytoolbox.readthedocs.org

Repository: https://github.com/davidfischer-ch/pytoolbox

This library supports Python 3.6, 3.7, 3.8… and PyPy 3.6.

What the release number stands for ?

I do my best to follow this interesting recommendation : Semantic Versioning 2.0.0

How to install it ?

Install some packages that are not handled by 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

Make sure that pip is up-to-date (PIPception):

$ source /some/python3/venv/bin/active
$ pip install --upgrade pip

Then, you only need to run setup.py:

$ source /some/python3/venv/bin/activate
$ python setup.py install

How to enable features/modules ?

Example:

$ 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:
  ...
  --extra-all                          Install dependencies for All Modules.
  --extra-atlassian                    Install dependencies for Atlassian.
  --extra-aws                          Install dependencies for AWS.
  --extra-django                       Install dependencies for Django.
  --extra-django-filter                Install dependencies for Django Filter.
  --extra-django-formtools             Install dependencies for Django Form Tools.
  --extra-flask                        Install dependencies for Flask.
  --extra-imaging                      Install dependencies for Imaging.
  --extra-jinja2                       Install dependencies for Jinja2.
  --extra-logging                      Install dependencies for Logging.
  --extra-network                      Install dependencies for Networking.
  --extra-pandas                       Install dependencies for Pandas.
  --extra-rest-framework               Install dependencies for Django REST Framework.
  --extra-selenium                     Install dependencies for Selenium.
  --extra-smpte2022                    Install dependencies for SMPTE-2022.
  --extra-unittest                     Install dependencies for Unit Test.
  --extra-vision                       Install dependencies for Vision.
  --extra-voluptuous                   Install dependencies for Voluptuous.
  --extra-doc                          Install dependencies for Pytoolbox Docs.
  --extra-test                         Install dependencies for Pytoolbox Tests.

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


$ python setup.py install --extra-smpte2022

Another way to do this, with pip:

$ pip install -e .[django,flask,mongo,smpte2022]

How to check coverage ?

$ source /some/python3/venv/bin/activate
$ pip install -e .[all,test]
$ pytest
$ xdg-open htmlcov/index.html

Remarks:

  • All Django related modules are excluded from tests!
  • However I am using them with Django 1.8 up to 3.1.0.

How to use it ?

Here is an example hello.py using the cmd function provided by pytoolbox:

$ from pytoolbox.subprocess import cmd
$ print(cmd('echo Hello World!')['stdout'])

How to generate documentation ?

The documentation is generated by Sphinx. In fact most of this documentation is extracted from the docstrings of the code.

Here is the procedure:

$ source /some/python3/venv/bin/activate
$ pip install -e .[docs]
$ xdg-open docs/build/html/index.html

How to add it to dependencies of my own project ?

Here is an example setup.py for a project called my-cool-project:

  from setuptools import setup

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

See pip vcs support to get further details about this.

You also need to install git-core, but it is probably already the case, at least on your development computer ;-)

2014 - 2021 David Fischer

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytoolbox, version 14.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pytoolbox-14.0.0-py3-none-any.whl (168.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pytoolbox-14.0.0.tar.gz (137.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page