Andreas Runfalk

storm-legacy

I use Storm in a big private project and due to Storm I have been stuck with Python 2.7. This forks fixes that by adding support for Python 3.3 and later. To do that I removed functionality that I don't use myself, and feel is outdated. In the long run I think completely switching to SQLAlchemy is the only correct choice. But since it was easier to port a subset Storm I decided to go with that approach for now.

I started by ripping out functionality that I wasn't interested in; like MySQL, SQLObject, Zope and Twisted support. I also fixed some bugs and applied a Python 3 patch for the C-extension. Then I applied stage 1 of the tool Futurize. This mainly fixed legacy exception raising and catching:

raise ValueError, "Oops"  # Legacy
raise ValueError("Oops")  # Modern

Then I used futurize's stage 2 which fixes things like wrapping dict.items() in a list() call. I don't like that solution but used the diff from stage 2 and helper functions to ensure that iterator methods were used wherever possible.

Then I took Storm's big test suite and fixed one file at a time until it could run my tests. By using Travis CI I ensured that I never broke the existing Python 2 functionality. I don't think this project would have been possible if the test suite wasn't so extensive.

The final touches included switching the entire test suite from unittest to pytest and made the documentation work with Sphinx. I went through each file and used regular expressions and Vim macros to replace all assert method calls with Pytest assert statements. This helped me get rid of a lot of deprecation warnings and the tests became much cleaner.