Skip to main content

Simple web based Python 3 IDE with Brython and Github integration

Project description

Brython-Server

Brython-Server is a Flask-based web application focused on providing a simple Python 3 development environment where source files are hosted on Github.

You can try Brython-Server to get a feel for how it works.

Brief Instructions

When the page loads, you can begin writing Python 3 code right away. To execute your code, press the GO! button.

To load Python 3 source code hosted on Github, you must should first log in to Github with the login button. Github will ask you to authorize Brython-Server in the next page.

To load your source, paste the Github URL of your source file or repository into the text control at the top of the page. Press <Enter> or the load button to retrieve the source from Github.

You may make any changes you want to the source code and re-run it. If you would like to save your work back to Github, just press the commit button.

Turtle

Brython-Server supports the Python turtle to the extent that it is supported by the underlying Brython interpreter. Its usage is simple, but slightly non-standard. For example:

from brythonserver import turtle
t = turtle.Turtle()
t.forward(100)
t.right(90)
t.forward(100)
turtle.done()

Ggame

Brython-Server includes built-in support for the Ggame graphics engine. For example, a trivial program from the Ggame documentation:

from ggame import App, ImageAsset, Sprite

# Create a displayed object at 100,100 using an image asset
Sprite(ImageAsset("bunny.png"), (100, 100))
# Create the app, with a default stage
APP = App()
# Run the app
APP.run()

Deployment

The best way to install Brython-Server is with pip and virtualenv. Create and activate your virtual environment then install Brython-Server with:

pip install brython-server

Requirements

The essential requirements for Brython-Server are met when you install with pip. In addition, you will need to install memcached and, for a production install, gunicorn.

Brython-Server will use Brython as its Python interpreter and and Ggame as its graphics engine. The correct versions of each will automatically be used when you install Brython-Server using pip.

Environment

A full Brython-Server installation that is capable of interacting with Github should have several environment variables set for production use:

  • githubtoken (an optional Github personal access token)
  • githubsecret (Github oauth secret)
  • githubclientid (Github oauth client id)
  • flasksecret (A Flask application secret key)
  • sitetitle (A string that will be displayed as the "name of the site")
  • sitecontact (An e-mail address to use for contact)
  • siteurl (A full URL to the website)

Note: to generate a unique, random Flask secret key, enter the following in a Python console:

>>> import os
>>> os.urandom(24)

Use the string that results as the value of the flasksecret environment variable.

Execution

To run the server in stand-alone development mode (never in production!) execute (for example) from the Python 3 shell:

Python 3.7.0 (default, Oct  4 2018, 21:19:26)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from brythonserver.main import APP
Update Brython scripts to verion 3.7.3
>>> APP.run(host="0.0.0.0", port=3000)
 * Serving Flask app "brythonserver.main" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:3000/ (Press CTRL+C to quit)

To run the server in a production environment, use gunicorn:

$ gunicorn -b 0.0.0.0:3000 -w 4   brythonserver.main:APP

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brython-server-2.0.4.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

brython_server-2.0.4-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file brython-server-2.0.4.tar.gz.

File metadata

  • Download URL: brython-server-2.0.4.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0

File hashes

Hashes for brython-server-2.0.4.tar.gz
Algorithm Hash digest
SHA256 6f8b2c7bfe9ed228b8d6b56f8eb881cb31c86883ba4923900351a87891099545
MD5 4de94f73b463649ef4c6544fe53d6d00
BLAKE2b-256 35c809aad426c85c31cb9e65560a673dc04e4bc7bf7bcbbcef5a99c5bd1c2a1c

See more details on using hashes here.

File details

Details for the file brython_server-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: brython_server-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0

File hashes

Hashes for brython_server-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3886919e7f469149e7b988c7d89858871b3dafaae00684e3ca27b3e459455b21
MD5 bafec2f05d68eb83c77d928b970526d3
BLAKE2b-256 52a77419b79b66c1722b69b5cb7530ba9ed201af42c5679f4831ae42ce827e0e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page