Tt presentation.ppt
-
Upload
volodymyr-vitvitskyi -
Category
Engineering
-
view
120 -
download
8
Transcript of Tt presentation.ppt
@signalpillar (2015)
TOX - virtualenv automation tool
Where we all start
● virtualenv .env● source .env/bin/activate● pip install -r requirements.txt● py.test
Where we all start
● virtualenv(wrapper) + pip + bash|Makefile|Fabfile● Optionally `setup.py`
Where we all start
Where we all start (Makefile)
● Easy way to start from 0 for a newcomer● Manage dependencies● Coordination with other developers● Consistent build procedure between projects● Good integration with CI
Goals
More Happiness Units
$ tox -h
usage: tox [-h] [--version] [-v] [--showconfig] [-l] [-c CONFIGFILE] [-e envlist] [--notest] [--sdistonly] [--installpkg PATH] [--develop] [--set-home] [-i URL] [--pre] [-r] [--result-json PATH] [--hashseed SEED] [--force-dep REQ] [--sitepackages] [--skip-missing-interpreters] [args [args ...]]
Tox
● Cross-Python: Cpython 2.6-3.x, Jython, pypypy2[4567] py3[01234] jython pypy pypy3
● Cross-platform: Windows, Unit style envs ● Driven by ini file● Continuous server integration● Good documentation/examples
Tox
● pip install tox● configure via tox.ini file in the root of a project● tox● Profit!
Tox success story
Tox
project/ {toxinidir}, {setupdir}, {changedir}
- .tox/ {toxworkdir}
- tox.ini- setup.py
# different in Jenkins context{homedir}/.tox/distshare {distshare}
Tox.ini
● create env○ setup.py sdist ( if not skipsdist=True )
● install deps○ install generated sdist ( if not skipsdist=True )
● pip install -e . ( if usedevelop = True )● run commands● deactivate env
Tox flow
Demo based on https://github.com/signalpillar/fp-2015-march
Tox - Demo
Tox.ini - Substitutions
● Global/Local (env specific)● Environment variables {env:KEY[:DEFAULT]}● Commands positional args {posargs:DEFAULTS}● Values from other sections {[sectionname]
valuename}
Tox.ini - global substitution variables
● toxinidir● toxworkdir● homedir● distdir● distshare
Tox.ini - env-specific substitution variables
● envname● envpython● envdir● envbindir● envsitepackagesdir● envtmpdir● envlogdir
[testenv]deps=
-rrequirements.txt {[base]deps}
nose==1.1.2coverage>=3.5.1
commands=nosetests
Tox - Dependencies
Demo based on https://github.com/signalpillar/tox-subprojects-demo
Tox - Demo
Tox just manages venvs
Search filename:tox.ini on GitHub
Find Tox.ini examles
● https://www.facebook.com/groups/odesa.python/● http://www.meetup.com/Odesa-Python-Meetup/
Odessa Python User Group
Thank You!