This ought to be a wiki page somewhere, but since I can't even figure out how
to log in to, I'll settle for an email.

I'm trying to dip my toes into Python 3 migration of zope.*.  Stephan
Richter suggested I start with zope.dottedname, since it's a very
trivial package with no dependencies.

The mailing list archive contains a lot of advice.  (If this were a wiki
page, I'd add links to the relevant emails).  What I'm trying to do
here is to provide a concrete example of the porting pattern discovered
by others (especially Lennart Regebro and Tres Seaver):

- make sure you've got Python interpreters for all the interesting
  versions (2.6, 2.7, 3.2, 3.3) (duh)

- check out the sources (duh)

    svn co svn+ssh://

- get the tests to pass with 'python test'

    this basically means you need a
    test_suite='zope.dottedname.tests.test_suite', which was already
    there, and a tests_require=[...] if your tests have any

- get the tests to pass using tox -e py27, i.e. add a tox.ini

    existing packages on provided examples
    there; here's the one I started with for zope.dottedname:

        envlist =
            # you can also add pypy because why not?

        commands =
            python test -q

- add a, because tox builds sdists and installs them into
  virtualenvs under ./.tox, and because setuptools doesn't understand
  Subversion 1.7 working trees

    I used 'check-manifest --create' from

- see how the tests fail with tox -e py32 and/or py33

- decide that the easiest way to fix them for zope.dottedname would be
  to add a renormalizer

    Alternative (and perhaps better) strategies would include rewriting
    doctests into unittests

- this adds a test dependency on zope.testing:

   + edit and add tests_require=['zope.testing'],
   + also add extras={'testing': ['zope.testing']} because
   + you need to update buildout.cfg to require zope.dottedname[zope.testing]
   + also edit tox.ini and add

       deps = zope.testing

    (otherwise test will unpack zope.testing et al into $PWD and
    clutter your working tree)

- get the tests passing (detox is very useful here as it runs tests for
  all Pythons in parallel)

- check test coverage

    I tried to get tox -e coverage working, gave up, and used the old

      python bootstrap
      bin/test --coverage=coverage


- update Trove classifiers in

      'Programming Language :: Python :: 2.6',
      'Programming Language :: Python :: 2.7',
      'Programming Language :: Python :: 3.2',
      'Programming Language :: Python :: 3.3',

- update CHANGES.txt and indicate Python 3.x support

- bump version number in CHANGES.txt and to 4.0.0 to indicate
  Python 3.x support

- maybe migrate to github while you're at it

- make a release to PyPI eventually (zest.releaser FTW)

Marius Gedminas
-- -- Zope 3/BlueBream consulting and development

Attachment: signature.asc
Description: Digital signature

Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to