Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Commit

Permalink
[docs] Add Python language guide (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hellum authored and jankeromnes committed Jan 20, 2020
1 parent 803ae1e commit 79748b7
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 1 deletion.
Binary file added src/docs/images/AReplExample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/docs/images/python_Test_In_Gitpod.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 86 additions & 1 deletion src/docs/python_in_gitpod.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,88 @@
# Python

> 🚧 Please help improve this guide by [editing it](https://gitpod.io/#https://github.com/gitpod-io/website/blob/master/src/docs/python_in_gitpod.md).
Gitpod comes with great support for Python builtin. Still, depending on your project, you might want to further optimize the experience.

## Examples

Before we get started, here are some examples of already-[gitpodified](https://www.gitpod.io/blog/gitpodify/) repositories!

| Name | Description | Try it |
-----------|-----------------------------------------------------------|----------------------------------------------------
| [gitpod-io/django-locallibrary-tutorial](https://github.com/gitpod-io/django-locallibrary-tutorial) | An example website written in Django by MDN | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#gitpod-io/django-locallibrary-tutorial) |
| [JesterOrNot/Gitpod-PyQt](https://github.com/JesterOrNot/Gitpod-PyQt) | A PyQt example for Gitpod | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/JesterOrNot/Gitpod-PyQt) |
| [gitpod-io/wxPython-example](https://github.com/gitpod-io/wxPython-example) | A wxPython example for Gitpod | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/gitpod-io/wxPython-example) |
| [techwithtim/Hangman](https://github.com/techwithtim/Hangman) | A wxPython example for Gitpod | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/techwithtim/Hangman) |


## GUI Applications with wxPython

To install wxPython to your repository please add the following to your [`.gitpod.Dockerfile`](https://www.gitpod.io/docs/42_config_docker/). If you don't have one, simply run [`gp init`](https://www.gitpod.io/docs/34_command_line_interface/) and commit the two generated files.

```dockerfile
# This will pull the official Gitpod `vnc` image
# which has much of what you need to start
FROM gitpod/workspace-full-vnc

USER gitpod

# Install wxPython dependencies
RUN sudo apt-get -q update && \
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq freeglut3-dev python3.7-dev libpython3.7-dev libgl1-mesa-dev libglu1-mesa-dev libgstreamer-plugins-base1.0-dev libgtk-3-dev libnotify-dev libsdl2-dev libwebkit2gtk-4.0-dev libxtst-dev libgtk2.0-dev && \
sudo rm -rf /var/lib/apt/lists/*

# Install wxPython
RUN pip3 install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/ wxPython
```

Here is a corresponding [`.gitpod.yml`](https://www.gitpod.io/docs/41_config_gitpod_file/) example:

```yaml
image:
file: .gitpod.Dockerfile

# This will expose all necessary ports needed for your VNC image
ports:
- port: 6080
onOpen: open-preview
- port: 5900
onOpen: ignore
- port: 35900
onOpen: ignore

# This will make it so that on workspace start it will run a file called `app.py`
tasks:
- command: python3 app.py
```
<br>
We also support other GUI frameworks such as Kivy and PyQt
<br>
Here are some other examples of Python GUI applications in Gitpod:
| Name | Framework | Try it |
|------------------|----------------|-----------|
| Tic-Tac-Toe-GUI | Kivy | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/JesterOrNot/Tic-Tac-Toe-GUI) |
| Pong | Kivy | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/JesterOrNot/Pong) |
| Gitpod-PyQt | PyQt | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/JesterOrNot/Gitpod-PyQt) |
<br>
## VSCode Extensions
While the most popular Python VSCode extensions are built-in to Gitpod, here are a few "Nice to have" extensions that you can use as well.
### ARepl for Python
![](./images/AReplExample.gif)
ARepl for Python is helpful for constantly checking your code and debugging.
To install this extension for your repository, add the following to your `.gitpod.yml`:
```yaml
vscode:
extensions:
- [email protected]:Uu7lIOwyLgmNWpTwCl/iqQ==
```
### Python Test Explorer
![](./images/python_Test_In_Gitpod.png)
Easily test your python extensions with the Python Test Explorer.
To add this to your repository add the following to your `.gitpod.yml`
```yaml
vscode:
extensions:
- [email protected]:tZ/6xOSSdKUaq6JCUVkD+A==
```

0 comments on commit 79748b7

Please sign in to comment.