-
Notifications
You must be signed in to change notification settings - Fork 1
Description
There wasn't an explicit ticket for this, so here goes 😀
It would be great if Grumpy could digest a python project and spit out a Go project.
I think this would make Grumpy a lot more usable in practice on existing codebases.
This means a couple things, off the top of my head:
- Compatibility with
PYTHONPATH
/VIRTUAL_ENV
environment variables - Walking a project directory and subfolders
- Understanding python modules and
__init__.py
- Compiling dependant libraries that are imported
- Outputting a reasonable folder structure
Might be more, let me know what you think.
It seems to me that a ticket like this could use a concrete example and target. How about PyMySQL? PyMySQL is a popular, small (5.6k LOC) project that is explicitly pure-python. I had a gander through their import statements and everything seemed pretty reasonable. Notably, there are a few instances where they snag some small things from __future__
, so that might need some implementation work. I only saw print_function
and absolute_import
which sounds straightforward.
I think this ticket would be satisfied by something like this:
git clone https://github.com/PyMySQL/PyMySQL
git clone https://github.com/google/grumpy
( cd grumpy; make )
grumpy/tools/grumpc --read PyMySQL --save $GOPATH/src/github.com/PyMySQL/PyMySQL
cd $GOPATH/src/github.com/PyMySQL/PyMySQL
go build
And now you have a Go library that you could import and use (it doesn't look like PyMySQL has a CLI).
This is just an example though, maybe there's a better litmus test to work towards.
Relates google#5, #39, google#23, possibly others.
Thoughts? 😄