GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dkolbly/gpython: gpython is a python interpreter written in go "batteries not included"

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

579 Commits
579 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
ast
ast
 
 
bin
bin
 
 
ci
ci
 
 
compile
compile
 
 
examples
examples
 
 
importlib
importlib
 
 
parser
parser
 
 
py
py
 
 
pytest
pytest
 
 
repl
repl
 
 
stdlib
stdlib
 
 
symtable
symtable
 
 
testdata
testdata
 
 
vm
vm
 
 
.gitignore
.gitignore
 
 
.gometalinter.json
.gometalinter.json
 
 
.goreleaser.yml
.goreleaser.yml
 
 
CONTRIBUTE.md
CONTRIBUTE.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
RELEASE.md
RELEASE.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
main.go
main.go
 
 
main_test.go
main_test.go
 
 
notes.txt
notes.txt
 
 
py3test.py
py3test.py
 
 
version.go
version.go
 
 

Repository files navigation

gpython

Build Status codecov GoDoc License

gpython is a part re-implementation, part port of the Python 3.4 interpreter 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 core modules are written in C not python. The converted modules are:

  • builtins
  • marshal
  • math
  • time
  • sys

Install

Download directly from the releases page

Or if you have Go installed:

go install github.com/go-python/gpython

Objectives

gpython started as an experiment to investigate how hard porting Python to Go might be. It turns out that all those C modules are a significant barrier to making gpython a complete replacement to CPython.

However, to those who want to embed a highly popular and known language into their Go application, gpython could be a great choice over less capable (or lesser known) alternatives.

Status

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 at about 20% of the speed of CPython. A π computation test runs quicker under gpython as the Go long integer primitives are likely faster than the Python ones.

@ncw started gpython in 2013 and work on is sporadic. If you or someone you know would be interested to take it futher, it would be much appreciated.

Getting Started

The embedding example demonstrates how to easily 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 it possible to use gpython in a server situation where complete interpreter independence is paramount. See this in action in the multi-context example.

If you are looking to get involved, a light and easy place to start is adding more convenience functions to py/util.go. See notes.txt for bigger ideas.

Other Projects of Interest

  • grumpy - a python to go transpiler

Community

You can chat with the go-python community (or which gpython is part) at [email protected] or on the Gophers Slack in the #go-python channel.

License

This is licensed under the MIT licence, however it contains code which was ported fairly directly directly from the CPython source code under the PSF LICENSE.

About

gpython is a python interpreter written in go "batteries not included"

Resources

Readme
License
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.