Skip to content

Commit ce7e382

Browse files
committed
split user and contributor docs
1 parent 03eedd0 commit ce7e382

File tree

10 files changed

+105
-12
lines changed

10 files changed

+105
-12
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,16 @@ manually for now.
7272

7373
### Polyglot Usage
7474

75-
We have a [document](doc/POLYGLOT.md) describing how we implement the
75+
We have a [document](docs/user/POLYGLOT.md) describing how we implement the
7676
cross-language interop. This will hopefully give you an idea how to use it.
7777

78+
### Jython Support
79+
80+
We are working on a mode that is "mostly compatible" with some of Jython's
81+
features, minus of course that Jython implements Python 2.7 and we implement
82+
Python 3.7+. We describe the current status of the compatibility mode
83+
[here](docs/user/JYTHON.md).
84+
7885
### Contributing
7986

8087
I you're thinking about contributing something to this repository, you will need
@@ -83,7 +90,7 @@ Agreement](http://www.graalvm.org/community/contributors/) for us to able to
8390
merge your work. Please also take note of our [code of
8491
conduct](http://www.graalvm.org/community/conduct/) for contributors.
8592

86-
To get you started, we have [written a bit](doc/CONTRIBUTING.md) about the
93+
To get you started, we have [written a bit](docs/contributor/CONTRIBUTING.md) about the
8794
structure of this interpreter that should show how to fix things or add
8895
features.
8996

doc/CONTRIBUTING.md renamed to docs/contributor/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ merge your work.
88

99
Please also take some time to review our [code of conduct](http://www.graalvm.org/community/conduct/) for contributors.
1010

11-
##### Getting started
11+
### Getting started
1212

1313
The first thing you want to do is to set up
1414
[mx](https://github.com/graalvm/mx.git). This is the build tool we use to
@@ -38,7 +38,7 @@ projects in these IDEs. If you use another editor with support for the [Eclipse
3838
language server](https://github.com/eclipse/eclipse.jdt.ls) we also had reports
3939
of useable development setups with that, but it's not something we support.
4040

41-
##### Development layout
41+
### Development layout
4242

4343
Besides the source code of the Python interpreter, we have some useful `mx`
4444
functions defined under the `mx.graalpython` directory. As you make changes, you
@@ -76,7 +76,7 @@ The C implementation and headers for our C API are in
7676
Python's source names. This folder also includes a `modules` folder for built-in
7777
modules that we have adapted from C Python.
7878

79-
##### Debug options
79+
### Debug options
8080

8181
The GraalVM implementation of Python provides proper debug options. It is possible to either debug the Python code, using Chrome debugger,
8282
or the java code, using your preferred IDE.

docs/contributor/DEV_TASKS.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Dev Tasks For Graal Python Developers
2+
3+
### Updating dependencies
4+
5+
We can use the following command to update our CI jsonnet as well as all
6+
dependencies (truffle, sulong, ...) in one go:
7+
8+
mx python-update-import
9+
10+
This should be run on a clean branch that you'll use for the PR. It will search
11+
adjacent directories for other `graalpython*` repositories (such as external
12+
extensions you might have locally) and check if it needs to update something in
13+
those as well. It will also make sure that the CI jsonnet is in sync with the
14+
Graal updates etc. In the end it will tell you which repositories were updated
15+
and pushed. Make sure you open PRs and merge them at the same time for all of
16+
these.
17+
18+
### Updating lib-python
19+
20+
The following command, run on a clean branch, should guide you through updating
21+
our imported sources from CPython and PyPy:
22+
23+
mx python-src-import
24+
25+
It prints a fairly long help. Note that you'll need to make sure you also pushed
26+
your `python-import` branch after doing the update, so that any conflicts you
27+
resolved don't have to be resolved again by the next person.

doc/IMPLEMENTATION_DETAILS.md renamed to docs/contributor/IMPLEMENTATION_DETAILS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Implementation Details
22

3-
## Python Global Thread State
3+
### Python Global Thread State
44

55
In CPython, each stack frame is allocated on the heap, and there's a global
66
thread state holding on to the chain of currently handled exceptions (e.g. if
@@ -80,7 +80,7 @@ exception. Unlike CPython we do not use a stack of currently handled exceptions,
8080
instead we utilize the call stack of Java by always passing the current exception
8181
and holding on to the last (if any) in a local variable.
8282

83-
## Abstract Operations on Python Objects
83+
### Abstract Operations on Python Objects
8484

8585
Many generic operations on Python objects in CPython are defined in the header
8686
files `abstract.c` and `abstract.h`. These operations are widely used and their
File renamed without changes.

docs/user/PACKAGES.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Installing Supported Packages
2+
3+
### Create a virtual environment
4+
5+
The best way of using the GraalVM implementation of Python is out of a virtual
6+
environment. This generates wrapper scripts and makes the implementation usable
7+
from shell as standard Python interpreter. To do so execute the following from a
8+
GraalVM installation:
9+
10+
```
11+
graalpython -m venv <venv-dir>
12+
```
13+
14+
To activate the environment in your shell session call:
15+
16+
```
17+
source <venv-dir>/bin/activate
18+
```
19+
20+
### Using ginstall
21+
22+
At the moment not enough of the standard library is implemented to run the
23+
standard package installers for many packages. As a convenience, we provide a
24+
simple module to install packages that we know to be working (including
25+
potential patches required for those packages). Try the following to find out
26+
more:
27+
28+
```
29+
graalpython -m ginstall --help
30+
```
31+
32+
As a slightly more exciting example, try:
33+
34+
```
35+
graalpython -m ginstall install numpy
36+
```
37+
38+
If all goes well (also consider native dependencies of NumPy), you should be
39+
able to `import numpy` afterwards.
40+
41+
Support for more extension modules is high priority for us. We are actively
42+
building out our support for the Python C API to make extensions such as NumPy,
43+
SciPy, Scikit-learn, Pandas, Tensorflow and the like work. This work means that
44+
some other extensions might also already work, but we're not actively testing
45+
other extensions right now and cannot promise anything. Note that to try
46+
extensions on this implementation, you have to download, build, and install them
47+
manually for now.
48+
49+
### Using PIP
50+
51+
The pip package installer is available and working in a `venv`, but we currently
52+
have no support for SSL. That means you can install packages from PyPI if you
53+
use an HTTP mirror and you can install local packages.
File renamed without changes.

docs/user/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# The Python Implementation for GraalVM
2+
3+
A primary goal of this Python implementation is to support SciPy and its
4+
constituent libraries as well as work with other data science and machine
5+
learning libraries from the rich Python ecosystem. At this point, the Python
6+
implementation is made available for experimentation and curious end-users.

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PolyglotModuleBuiltins.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -112,9 +112,9 @@ public void initialize(PythonCore core) {
112112
String coreHome = context.getCoreHome();
113113
try {
114114
TruffleFile coreDir = env.getInternalTruffleFile(coreHome);
115-
TruffleFile docDir = coreDir.resolveSibling("doc");
116-
if (docDir.exists() || docDir.getParent() != null && (docDir = coreDir.getParent().resolveSibling("doc")).exists()) {
117-
builtinConstants.put(SpecialAttributeNames.__DOC__, new String(docDir.resolve("INTEROP.md").readAllBytes()));
115+
TruffleFile docDir = coreDir.resolveSibling("docs");
116+
if (docDir.exists() || docDir.getParent() != null && (docDir = coreDir.getParent().resolveSibling("docs")).exists()) {
117+
builtinConstants.put(SpecialAttributeNames.__DOC__, new String(docDir.resolve("user").resolve("POLYGLOT.md").readAllBytes()));
118118
}
119119
} catch (SecurityException | IOException e) {
120120
}

mx.graalpython/suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@
380380
"description": "Graal.Python documentation files for the GraalVM",
381381
"layout": {
382382
"README_GRAALPYTHON.md": "file:README.md",
383-
"./": "file:doc",
383+
"./": "file:docs",
384384
},
385385
"maven": False,
386386
},

0 commit comments

Comments
 (0)