Skip to content

Commit f712a5d

Browse files
drew-512Drew O'Mearasbinet
authored
doc: add pointers to examples + reword
Co-authored-by: Drew O'Meara <[email protected]> Co-authored-by: Sebastien Binet <[email protected]>
1 parent 232eb8e commit f712a5d

File tree

1 file changed

+42
-41
lines changed

1 file changed

+42
-41
lines changed

README.md

+42-41
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
[![GoDoc](https://godoc.org/github.com/go-python/gpython?status.svg)](https://godoc.org/github.com/go-python/gpython)
66
[![License](https://img.shields.io/badge/License-BSD--3-blue.svg)](https://github.com/go-python/gpython/blob/master/LICENSE)
77

8-
gpython is a part re-implementation / part port of the Python 3.4
9-
interpreter to the Go language, "batteries not included".
10-
11-
It includes:
12-
13-
* runtime - using compatible byte code to python3.4
14-
* lexer
15-
* parser
16-
* compiler
8+
gpython is a part re-implementation, part port of the Python 3.4
9+
interpreter in Go. Although there are many areas of improvement,
10+
it stands as an noteworthy achievement in capability and potential.
11+
12+
gpython includes:
13+
14+
* lexer, parser, and compiler
15+
* runtime and high-level convenience functions
16+
* multi-context interpreter instancing
17+
* easy embedding into your Go application
1718
* interactive mode (REPL) ([try online!](https://gpython.org))
1819

19-
It does not include very many python modules as many of the core
20+
21+
gpython does not include many python modules as many of the core
2022
modules are written in C not python. The converted modules are:
2123

2224
* builtins
@@ -27,53 +29,52 @@ modules are written in C not python. The converted modules are:
2729

2830
## Install
2931

30-
Gpython is a Go program and comes as a single binary file.
31-
32-
Download the relevant binary from here: https://github.com/go-python/gpython/releases
32+
Download directly from the [releases page](https://github.com/go-python/gpython/releases)
3333

34-
Or alternatively if you have Go installed use
34+
Or if you have Go installed:
3535

36-
go get github.com/go-python/gpython
37-
38-
and this will build the binary in `$GOPATH/bin`. You can then modify
39-
the source and submit patches.
36+
go install github.com/go-python/gpython
4037

4138
## Objectives
4239

43-
Gpython was written as a learning experiment to investigate how hard
40+
gpython started as an experiment to investigate how hard
4441
porting Python to Go might be. It turns out that all those C modules
45-
are a significant barrier to making a fully functional port.
42+
are a significant barrier to making gpython a complete replacement
43+
to CPython.
4644

47-
## Status
45+
However, to those who want to embed a highly popular and known language
46+
into their Go application, gpython could be a great choice over less
47+
capable (or lesser known) alternatives.
4848

49-
The project works well enough to parse all the code in the python 3.4
50-
distribution and to compile and run python 3 programs which don't
51-
depend on a module gpython doesn't support.
49+
## Status
5250

53-
See the examples directory for some python programs which run with
54-
gpython.
51+
gpython currently:
52+
- Parses all the code in the Python 3.4 distribution
53+
- Runs Python 3 for the modules that are currently supported
54+
- Supports concurrent multi-interpreter ("multi-context") execution
5555

5656
Speed hasn't been a goal of the conversions however it runs pystone at
57-
about 20% of the speed of cpython. The pi test runs quicker under
58-
gpython as I think the Go long integer primitives are faster than the
57+
about 20% of the speed of CPython. A [π computation test](https://github.com/go-python/gpython/tree/master/examples/pi_chudnovsky_bs.py) runs quicker under
58+
gpython as the Go long integer primitives are likely faster than the
5959
Python ones.
6060

61-
There are many directions this project could go in. I think the most
62-
profitable would be to re-use the
63-
[grumpy](https://github.com/grumpyhome/grumpy) runtime (which would mean
64-
changing the object model). This would give access to the C modules
65-
that need to be ported and would give grumpy access to a compiler and
66-
interpreter (gpython does support `eval` for instance).
61+
@ncw started gpython in 2013 and work on is sporadic. If you or someone
62+
you know would be interested to take it futher, it would be much appreciated.
63+
64+
## Getting Started
6765

68-
I (@ncw) haven't had much time to work on gpython (I started it in
69-
2013 and have worked on it very sporadically) so someone who wants to
70-
take it in the next direction would be much appreciated.
66+
The [embedding example](https://github.com/go-python/gpython/tree/master/examples/embedding) demonstrates how to
67+
easily embed and invoke gpython from any Go application.
7168

72-
## Limitations and Bugs
69+
Of interest, gpython is able to run multiple interpreter instances simultaneously,
70+
allowing you to embed gpython naturally into your Go application. This makes it
71+
possible to use gpython in a server situation where complete interpreter
72+
independence is paramount. See this in action in the [multi-context example](https://github.com/go-python/gpython/tree/master/examples/multi-context).
73+
74+
If you are looking to get involved, a light and easy place to start is adding more convenience functions to [py/util.go](https://github.com/go-python/gpython/tree/master/py/util.go). See [notes.txt](https://github.com/go-python/gpython/blob/master/notes.txt) for bigger ideas.
7375

74-
Lots!
7576

76-
## Similar projects
77+
## Other Projects of Interest
7778

7879
* [grumpy](https://github.com/grumpyhome/grumpy) - a python to go transpiler
7980

@@ -86,5 +87,5 @@ or on the [Gophers Slack](https://gophers.slack.com/) in the `#go-python` channe
8687
## License
8788

8889
This is licensed under the MIT licence, however it contains code which
89-
was ported fairly directly directly from the cpython source code under
90+
was ported fairly directly directly from the CPython source code under
9091
the [PSF LICENSE](https://github.com/python/cpython/blob/master/LICENSE).

0 commit comments

Comments
 (0)