Porting zope.dottedname to Python 3

Marius Gedminas <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <20130205165621.GA11471@platonas>
This ought to be a wiki page somewhere, but since I can't even figure out how
to log in to http://wiki.zope.org, 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://svn.zope.org/repos/main/zope.dottedname/trunk

- get the tests to pass with 'python setup.py 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
    dependencies.

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

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

        [tox]
        envlist =
            py26,py27,py32,py33
            # you can also add pypy because why not?

        [testenv]
        commands =
            python setup.py test -q

- add a MANIFEST.in, 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 https://gist.github.com/4277075

- 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

    https://github.com/zopefoundation/zope.dottedname/commit/1a2440c#diff-3

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

- this adds a test dependency on zope.testing:

   + edit setup.py 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

       [testenv]
       deps = zope.testing

    (otherwise setup.py 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 setup.py bootstrap
      bin/buildout
      bin/test --coverage=coverage

    method

- update Trove classifiers in setup.py:

      '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 setup.py 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
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
signature.asc (application/pgp-signature, 190 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iD8DBQFRETm1kVdEXeem148RAhhLAJ4rV7bEDEenSFJjWse+jNCldXt8DgCggFoW
al3N9VEfYGhxFoulXKqFots=
=n/Bl
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.