You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
20
22
modules are written in C not python. The converted modules are:
21
23
22
24
* builtins
@@ -27,53 +29,52 @@ modules are written in C not python. The converted modules are:
27
29
28
30
## Install
29
31
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)
33
33
34
-
Or alternatively if you have Go installed use
34
+
Or if you have Go installed:
35
35
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
40
37
41
38
## Objectives
42
39
43
-
Gpython was written as a learning experiment to investigate how hard
40
+
gpython started as an experiment to investigate how hard
44
41
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.
46
44
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.
48
48
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
52
50
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
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
59
59
Python ones.
60
60
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
67
65
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.
71
68
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.
73
75
74
-
Lots!
75
76
76
-
## Similar projects
77
+
## Other Projects of Interest
77
78
78
79
*[grumpy](https://github.com/grumpyhome/grumpy) - a python to go transpiler
79
80
@@ -86,5 +87,5 @@ or on the [Gophers Slack](https://gophers.slack.com/) in the `#go-python` channe
86
87
## License
87
88
88
89
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
90
91
the [PSF LICENSE](https://github.com/python/cpython/blob/master/LICENSE).
0 commit comments