Date: Thu, 12 Sep 2002 11:42:57 -0400 From: Nathan Dunfield To: Jeff Weeks Subject: SnapPea ... Marc Culler and I are working on a normal surface program (in Python, with a fast C kernel for solving the equations). Of course, we wanted to be able to import manifolds from SnapPea; in the process of setting that up we made a number of improvements to SnapPea3.0d3, and thought that we would pass them on to you. You can download our version from: http://www.math.harvard.edu/~nathand/SnapPeaPython.tgz What we added: 1) Added all the link complements from Joe Christy's tabulation, and all the 10^6+ knots from Knotscape, including interator classes. 2) Added SnapPea.get_manifold which accepts a wide range of names (e.g "v134", "m129(2,3)", "b++LRLLRL", "5^2_1", "11n123(2,3)", "16a67" where the last two mean knot complements from the KnotScape census.) 3) Changed to use Python's built-in module system, that is, there is a directory called SnapPea which contains a file __init__.py (= the old SnapPea.py) and all the supporting files (e.g. "terse*bin"). The user can move the directory SnapPea into any directory where Python searches for modules, and everything will work. For more on the module system, see http://www.python.org/doc/essays/packages.html 4) Currently, SnapPea requires the location of the census files "terse*.bin" to be hard-wired in at compile-time. Changed this so that these are determined at run-time; the Python module SnapPea determines the correct location using the __path__ trick described in the module docs cited above. 5) Changed the build system for SnapPeaC.so. Rather than using a Makefile, we used Python's built-in "setup.py" system; This has the advantage that Python figures out the correct compiler to use, where all the header files are, what kind of dynamic module to create, etc. without any user intervention. For instance, on the BSD variant known as Mac OS X, the Makefile you would need would have to be quite different than a Makefile for Linux because of the unusual way OS X does dynamic libraries. See the README file for how to use the build system. Also, it should be possible to use the same "setup.py" file to build under Windows (with some modification; as it is, I think we assume that the path separator is "/"). Anyway, I think that's it. (Hmm, also we may have used some features of Python 2.*, in the code, but these are no doubt utterly inessential an could be removed if need be). One amusing note: in Knotscape, they store the DT codes in a very complicated way where you store the diffs between successive codes; here we just printed out the whole list of DT codes and then gzipped it. The result is slightly smaller (6M vs 7M) and, of course, Python has a built in library that allows you to treat a compressed file as though it was a normal one.