Releasing and deploying python tools


Published on

zest.releaser, zest.stabilizer, collective.dist, zc.sourcerelease, collective.releaser

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Releasing and deploying python tools

  1. 1. Releasing and deploying python tools Andriy Mylenkyy © Quintagroup, 2009
  2. 2. Plan <ul><li>Introduction </li></ul><ul><li>zest.releaser </li></ul><ul><li>zest.stabilizer </li></ul><ul><li>collective.dist </li></ul><ul><li>zc.sourcerelease </li></ul><ul><li>collective.releaser </li></ul>
  3. 3. Problem & Purposes <ul><li>Problem: </li></ul><ul><li>A lot of routing work with svn </li></ul><ul><li>Routing with product release </li></ul><ul><li>Different buildout configurations </li></ul>
  4. 4. zest.releaser <ul><li>Summary: (for 1.1.3 ver.) package releasing made easy </li></ul><ul><li>Updates the version number either in or in version.txt. </li></ul><ul><li>Updates the history/changes file </li></ul><ul><li>Tags the release in svn </li></ul><ul><li>Uploads a source release to pypi </li></ul>
  5. 5. <ul><li>Commands: </li></ul><ul><li>prereleas </li></ul><ul><li>release </li></ul><ul><li>postrelease </li></ul><ul><li>fullrelease </li></ul><ul><li>Aspects: </li></ul><ul><li>Must be version.txt or </li></ul><ul><li>Ask for creating tags directory (if absent) </li></ul><ul><li>Interactive mode </li></ul><ul><li>Work with any branches (not only trunk) </li></ul>zest.releaser (2)
  6. 6. zest.stabilizer <ul><li>Summary: (for 1.2.2 version) </li></ul><ul><li>Move the trunk checkouts in your development buildout to tag checkouts in your production buildout. </li></ul><ul><li>Requirements: </li></ul><ul><li>unstable.cfg, stable.cfg </li></ul><ul><li>expects &quot;ourpackages&quot; parts in unstable.cfg </li></ul><ul><li>Packages in ourpackages must be checked out in appropriate directory </li></ul>
  7. 7. zest.stabilizer (2) <ul><li>Installation as any python package: </li></ul><ul><li>easy_install zest.stabilizer </li></ul><ul><li>Commands: </li></ul><ul><li>stabilize </li></ul><ul><li>ZestSkel paster template </li></ul><ul><li> </li></ul>
  8. 8. collective.dist <ul><li>Summary: Distutils commands to upload files to several servers </li></ul><ul><li>Extend distutils with 2 commands: </li></ul><ul><ul><li>mupload </li></ul></ul><ul><ul><li>mregister </li></ul></ul><ul><li>Configured with ~/.pypirc </li></ul><ul><li>Added to standard python-2.6 distribution </li></ul>
  9. 9. collective.dist (2) [distutils] index-servers= pypi pypi-personal [pypi] username:user password:pswd [] repository: username:ploneuser password:pswd [pypi-personal] username:user2 password: .pypirc
  10. 10. collective.dist (3) <ul><li>Several pypi servers configurations </li></ul><ul><li>-r option point to repository </li></ul><ul><li>If no password present </li></ul><ul><li>deal with several profiles on PyPI itself </li></ul>$ python mregister sdist mupload $ python mregister sdist mupload -r
  11. 11. zc.sourcerelease <ul><li>Summary: create source releases from buildouts </li></ul><ul><li>buildout-source-release – script generates a source release from a buildout </li></ul><ul><li>create gzipped tar archive </li></ul><ul><li>includes data from download cache, eggs </li></ul><ul><li>release includes a script </li></ul><ul><li>For file://... - full path </li></ul>
  12. 12. zc.sourcerelease (2) test.buildout/ |-- README.txt |-- |-- buildout.cfg `-- products `-- README.txt ... $ buildout-source-release file:// tmp/test.buildout buildout.cfg ... $ ls . ... test.buildout.tgz $ buildout-source-release http:// svn/test.buildout production.cfg -n production.buildout ... $ls . production.buildout.tgz
  13. 13. zc.sourcereleas (3) test.buildout ... |-- buildout.cfg |-- eggs | |-- setuptools-0.6c9-py2.4.egg | |-- EGG-INFO ... | | `-- site.pyc | `-- zc.buildout-1.2.1-py2.4.egg | |-- EGG-INFO ... |-- |-- products | `-- README.txt `-- release-distributions `-- dist |-- infrae.subversion-1.4.5.tar.gz |-- `-- zc.buildout-1.2.1.tar.gz
  14. 14. collective.releaser <ul><li>Summary: make it easier to release and deploy zc.buildout/subversion based projects </li></ul><ul><li>new setuptools commands: </li></ul><ul><li>release; build_mo </li></ul><ul><li>console scripts: </li></ul><ul><li>project_release; project_deploy; project_md5; project_copy_eggs; project_svn_prepare </li></ul><ul><li>hook to launch actions when a package is released (default: sends an email) </li></ul><ul><li>paste template: releaser_project </li></ul>
  15. 15. collective.releaser. (2) Project structure <ul><li>releaser_project paster template. </li></ul>$ paster create -t releaser_project my_project $ svn import my_project http://some.svn/my_project -m &quot;initial commit&quot; /buildout /packages /bundles /releases /buildbot /docs /root /1.0 /2.0 /egg.1 /egg.2 /buildout.cfg /Extermals.txt /Prod.tgz
  16. 16. <ul><li>In packages dir: </li></ul><ul><li>Create package (with paster create) </li></ul><ul><li>package_svn_prepare <new.pack> </li></ul><ul><ul><li>prepare svn structure </li></ul></ul><ul><ul><li>checkin to project/packages </li></ul></ul><ul><li>Mailing support </li></ul><ul><li>In <new.pack>/setup.cfg </li></ul>collective.releaser (3) Packages
  17. 17. collective.releaser (4) Releasing eggs <ul><li>release in package dir: </li></ul><ul><li>python release </li></ul><ul><ul><li>run tests before releasing </li></ul></ul><ul><ul><li>upgrading the version </li></ul></ul><ul><ul><li>creating a branch and a tag in svn </li></ul></ul><ul><ul><li>pushing the package to the various PyPI-like servers </li></ul></ul><ul><ul><li>sending a mail with the changes, if the mail_hook section was provided in setup.cfg </li></ul></ul>
  18. 18. collective.releaser (5) Releasing project <ul><li>release in package dir: </li></ul><ul><li>project_release </li></ul><ul><ul><li>run from buildout directory </li></ul></ul><ul><ul><li>copy buildout to releases/<ver> in </li></ul></ul><ul><ul><li>Add version.txt in releases/<ver> for pinging eggs versions. </li></ul></ul><ul><li>project_deploy </li></ul><ul><ul><li>Take buildout configuration file as param </li></ul></ul><ul><ul><li>build a tarball </li></ul></ul><ul><ul><li>buildout can be reinstalled offline </li></ul></ul>
  19. 19. collective.releaser (7) Upgrading buildout <ul><li>project_eggs in buildout dir: </li></ul><ul><li>Usefull for upgrade eggs in project </li></ul>