Skip to content

Commit

Permalink
Add src/main/resources/venv/pyvenv.cfg to gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
olyagpl committed Feb 12, 2024
1 parent b2d7f86 commit cc37f09
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions polyglot-chat-app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ out/
.settings
.classpath
.factorypath
src/main/resources/venv/pyvenv.cfg
20 changes: 14 additions & 6 deletions polyglot-chat-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@
This example demonstrates how to integrate Python on GraalVM with a Micronaut application.
The application uses the Gradle build tool.

## Preparation
## Preparation`

1. Download and install the latest GraalPy as described in the [Getting Started guide](https://www.graalvm.org/latest/reference-manual/python/#installing-graalpy). For example on Linux:
1. Download or clone GraalVM demos repository and navigate into the `polyglot-chat-app` directory:
```bash
git clone https://github.com/graalvm/graalvm-demos
```
```bash
cd graalvm-demos/polyglot-chat-app
```

2. Download and install the latest GraalPy as described in the [Getting Started guide](https://www.graalvm.org/latest/reference-manual/python/#installing-graalpy). For example on Linux:
```bash
wget https://github.com/oracle/graalpython/releases/download/graal-23.1.1/graalpy-23.1.1-linux-amd64.tar.gz
tar xzf graalpy-23.1.1-linux-amd64.tar.gz
```
``
2. Create a virtual environment for this demo in the _resources_ directory, and install the required packages:
3. Create a virtual environment for this demo in the _resources_ directory, and install the required packages:
```bash
graalpy-23.1.1-linux-amd64/bin/graalpy -m venv src/main/resources/venv
```
Expand All @@ -22,7 +30,7 @@ The application uses the Gradle build tool.
src/main/resources/venv/bin/graalpy -c "import nltk; nltk.download('vader_lexicon')"
```
3. (Optional) Download and install GraalVM JDK for Java 21 or later to run Python with runtime compilation and to build a native image.
4. (Optional) Download and install GraalVM JDK for Java 21 or later to run Python with runtime compilation and to build a native image.
The demo will work on any OpenJDK distribution, but will be much faster on GraalVM JDK.
## Building and Running the Application:
Expand Down Expand Up @@ -62,7 +70,7 @@ The Python code has to be shipped in a _resources_ directory that is kept next t
3. Run the native executable:
```bash
build/native/nativeCompile/websocket.chat
./build/native/nativeCompile/websocket.chat
```
### Learn More
Expand Down

0 comments on commit cc37f09

Please sign in to comment.