py2scala -- Use scala compiler for static analysis of well-typed python

Author: Dan Connolly
Copyright: Dan Connolly and the University of Kansas Medical Center


Convert one module:

$ python py2scala/ >my_module.scala
TODO:Test, document --package option.


Tests are set up to run under nose, assuming fsc, the fast scala compiler, is installed:

py2scala$ nosetests
../src/test/scala-err/distant_types.scala:23: error: value % is not a member of Any
  if ((x % 2) == 0) { 1 } else { "abc" }
./src/test/scala-err/distant_types.scala:31: error: type mismatch;
 found   : Any
 required: Seq[?]
two errors found
Ran 20 tests in 5.243s


Alternatively, to test that the conversion works (i.e. doesn't crash):

py2scala$ python -m py2scala.test.test_convert

And to test compilation output with fsc:

py2scala$ python -m py2scala.test.test_well_typed

Object Capability Discipline

This code follows* a security and testing discipline where module-level code uses only authority passed to it by callers. Only the top level script environment is trusted with the full authority of the python standard library.

*mostly. There's an apparent conflict between object capability discipine and test discovery that I haven't worked out.