Skip to content

Commit 7aa96d6

Browse files
committed
[GR-15433] Adopt terminology
PullRequest: graalpython/493
2 parents f53bea4 + 7871746 commit 7aa96d6

File tree

5 files changed

+123
-65
lines changed

5 files changed

+123
-65
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
This changelog summarizes major changes between GraalVM versions of the Python
44
language runtime. The main focus is on user-observable behavior of the engine.
55

6+
## Version 1.0.0 RC16
7+
8+
* No user-facing changes
9+
610
## Version 1.0.0 RC15
711

812
* Implement PEP 487 `__init_subclass__`

CONTRIBUTING.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

README.md

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Graal/Truffle-based implementation of Python
1+
# GraalVM Implementation of Python
22

3-
GraalVM provides an early-stage experimental implementation of Python. A primary
4-
goal is to support SciPy and its constituent libraries. This Python
5-
implementation currently aims to be compatible with Python 3.7, but it is a long
6-
way from there, and it is very likely that any Python program that requires any
7-
imports at all will hit something unsupported. At this point, the Python
8-
implementation is made available for experimentation and curious end-users.
3+
This is an early-stage experimental implementation of Python. A primary goal is
4+
to support SciPy and its constituent libraries. This Python implementation
5+
currently aims to be compatible with Python 3.7, but it is a long way from
6+
there, and it is very likely that any Python program that requires any packages
7+
at all will hit something unsupported. At this point, the Python implementation
8+
is made available for experimentation and curious end-users.
99

1010
### Trying it
1111

@@ -38,18 +38,35 @@ dependencies), you should be able to `import numpy` afterwards.
3838

3939
Support for more extension modules is high priority for us. We are actively
4040
building out our support for the Python C API to make extensions such as NumPy,
41-
SciPy, Scikit-learn, Tensorflow and the like work. This work means that some
42-
other extensions might also already work, but we're not actively testing other
43-
extensions right now and cannot promise anything. Note that to try extensions on
44-
this implementation, you have to download, build, and install them manually for
45-
now. To do so, we recommend LLVM 6. Other versions might also work, but this
46-
version is what we're testing with in our CI.
41+
SciPy, Scikit-learn, Pandas, Tensorflow and the like work. This work means that
42+
some other extensions might also already work, but we're not actively testing
43+
other extensions right now and cannot promise anything. Note that to try
44+
extensions on this implementation, you have to download, build, and install them
45+
manually for now. To do so, we recommend LLVM 6. Other versions might also work,
46+
but this version is what we're testing with in our CI.
47+
48+
### Polyglot Usage
49+
50+
We have a [document](doc/INTEROP.md) describing how we implement the
51+
cross-language interop. This will hopefully give you an idea how to use it.
52+
53+
### Contributing
54+
55+
I you're thinking about contributing something to this repository, you will need
56+
to sign the [Oracle Contributor
57+
Agreement](http://www.graalvm.org/community/contributors/) for us to able to
58+
merge your work. Please also take note of our [code of
59+
conduct](http://www.graalvm.org/community/conduct/) for contributors.
60+
61+
To get you started, we have [written](docs/CONTRIBUTING.md) a bit about the
62+
structure of this interpreter that should show how to fix things or add
63+
features.
4764

4865
### Licensing
4966

50-
This Graal/Truffle-based implementation of Python is copyright (c) 2017, 2018
51-
Oracle and/or its affiliates and is made available to you under the terms the
52-
Universal Permissive License v 1.0 as shown at
67+
This GraalVM implementation of Python is copyright (c) 2017, 2019 Oracle and/or
68+
its affiliates and is made available to you under the terms the Universal
69+
Permissive License v 1.0 as shown at
5370
[http://oss.oracle.com/licenses/upl](http://oss.oracle.com/licenses/upl). This
5471
implementation is in part derived from and contains additional code from 3rd
5572
parties, the copyrights and licensing of which is detailed in the

doc/CONTRIBUTING.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
### Contributing to the GraalVM Implementation of Python
2+
3+
Thanks for considering to contribute! To get you started, here is a bit of
4+
information about the structure of this implementation.
5+
6+
##### But first...
7+
8+
You will need to sign the [Oracle Contributor
9+
Agreement](http://www.graalvm.org/community/contributors/) for us to be able to
10+
merge your work.
11+
12+
Please also take some time to review our [code of
13+
conduct](http://www.graalvm.org/community/conduct/) for contributors.
14+
15+
##### Getting started
16+
17+
The first thing you want to do is to set up
18+
[mx](https://github.com/graalvm/mx.git). This is the build tool we use to
19+
develop GraalVM languages. You also need LLVM 6, including the `opt` tool -- the
20+
latter is not included on macOS by default, here you can install the homebrew
21+
version of LLVM, which includes this tool. Note that you can use any JDK, and do
22+
not necessarily need GraalVM for development. In that case you'll only be able
23+
to run without the just-in-time compiler, but that can be fine for making and
24+
testing changes that are not performance sensitive.
25+
26+
Once you have `mx` on your `PATH`, you can run `mx build` in this
27+
repository. This will initially download the required dependencies next to the
28+
repository and build Python. If it succeeds without errors, you should already
29+
be able to run `mx python` and get a REPL.
30+
31+
If you just want to copy and paste some commands, these should get you started:
32+
33+
$ git clone https://github.com/graalvm/mx.git
34+
$ git clone https://github.com/graalvm/graalpython.git
35+
$ cd graalpython
36+
$ ../mx/mx build
37+
$ ../mx/mx python -c "print(42)"
38+
39+
For development, we recommend running `mx ideinit` next. This will generate
40+
configurations for Eclipse, IntelliJ, and Netbeans so that you can open the
41+
projects in these IDEs. If you use another editor with support for the [Eclipse
42+
language server](https://github.com/eclipse/eclipse.jdt.ls) we also had reports
43+
of useable development setups with that, but it's not something we support.
44+
45+
##### Development layout
46+
47+
Besides the source code of the Python interpreter, we have some useful `mx`
48+
functions defined under the `mx.graalpython` directory. As you make changes, you
49+
can test always test them with `mx build && mx python`. Additionally, there are
50+
various "gates" that we use on our CI systems to check any code that goes
51+
in. You can run all of these using `mx python-gate` or just some by using `mx
52+
python-gate --tags [TAG]`. Two interesting gates to run that cover most things
53+
are:
54+
55+
- `python-unittest` - Run the unittests written in Python, including those for the C extension API
56+
- `python-license` - Check that all files have the correct copyright headers applied to them
57+
58+
###### Builtin modules and classes
59+
60+
For the most part, builtin modules and classes are implemented in the
61+
`com.oracle.graal.python.builtins` package. For each module or class, there's
62+
Java class annoted with `@CoreFunctions`. Each function in a module or a class
63+
is implemented in a Node annotated with `@Builtin`. Take a look at the existing
64+
implementations to get a feel for how this is done. For now, when adding new
65+
classes or modules, they need to be added to the list in
66+
`com.oracle.graal.python.builtins.Python3Core`.
67+
68+
Some builtin functions, modules, and classes are implemented in pure Python. The
69+
files for this are in `graalpython/lib-graalpython`. These files are listed in
70+
the Java `com.oracle.graal.python.builtins.Python3Core` class. Take a look at
71+
these files to see what they do. If a file is called exactly as a built-in
72+
module is, it is executed in the context of that module during startup, so some
73+
of our modules are implemented both in Java and Python. If the name matches no
74+
existing module, the file is executed just for the side-effects.
75+
76+
###### Python C API
77+
78+
The C implementation and headers for our C API are in
79+
`graalpython/com.oracle.graal.python.cext`. The naming is analogous to C
80+
Python's source names. This folder also includes a `modules` folder for built-in
81+
modules that we have adapted from C Python.

doc/INTEROP.md renamed to doc/POLYGLOT.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ print(al) # prints [1, 12]
7979
In addition to the `type` builtin method, the `java` module, exposes the following
8080
methods as well:
8181

82-
Builtin | Specification
83-
--- | ---
82+
Builtin | Specification
83+
--- | ---
8484
`instanceof(obj, class)` | returns `True` if `obj` is an instance of `class` (`class` must be a foreign object class)
85-
`is_function(obj)` | returns `True` if `obj` is a Java host language function wrapped using Truffle interop
86-
`is_object(obj)` | returns `True` if `obj` if the argument is Java host language object wrapped using Truffle interop
87-
`is_symbol(obj)` | returns `True` if `obj` if the argument is a Java host symbol, representing the constructor and static members of a Java class, as obtained by `java.type`
85+
`is_function(obj)` | returns `True` if `obj` is a Java host language function wrapped using Truffle interop
86+
`is_object(obj)` | returns `True` if `obj` if the argument is Java host language object wrapped using Truffle interop
87+
`is_symbol(obj)` | returns `True` if `obj` if the argument is a Java host symbol, representing the constructor and static members of a Java class, as obtained by `java.type`
8888

8989
```python
9090
import java

0 commit comments

Comments
 (0)