Diff for "HackingLazrLibraries"

Not logged in - Log In / Register

Differences between revisions 30 and 32 (spanning 2 versions)
Revision 30 as of 2011-09-15 10:56:52
Size: 12227
Editor: jml
Comment:
Revision 32 as of 2011-09-15 11:19:42
Size: 12276
Editor: jml
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Common Launchpad Component Hacking Tips = #format rst
Line 3: Line 3:
<<TableOfContents(2)>> =========================================
 Common Launchpad Component Hacking Tips
=========================================
Line 5: Line 7:
These hacking tips are common to all Launchpad open-sourced components (i.e., lazr.*). Additional component-specific information may be found in the ``HACKING.txt`` file for that component. .. macro:: <<TableOfContents(2)>>
Line 7: Line 9:
You may also want to see the [[Hacking|Launchpad Hacking]] page. These hacking tips are common to all Launchpad open-sourced components (i.e., ``lazr.*``). Additional component-specific information may be found in the ``HACKING.txt`` file for that component.
Line 9: Line 11:
= Basics = You may also want to see the `Launchpad Hacking <Hacking>`_ page.
Line 11: Line 13:
To develop or run tests, first run ``$DESIRED_PYTHON bootstrap.py`` in the
package's top level directory, where you replace ``$DESIRED_PYTHON`` with the
python executable that want to used to build and run this project. At this time, a
non-system Python, or a virtualenv executable that does not include site-packages,
is highly recommended, and may be required. We are working to remove this
limitation.
Basics
======
Line 18: Line 16:
To use virtualenv, install it (sudo apt-get install python-virtualenv) and then run `virtualenv --no-site-packages [name of directory]`. Once you've done that, use the Python executable in `bin` to run `bootstrap.py` as described above. To develop or run tests, first run ``$DESIRED_PYTHON bootstrap.py`` in the package's top level directory, where you replace ``$DESIRED_PYTHON`` with the python executable that want to used to build and run this project. At this time, a non-system Python, or a virtualenv executable that does not include site-packages, is highly recommended, and may be required. We are working to remove this limitation.
Line 20: Line 18:
Then run ``./bin/buildout``. (NOTE: Ubuntu Intrepid users, see the note at
the bottom of this document if this generates errors.)
To use virtualenv, install it (``sudo apt-get install python-virtualenv``) and then run ``virtualenv --no-site-packages [name of directory]``. Once you've done that, use the Python executable in ``bin`` to run ``bootstrap.py`` as described above.
Line 23: Line 20:
You can now run tests with ``./bin/test``. Use ``./bin/test --help`` to read
about the many options.
Then run ``./bin/buildout``.
Line 26: Line 22:
To gain access to a Python interpreter with the package and its dependent eggs
available, use ``./bin/py``.
You can now run tests with ``./bin/test``. Use ``./bin/test --help`` to read about the many options.
Line 29: Line 24:
You can generate ctags and idutils files for a variety of editors using
``./bin/tags`` (see ``./bin/tags --help``). The advantage of the files
generated from this utility is that they include the sourcecode from the eggs
used in this buildout.
To gain access to a Python interpreter with the package and its dependent eggs available, use ``./bin/py``.
Line 34: Line 26:
To generate distributions, use ``./bin/buildout setup . SETUP_CMD [...]``.
That is, you can use ``./bin/buildout setup .`` as if it were
``python setup.py``. The intended advantage is easy access to a pristine,
local version of setuptools.
You can generate ``ctags`` and ``idutils`` files for a variety of editors using ``./bin/tags`` (see ``./bin/tags --help``). The advantage of the files generated from this utility is that they include the sourcecode from the eggs used in this buildout.
Line 39: Line 28:
== Global Cache == To generate distributions, use ``./bin/buildout setup . SETUP_CMD [...]``. That is, you can use ``./bin/buildout setup .`` as if it were ``python setup.py``. The intended advantage is easy access to a pristine, local version of setuptools.
Line 41: Line 30:
Every project using zc.buildout will keep its own collection of eggs by
default. You may want to cache these eggs and their downloaded
distributions globally so you can share them across
all the projects you work with.
Global Cache
============
Line 46: Line 33:
To do this we create a `.buildout/` directory in our home folder. Buildout
will look for the file `.buildout/default.cfg` and load settings from it.
Every project using zc.buildout will keep its own collection of eggs by default. You may want to cache these eggs and their downloaded distributions globally so you can share them across all the projects you work with.
Line 49: Line 35:
{{{
mkdir -p ~/.buildout/eggs
mkdir ~/.buildout/download-cache
}}}
To do this we create a ``.buildout/`` directory in our home folder. Buildout will look for the file ``.buildout/default.cfg`` and load settings from it::

  mkdir -p ~/.buildout/eggs
  mkdir ~/.buildout/download-cache
Line 55: Line 41:
"$HOME" with the path to your home:: "``$HOME``" with the path to your home::
Line 57: Line 43:
{{{
[buildout]
eggs-directory=$HOME/.buildout/eggs
download-cache=$HOME/.buildout/download-cache
}}}
  [buildout]
  eggs-directory=$HOME/.buildout/eggs
  download-cache=$HOME/.buildout/download-cache
Line 64: Line 48:
== Working with Unreleased Packages == Working with Unreleased Packages
================================
Line 69: Line 54:
=== Source === Source
------
Line 71: Line 57:
If you have a source package, you can add it to this buildout (temporarily or,
if really appropriate, permanently) as follows.
If you have a source package, you can add it to this buildout (temporarily or, if really appropriate, permanently) as follows.
Line 74: Line 59:
NOTE: We'll use "this software" to refer to the software/buildout to which you
want to add a source package; and "the other software" to refer to the source
package that you want to add.
**NOTE:** We'll use "this software" to refer to the software/buildout to which you want to add a source package; and "the other software" to refer to the source package that you want to add.
Line 78: Line 61:
 1. Put the top-level directory (the one with the setup.py) of the other software somewhere accessible to this software. The best thing to do is to locate it in a sibling tree so that there is no confusion about it being separate. 1. Put the top-level directory (the one with the setup.py) of the other software somewhere accessible to this software. The best thing to do is to locate it in a sibling tree so that there is no confusion about it being separate.
Line 80: Line 63:
 1. Every time you run buildout and want the other software to be available you need to tell buildout where the other piece of software is located. To do that set the ``develop`` key:
 {{{bin/buildout buildout
:develop=". ../path/to/other/package"}}}
 You ''can'' set the key persistently in buildout.cfg but that will get committed and as such leads to mistaken commits which no longer work for other people.
1. Every time you run buildout and want the other software to be available you need to tell buildout where the other piece of software is located. To do that set the ``develop`` key::
Line 84: Line 65:
 1. When you want to switch back to using an egg for that other component just run `bin/buildout`  bin/buildout buildout:develop=". ../path/to/other/package"
Line 86: Line 67:
-
Barring version conflicts in your setup.py or buildout configuration (which
will be reported as errors when you run `bin/buildout``), you should now be
using the source version of the dependency. You can verify this by running `bin/py` and importing the library - check its __version__ or some similar aspect.
You ''can'' set the key persistently in buildout.cfg but that will get committed and as such leads to mistaken commits which no longer work for other people.
Line 91: Line 69:
=== Distribution === 1. When you want to switch back to using an egg for that other component just run ``bin/buildout``
Line 93: Line 71:
If you have a source distribution or an egg, and you set up the download-cache
as described in the `Global Cache`_ section above, you can put the
distribution (sdist or egg) in the download-cache's ``dist`` directory.
Then rerun bin/buildout.
Barring version conflicts in your setup.py or buildout configuration (which will be reported as errors when you run ``bin/buildout```), you should now be using the source version of the dependency. You can verify this by running ``bin/py`` and importing the library - check its ``__version__`` or some similar aspect.
Line 98: Line 73:
Alternatively, if you have an egg, you can put it in your eggs directory, or
in the shared eggs directory as described in the `Global Cache`_ section, if
you are using that. The rerun bin/buildout.
Distribution
------------
Line 102: Line 76:
In both cases, to undo, you must remove the egg from the local or shared
``eggs`` directory. If you used the ``download-cache/dist`` directory, you
must also remove it from there.
If you have a source distribution or an egg, and you set up the download-cache as described in the `Global Cache`_ section above, you can put the distribution (sdist or egg) in the download-cache's ``dist`` directory. Then rerun bin/buildout.
Line 106: Line 78:
=== Private Source === Alternatively, if you have an egg, you can put it in your eggs directory, or in the shared eggs directory as described in the `Global Cache`_ section, if you are using that. The rerun bin/buildout.
Line 108: Line 80:
If you want to distribute a source distribution privately, see
http://pypi.python.org/pypi/zc.buildoutsftp/.
In both cases, to undo, you must remove the egg from the local or shared ``eggs`` directory. If you used the ``download-cache/dist`` directory, you must also remove it from there.
Line 111: Line 82:
=== References === Private Source
--------------
Line 113: Line 85:
There is much, much more to learn about zc.buildout. It works well for small
packages, but is even better for big projects. For more information about
zc.buildout:
If you want to distribute a source distribution privately, see http://pypi.python.org/pypi/zc.buildoutsftp/.

References
----------

There is much, much more to learn about zc.buildout. It works well for small packages, but is even better for big projects. For more information about zc.buildout:
Line 126: Line 101:
== Bazaar Configuration == Bazaar Configuration
====================
Line 128: Line 104:
When hacking on LAZR it's useful to have the put something like this in your
bazaar `.location.conf` file:
When hacking on LAZR it's useful to have the put something like this in your bazaar ``.location.conf`` file::
Line 131: Line 106:
{{{
# This is the directory containing all the LAZR projects you are hacking on.
# This could be a shared repository, or you can make each subdirectories a
# shared repository.
[/home/<yourname>/canonical]
email = Me <me@example.com>
pqm_email = Canonical PQM <launchpad@pqm.canonical.com>
push_location = bzr+ssh://bazaar.launchpad.net/~yourlpnick
push_location:policy = appendpath
public_branch = bzr+ssh://bazaar.launchpad.net/~yourlpnick
public_branch:policy = appendpath
submit_to = merge@code.launchpad.net
mail_client = editor
  # This is the directory containing all the LAZR projects you are hacking on.
  # This could be a shared repository, or you can make each subdirectories a
  # shared repository.
  [/home/<yourname>/canonical]
  email = Me <me@example.com>
  pqm_email = Canonical PQM <launchpad@pqm.canonical.com>
  push_location = bzr+ssh://bazaar.launchpad.net/~yourlpnick
  push_location:policy = appendpath
  public_branch = bzr+ssh://bazaar.launchpad.net/~yourlpnick
  public_branch:policy = appendpath
  submit_to = merge@code.launchpad.net
  mail_client = editor
Line 145: Line 119:
# You then add the following two stanzas for each LAZR project
[/home/<yourname>/canonical/lazr.config]
submit_branch = /home/<yourname>/canonical/lazr.config/trunk
  # You then add the following two stanzas for each LAZR project
  [/home/<yourname>/canonical/lazr.config]
  submit_branch = /home/<yourname>/canonical/lazr.config/trunk
Line 149: Line 123:
[/home/<yourname>/canonical/lazr.config/trunk]
public_branch = bzr+ssh://bazaar.launchpad.net/~lazr-developers/lazr.config/trunk
  [/home/<yourname>/canonical/lazr.config/trunk]
  public_branch = bzr+ssh://bazaar.launchpad.net/~lazr-developers/lazr.config/trunk
Line 152: Line 126:
# You should then be able to bzr push/send in any branches.
}}}
You should then be able to bzr push/send in any branches.
Line 155: Line 128:
= Landing your branches = Landing your branches
=====================
Line 161: Line 135:
 3. Once you're done developing a branch, push it to Launchpad. {{{bzr push}}} should work if you've set up your bzr configuration as per above. Otherwise, you'll need to specify a destination URL: {{{bzr push lp:~[yourlpnick]/lazr.[project]/[your-branch-name]}}}  3. Once you're done developing a branch, push it to Launchpad. ``bzr push`` should work if you've set up your bzr configuration as per above. Otherwise, you'll need to specify a destination URL: ``bzr push lp:~[yourlpnick]/lazr.[project]/[your-branch-name]``
Line 168: Line 142:
 1. Check out a copy of the public branch. {{{bzr co lp:lazr.[project]}}} should do it. If you already have a copy, {{{cd}}} into the branch and use {{{bzr up}}} to pick up other peoples' changes.
 2. {{{bzr merge}}} your development branch with the public branch. Resolve any conflicts (if these are serious, you might want to get the branch re-reviewed).
 1. Check out a copy of the public branch. ``bzr co lp:lazr.[project]`` should do it. If you already have a copy, ``cd`` into the branch and use ``bzr up`` to pick up other peoples' changes.
 2. ``bzr merge`` your development branch with the public branch. Resolve any conflicts (if these are serious, you might want to get the branch re-reviewed).
Line 172: Line 146:
 5. {{{bzr commit}}} your changes to the development branch. Be sure to include the IRC nick of the person who reviewed your branch, and the bug number if appropriate Example:   5. ``bzr commit`` your changes to the development branch. Be sure to include the IRC nick of the person who reviewed your branch, and the bug number if appropriate Example::
Line 174: Line 148:
{{{
bzr commit -m "[r=barry][bug=426323] Put 'title' attributes on sections in the API documentation."
}}}
  bzr commit -m "[r=barry][bug=426323] Put 'title' attributes on sections in the API documentation."
Line 178: Line 150:
If you're landing a branch for someone else, be sure to also mention the name of the person who did the original development. If you're landing a branch for someone else, be sure to also mention the name of the person who did the original development::
Line 180: Line 152:
{{{
bzr commit -m "[r=allenap] Add a credentials_file parameter to login_with(). Landed on behalf of Martin Pitt."
}}}
  bzr commit -m "[r=allenap] Add a credentials_file parameter to login_with(). Landed on behalf of Martin Pitt."
Line 184: Line 154:
Use {{{bzr log}}} to look into the past and see what makes a good commit message. Use ``bzr log`` to look into the past and see what makes a good commit message.
Line 186: Line 156:
Finally, push the updated development branch back to where it came from using {{{bzr push lp:lazr.[project]}}}. Finally, push the updated development branch back to where it came from using ``bzr push lp:lazr.[project]``.
Line 189: Line 159:
= Releases = Releases
========
Line 195: Line 166:
This also assumes (in step three) that you have a recent checkout of launchpadlib's trunk that you have prepared for development with buildout '''using a Python without site-packages'''. This can be a locally-built Python from python.org, or a virtualenv Python. (Work is under way to make it possible to use the system Python trivially.) Minimally, where "python" indicates the executable without site-packages, use {{{bzr branch lp:launchpadlib && cd launchpadlib && python bootstrap.py && bin/buildout}}}. You may want to see the discussion of the global cache, above. This also assumes (in step three) that you have a recent checkout of launchpadlib's trunk that you have prepared for development with buildout '''using a Python without site-packages'''. This can be a locally-built Python from python.org, or a virtualenv Python. (Work is under way to make it possible to use the system Python trivially.) Minimally, where "python" indicates the executable without site-packages, use ``bzr branch lp:launchpadlib && cd launchpadlib && python bootstrap.py && bin/buildout``. You may want to see the discussion of the global cache, above.
Line 207: Line 178:
6. Create the tarball. (These steps use {{{./bin/buildout setup .}}} rather than the more standard {{{python setup.py}}} because the first is more likely to work without effort. If you prefer {{{python setup.py}}} and it works for you, go ahead.) 6. Create the tarball. (These steps use ``./bin/buildout setup .`` rather than the more standard ``python setup.py`` because the first is more likely to work without effort. If you prefer ``python setup.py`` and it works for you, go ahead.)::
Line 209: Line 180:
{{{
$ ./bin/buildout setup . sdist
}}}
  $ ./bin/buildout setup . sdist
Line 213: Line 182:
7. The tarball will be created in dist/lazr.[package]-[version].tar.gz. Sign it with your GPG key. 7. The tarball will be created in dist/lazr.[package]-[version].tar.gz. Sign it with your GPG key::
Line 215: Line 184:
{{{
$ gpg --armor --sign --detach-sig dist/lazr.[package]-[version].tar.gz
}}}
  $ gpg --armor --sign --detach-sig dist/lazr.[package]-[version].tar.gz
Line 219: Line 186:
8. That will create a signature file dist/lazr.[package]-[version].tar.gz.asc. Now, upload the tarball and its signature. 8. That will create a signature file dist/lazr.[package]-[version].tar.gz.asc. Now, upload the tarball and its signature::
Line 221: Line 188:
{{{
$ path/to/launchpadlib/bin/py path/to/launchpadlib/contrib/upload_release_tarball.py lazr.[package] [release series] [version] dist/lazr.[package]-[version].tar.gz
}}}
  $ path/to/launchpadlib/bin/py path/to/launchpadlib/contrib/upload_release_tarball.py lazr.[package] [release series] [version] dist/lazr.[package]-[version].tar.gz
Line 225: Line 190:
9. The tarball is now available from Launchpad. Now, register the package with PyPI. 9. The tarball is now available from Launchpad. Now, register the package with PyPI::
Line 227: Line 192:
{{{
$ ./bin/buildout setup . register
}}}
  $ ./bin/buildout setup . register
Line 231: Line 194:
10. Tag the version. 10. Tag the version::
Line 233: Line 196:
{{{
$ bzr tag [version]
}}}
  $ bzr tag [version]
Rendering of reStructured text is not possible, please install Docutils.

=========================================
 Common Launchpad Component Hacking Tips
=========================================

.. macro:: <<TableOfContents(2)>>

These hacking tips are common to all Launchpad open-sourced components (i.e., ``lazr.*``).  Additional component-specific information may be found in the ``HACKING.txt`` file for that component.

You may also want to see the `Launchpad Hacking <Hacking>`_ page.

Basics
======

To develop or run tests, first run ``$DESIRED_PYTHON bootstrap.py`` in the package's top level directory, where you replace ``$DESIRED_PYTHON`` with the python executable that want to used to build and run this project. At this time, a non-system Python, or a virtualenv executable that does not include site-packages, is highly recommended, and may be required.  We are working to remove this limitation.

To use virtualenv, install it (``sudo apt-get install python-virtualenv``) and then run ``virtualenv --no-site-packages [name of directory]``. Once you've done that, use the Python executable in ``bin`` to run ``bootstrap.py`` as described above.

Then run ``./bin/buildout``.

You can now run tests with ``./bin/test``.  Use ``./bin/test --help`` to read about the many options.

To gain access to a Python interpreter with the package and its dependent eggs available, use ``./bin/py``.

You can generate ``ctags`` and ``idutils`` files for a variety of editors using ``./bin/tags`` (see ``./bin/tags --help``). The advantage of the files generated from this utility is that they include the sourcecode from the eggs used in this buildout.

To generate distributions, use ``./bin/buildout setup . SETUP_CMD [...]``. That is, you can use ``./bin/buildout setup .`` as if it were ``python setup.py``.  The intended advantage is easy access to a pristine, local version of setuptools.

Global Cache
============

Every project using zc.buildout will keep its own collection of eggs by default.  You may want to cache these eggs and their downloaded distributions globally so you can share them across all the projects you work with.

To do this we create a ``.buildout/`` directory in our home folder.  Buildout will look for the file ``.buildout/default.cfg`` and load settings from it::

  mkdir -p ~/.buildout/eggs
  mkdir ~/.buildout/download-cache

Create ``~/.buildout/default.cfg`` with the following content, replacing
"``$HOME``" with the path to your home::

  [buildout]
  eggs-directory=$HOME/.buildout/eggs
  download-cache=$HOME/.buildout/download-cache


Working with Unreleased Packages
================================

You may want to develop with an unreleased distribution of another package.
To do so, you have many options.  Here are three.

Source
------

If you have a source package, you can add it to this buildout (temporarily or, if really appropriate, permanently) as follows.

**NOTE:** We'll use "this software" to refer to the software/buildout to which you want to add a source package; and "the other software" to refer to the source package that you want to add.

1. Put the top-level directory (the one with the setup.py) of the other software somewhere accessible to this software. The best thing to do is to locate it in a sibling tree so that there is no confusion about it being separate.

1. Every time you run buildout and want the other software to be available you need to tell buildout where the other piece of software is located. To do that set the ``develop`` key::

 bin/buildout buildout:develop=". ../path/to/other/package"

You ''can'' set the key persistently in buildout.cfg but that will get committed and as such leads to mistaken commits which no longer work for other people.

1. When you want to switch back to using an egg for that other component just run ``bin/buildout``

Barring version conflicts in your setup.py or buildout configuration (which will be reported as errors when you run ``bin/buildout```), you should now be using the source version of the dependency. You can verify this by running ``bin/py`` and importing the library - check its ``__version__`` or some similar aspect.

Distribution
------------

If you have a source distribution or an egg, and you set up the download-cache as described in the `Global Cache`_ section above, you can put the distribution (sdist or egg) in the download-cache's ``dist`` directory. Then rerun bin/buildout.

Alternatively, if you have an egg, you can put it in your eggs directory, or in the shared eggs directory as described in the `Global Cache`_ section, if you are using that. The rerun bin/buildout.

In both cases, to undo, you must remove the egg from the local or shared ``eggs`` directory. If you used the ``download-cache/dist`` directory, you must also remove it from there.

Private Source
--------------

If you want to distribute a source distribution privately, see http://pypi.python.org/pypi/zc.buildoutsftp/.

References
----------

There is much, much more to learn about zc.buildout.  It works well for small packages, but is even better for big projects.  For more information about zc.buildout:

- http://grok.zope.org/documentation/tutorial/introduction-to-zc.buildout

  Presentation notes of an introduction to zc.buildout by its author, Jim
  Fulton.

- http://pypi.python.org/pypi/zc.buildout

  The user manual.

Bazaar Configuration
====================

When hacking on LAZR it's useful to have the put something like this in your bazaar ``.location.conf`` file::

  # This is the directory containing all the LAZR projects you are hacking on.
  # This could be a shared repository, or you can make each subdirectories a
  # shared repository.
  [/home/<yourname>/canonical]
  email = Me <me@example.com>
  pqm_email = Canonical PQM <launchpad@pqm.canonical.com>
  push_location = bzr+ssh://bazaar.launchpad.net/~yourlpnick
  push_location:policy = appendpath
  public_branch = bzr+ssh://bazaar.launchpad.net/~yourlpnick
  public_branch:policy = appendpath
  submit_to = merge@code.launchpad.net
  mail_client = editor

  # You then add the following two stanzas for each LAZR project
  [/home/<yourname>/canonical/lazr.config]
  submit_branch = /home/<yourname>/canonical/lazr.config/trunk

  [/home/<yourname>/canonical/lazr.config/trunk]
  public_branch = bzr+ssh://bazaar.launchpad.net/~lazr-developers/lazr.config/trunk

You should then be able to bzr push/send in any branches.

Landing your branches
=====================

If you're familiar with the Launchpad review process, the lazr process is very similar. If you're not familiar with the Launchpad review process, don't worry: the lazr process is simpler.

 1. Branch from the public branch at lp:lazr.[project] and do your development.
 2. Make sure all the existing tests pass and that you have good test coverage for your new code. (Feel free to ask for help in #launchpad-dev on FreeNode.)
 3. Once you're done developing a branch, push it to Launchpad. ``bzr push`` should work if you've set up your bzr configuration as per above. Otherwise, you'll need to specify a destination URL: ``bzr push lp:~[yourlpnick]/lazr.[project]/[your-branch-name]``
 4. Visit the Launchpad page for your branch (it'll be linked from http://code.launchpad.net/~[yourlpnick]). Propose it for merging into the public branch at lp:lazr.[project]. Describe the changes you've made, with links to any bugs you're trying to fix.
 5. Get your merge proposal reviewed. The #launchpad-reviews channel has one or more reviewers on call, most of the time Monday-Friday. If you can't find anyone to review your branch, contact Leonard Richardson (IRC:leonardr, email:leonard.richardson@canonical.com).
 6. A review is an iterative process: the reviewer may ask you questions or ask you to make changes to your branch. Once the reviewer thinks your branch should be merged into the main branch, they'll vote 'approve' on your merge proposal.
 7. If you are a Launchpad developer or a member of the lazr-developers team, it's your responsibility to land your own branch. If you're not, the person who reviewed your merge proposal is responsible for landing your branch. ''Don't let them forget, or your branch will just sit on Launchpad doing nothing!'' 

Here's how to land a reviewed branch:
 1. Check out a copy of the public branch. ``bzr co lp:lazr.[project]`` should do it. If you already have a copy, ``cd`` into the branch and use ``bzr up`` to pick up other peoples' changes.
 2. ``bzr merge`` your development branch with the public branch. Resolve any conflicts (if these are serious, you might want to get the branch re-reviewed).
 3. Build the branch and run the tests to be sure the buildout succeeds and all the tests pass.
 4. Add an entry describing your changes to the NEWS.txt file.
 5. ``bzr commit`` your changes to the development branch. Be sure to include the IRC nick of the person who reviewed your branch, and the bug number if appropriate Example::

  bzr commit -m "[r=barry][bug=426323] Put 'title' attributes on sections in the API documentation."

If you're landing a branch for someone else, be sure to also mention the name of the person who did the original development::

  bzr commit -m "[r=allenap] Add a credentials_file parameter to login_with(). Landed on behalf of Martin Pitt."

Use ``bzr log`` to look into the past and see what makes a good commit message.

Finally, push the updated development branch back to where it came from using ``bzr push lp:lazr.[project]``.


Releases
========

launchpadlib contains a script for uploading release tarballs to Launchpad. Here's how to do a release of a lazr package using this script. See also ReleaseChecklist.

This assumes you have made your desired changes in a branch, gotten them reviewed, and merged them to trunk.  It also assumes that your changes include updating version.txt and NEWS.txt appropriately.  The version number in version.txt should be bumped by a full release number (e.g., 1.X -> 2.0) rarely, and with the buy-in of the primary maintainer(s); by a major release number (e.g., 1.3 -> 1.4) for feature changes; and by a minor release number (e.g., 1.3 -> 1.3.1) for bugfix changes only.  NEWS.txt should describe the changes for your release.

This also assumes (in step three) that you have a recent checkout of launchpadlib's trunk that you have prepared for development with buildout '''using a Python without site-packages'''.  This can be a locally-built Python from python.org, or a virtualenv Python.  (Work is under way to make it possible to use the system Python trivially.)  Minimally, where "python" indicates the executable without site-packages, use ``bzr branch lp:launchpadlib && cd launchpadlib && python bootstrap.py && bin/buildout``.  You may want to see the discussion of the global cache, above.

1. Check the commit log and NEWS.txt file to be sure the important changes are reflected there.

2. Set the correct date and version for this release in the NEWS.txt file.

3. Set the correct version for this release in the version.txt file.

4. Run the buildout and tests to be sure everything is in working order.

5. Commit the above changes.

6. Create the tarball.  (These steps use ``./bin/buildout setup .`` rather than the more standard ``python setup.py`` because the first is more likely to work without effort.  If you prefer ``python setup.py`` and it works for you, go ahead.)::

  $ ./bin/buildout setup . sdist

7. The tarball will be created in dist/lazr.[package]-[version].tar.gz. Sign it with your GPG key::

  $ gpg --armor --sign --detach-sig dist/lazr.[package]-[version].tar.gz

8. That will create a signature file dist/lazr.[package]-[version].tar.gz.asc. Now, upload the tarball and its signature::

  $ path/to/launchpadlib/bin/py path/to/launchpadlib/contrib/upload_release_tarball.py lazr.[package] [release series] [version] dist/lazr.[package]-[version].tar.gz

9. The tarball is now available from Launchpad. Now, register the package with PyPI::

  $ ./bin/buildout setup . register

10. Tag the version::

  $ bzr tag [version]

Now the world knows about the new release.

HackingLazrLibraries (last edited 2021-05-27 14:27:21 by cjwatson)