paver: the build tool you missed
TRANSCRIPT
![Page 1: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/1.jpg)
Paver: the build tool you missed
Lukas LinhartCentrum Holdings
![Page 2: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/2.jpg)
About Me• Regular pythonista since '05
• Testing and automation obsession
• Centrum Holdings, mostly Django-related work
• Lots of smallish projects
![Page 3: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/3.jpg)
Stumbling upon Paver• "Setuptools no more"
• Kevin Dangoor To The Rescue
![Page 4: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/4.jpg)
SurveyWho would use a build tool...
![Page 5: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/5.jpg)
Build tool in an interpreted world• Generated Content In Repository (TM)
• Moving (files) around
![Page 6: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/6.jpg)
...and why in Python?• Batteries included (tm)
• Integration with pythonic tools
![Page 7: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/7.jpg)
...and why Paver?• Simple things stay simple
• Complex is possible (or integrated)
![Page 8: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/8.jpg)
Single Point of EntryAs in "Console API"
1 paver bootstrap2 paver prepare3 paver run
![Page 9: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/9.jpg)
Getting started (First Task!)pavement.py :
1 from paver.easy import *23 @task4 def install_dependencies():5 sh('pip install --upgrade -r requirements.txt')
![Page 10: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/10.jpg)
Embrace distutils/setuptools1 from paver.easy import *2 from paver.setuputils import setup34 setup(**same_args_as_in_setup)
![Page 11: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/11.jpg)
setup.py compatibilitypaver minilib
paver generate_setup
(pip install -e worky)
![Page 12: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/12.jpg)
Dependencies1 @task2 @needs('install_dependencies')3 def prepare():4 """ Prepare complete environment """5 sh("python setup.py develop")
![Page 13: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/13.jpg)
Overwriting distutils commands1 @task2 @needs('html', "minilib", "generate_setup", "distutils.command.sdist")3 def sdist():4 pass
![Page 14: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/14.jpg)
Positional arguments1 @task2 @consume_args3 def unit(args):4 import nose5 nose.run_exit(6 argv = ["nosetests"] + args7 )
![Page 15: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/15.jpg)
CMD options, GNU style1 @task2 @cmdopts([3 ('domain-username=', 'd', 'Domain username'),4 ('upload-url=', 'u', 'URL to upload to')5 ])6 @needs('download_diff_packages')7 def upload_packages(options):8 # censored
![Page 16: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/16.jpg)
Oh, options1 options(2 minilib=Bunch(3 extra_files=['doctools', 'virtual']4 )5 )
![Page 17: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/17.jpg)
Options (cont.)1 # inside minilib task2 options.get('extra_files', [])
![Page 18: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/18.jpg)
Namespace search1 options(setup=Bunch(version="1.1"))2 options.version3 '1.1'4 options.order('minilib')5 options.version6 AttributeError: version
![Page 19: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/19.jpg)
sh1 myval = sh("cat /etc/fstab", capture=True)
![Page 20: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/20.jpg)
dry1 # prepare2 dry("Modify", do_fs_mumbo_jumbo)
![Page 21: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/21.jpg)
path.py1 @task2 def publish_docs():3 builtdocs = path("docs") / options.sphinx.builddir / "html"4 destdir = options.docroot5 destdir.rmtree()6 builtdocs.move(destdir)
![Page 22: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/22.jpg)
Documentation (sphinx)1 options(2 sphinx=Bunch(3 builddir="build",4 sourcedir="source"5 )6 )
And run
1 paver html
![Page 23: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/23.jpg)
Documentation (cog)1 #<== include('started/oldway/setup.py')==>2 #<==end==>
configured with
1 options(2 cog=Bunch(3 includedir="docs/samples",4 beginspec="<==",5 endspec="==>",6 endoutput="<==end==>"7 )8 )
![Page 24: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/24.jpg)
Virtualenv1 options(2 virtualenv=Bunch(3 packages_to_install=["nose", "virtualenv"],4 install_paver=True,5 script_name='bootstrap.py',6 paver_command_line=None,7 dest_dir="virtualenv"8 )9 )
![Page 25: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/25.jpg)
Discovery
![Page 26: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/26.jpg)
Setting up django discovery1 from paver.discovery import discover_django23 options(4 discovery = Bunch(5 django = Bunch(6 settings_path = "subdir"7 )8 )9 )
1011 discover_django(options)
![Page 27: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/27.jpg)
Happy Django command pandapaver django.validate
![Page 28: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/28.jpg)
Future• virtualenv improvements
• VIRTUAL_ENV context autodetection
• more integration (first-class fabric, ...)
• what would you like?
![Page 29: Paver: the build tool you missed](https://reader031.vdocument.in/reader031/viewer/2022020207/5554afc4b4c905fd608b54d7/html5/thumbnails/29.jpg)
Q & (some) AFork us on githubhttp://github.com/paver/paver/[email protected]