How to compile with dependencies? #5

rtoma opened this Issue Jan 4, 2017 · 2 comments


None yet

3 participants

rtoma commented Jan 4, 2017

Great innovative tool.

Most python code uses 3rd party modules. How to compile those?

Example: I have a tool that imports configobj, after using grumpc on my tools .py file the go build returns:

mytool.go:4:2: cannot find package "grumpy/lib/configobj" in any of:
	/usr/local/Cellar/go/1.7.3/libexec/src/grumpy/lib/configobj (from $GOROOT)
	/Users/rtoma/projects/grumpy/build/src/grumpy/lib/configobj (from $GOPATH)
HUSSTECH commented Jan 4, 2017

ConfigObj is pure python, so I thought it would have worked. I'm reading between the lines a bit here, but from the main readme it sounds like grumpy will only be looking for python modules where you're actually developing. So maybe moving the configobj *.py files into your dev directory it will act as if it were a module you made locally and then grumpy will pick it up.

Obviously this is not the ideal long term solution. Also I think ConfigObj needs Six, which is not in the grumpy lib dirs either. Maybe grumpy should be looking in $PYTHONPATH/Lib/site-packages or something like that. But then it would need to know it can only import pure python modules.


Indeed, moving the configobj *.py into the lib/ dir of the repo is a workaround that should work now. The "toolchain" is very primitive at this point so for real projects it's probably best to define your own workflow. The essential thing to know is that grumpc is the tool that converts Python -> Go. Then it's a matter of setting up your GOPATH appropriately so that the importing and imported Go packages line up correctly.

I'll update the README to include some examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment