- Notifications
You must be signed in to change notification settings - Fork97
gpython is a python interpreter written in go "batteries not included"
License
go-python/gpython
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
gpython is a part re-implementation, part port of the Python 3.4interpreter in Go. Although there are many areas of improvement,it stands as an noteworthy achievement in capability and potential.
gpython includes:
- lexer, parser, and compiler
- runtime and high-level convenience functions
- multi-context interpreter instancing
- easy embedding into your Go application
- interactive mode (REPL) (try online!)
gpython does not include many python modules as many of the coremodules are written in C not python. The converted modules are:
- builtins
- marshal
- math
- time
- sys
Download directly from thereleases page
Or if you have Go installed:
go install github.com/go-python/gpython
gpython started as an experiment to investigate how hardporting Python to Go might be. It turns out that all those C modulesare a significant barrier to making gpython a complete replacementto CPython.
However, to those who want to embed a highly popular and known languageinto their Go application, gpython could be a great choice over lesscapable (or lesser known) alternatives.
gpython currently:
- Parses all the code in the Python 3.4 distribution
- Runs Python 3 for the modules that are currently supported
- Supports concurrent multi-interpreter ("multi-context") execution
Speed hasn't been a goal of the conversions however it runs pystone atabout 20% of the speed of CPython. Aπ computation test runs quicker undergpython as the Go long integer primitives are likely faster than thePython ones.
@ncw started gpython in 2013 and work on is sporadic. If you or someoneyou know would be interested to take it futher, it would be much appreciated.
Theembedding example demonstrates how toeasily embed and invoke gpython from any Go application.
Of interest, gpython is able to run multiple interpreter instances simultaneously,allowing you to embed gpython naturally into your Go application. This makes itpossible to use gpython in a server situation where complete interpreterindependence is paramount. See this in action in themulti-context example.
If you are looking to get involved, a light and easy place to start is adding more convenience functions topy/util.go. Seenotes.txt for bigger ideas.
- grumpy - a python to go transpiler
You can chat with the go-python community (or which gpython is part)atgo-python@googlegroups.comor on theGophers Slack in the#go-python
channel.
This is licensed under the MIT licence, however it contains code whichwas ported fairly directly directly from the CPython source code underthePSF LICENSE.
About
gpython is a python interpreter written in go "batteries not included"
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.