- Saved searches
- Use saved searches to filter your results more quickly
- License
- toyai/python-playground
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Python Playground (Python 3 )
- Edit and run this Python 3 example code
- Share «Python Playground»
- Twitter, Facebook, LinkedIn
- IFRAME
- oEmbed (WordPress)
- Embed.ly
- Best Python Playground and Online Python Compiler
- Online Python IDE and Online Python Editor
- Why Python Playground and Online Python Compiler
- Python Examples
- Embed Python Compiler
- About Python
- Python playground на русском
- How to use Python Playground tool?
- What is Python?
- Why learn Python?
- Why use Python Playground?
- Fundamental
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Interactive Playground for Python
License
toyai/python-playground
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Interactive Playground for Python
- Open python files from public GitHub repository. Demo
- Unique URL for every python code/file. Demo
- Embeddable in the documentations. Demo
- Show the python traceback as a result if errors occur. Demo
- Autocompletion for Python builtins.
- Export the code to .py file.
- Mobile friendly.
The original goal of this project is to have interactive examples in the documentation of the python projects like the documentations of the popular JavaScript frameworks.
However since this app is running on the free tier of Netlify and Heroku, we cannot install every python package due to the storage size, memory limit, and version conflicting can occur, too.
So, instead we make a basic app with Python only and let the projects’ maintainers install the required dependencies for their python projects.
To use this app for the python projects:
- Fork this repository.
- Register an account for Netlify and Heroku.
- Put the extra python packages in api/requirements-extra.txt which needs to be creted.
- Deploy the frontend app on Netlify from your forked repository.
- Login with your account at https://app.netlify.com.
- Choose New site from Git .
- Choose GitHub.
- Choose your forked repository.
- Click Deploy site . (Do not worry about the build command and publish directory. Those are already preconfigured.)
- Change the site name in the Site Settings . (The site name will be used as the environment variable in the backend app)
- Deploy the backend app on Heroku from your forked repository.
- Login with your account at https://heroku.com.
- Choose Create new app from New dropdown at the top right corner.
- Give an app name and Click Create app .
- Install Heroku CLI as per your OS.
- Type heroku login in the terminal.
- Type heroku stack:set container -a in the terminal. Replace your-app-name with the previous given app name. This command set the stack of your heroku app to be container which is basically docker. (This step is required since we are going to deploy the backend app as the docker image)
- Choose Connect to GitHub . Choose the forked repository.
- Go to the app Settings . Click Reveal Config Vars .
- Set KEY to be PG_FRONTEND_SITE_NAME .
- Set VALUE to be your netlify site name. Only the site name is required. You can omit .netlify.app .
- If the frontend app will be deployed from custom domain url, set CUSTOM_DOMAIN_URL as KEY and your custom domain url as VALUE . This custom domain url has to be full URL. If you are not sure about the custom domain url, use the output of location.origin in Console tab of DevTool in the browser.
- Go back to Deploy tab. Click Deploy Branch .
- Go back to the frontend app on Netlify. Click Site settings .
- Click Build & Deploy in the left pane. Choose Environment .
- Set PG_BACKEND_SITE_NAME as key and the name of the backend app as value.
- And redeploy the site.
- You have successfully deployed your own version of the Python Playground.
- Since most python projects are using Sphinx as a documentation generator, we have made a sphinx extension – sphinxcontrib-playground. Refer to its documentation for the usage.
- To open a python file from GitHub, append the Playground URL + ? in front of the github url. For example, if the github url is https://github.com/toyai/python-playground/blob/main/api/main.py, then the playground url to open that file will be like: https://python-playground.netlify.app/?https://github.com/toyai/python-playground/blob/main/api/main.py.
NOTE
? is required. https:// can be omitted if you wish though not required.
Python Playground (Python 3 )
This is a simple Python online interpreter, where you can enter Python code, execute it, and view the results.
Edit and run this Python 3 example code
This code is editable and runnable. You can run «Python Playground» by pressing the run button. It will be executed in our backend and the result ( stdout and stderr ) is displayed in addition tabs.
Share «Python Playground»
Share this crumb (Python Playground) with your friends and colleagues to help them learn more about Python 3 programming.
Twitter, Facebook, LinkedIn
On Twitter, Facebook, and LinkedIn, simply paste the URL in your post and watch the magic unfold.
IFRAME
If you want to embed the crumb in an iframe, use the following code:
oEmbed (WordPress)
We support oEmbed, but most sites use allowlisting. On WordPress, oEmbed is supported out of the box, but see the note below.
If you plan to use crumb.sh heavily on WordPress, you can use the following PHP code to allowlist our site and unlock all the functionalities of our crumbs:
wp_oembed_add_provider( ‘https://crumb.sh/*’, ‘https://crumb.sh/oembed/’ );
Embed.ly
Embed.ly is a service that allows you to embed content from other sites. We will request to be added to the list of trusted sites once we’re out of beta.
Best Python Playground and Online Python Compiler
This Python Playground and Online Python Compiler is one of the simplest, most lightweight, and fastest ones out there. Code runs on the browser itself helps in giving the results almost instantly.
There are three ways you can use this.
- Write the code directly in the Python Playground
- Paste the code that you have copied here
- Use the examples section to directly learn and run the example code
Apart from this, it has the following functionalities
- You can quickly copy the code by clicking the copy button
- This Python Playground tool works with Python 3
Online Python IDE and Online Python Editor
This is not just an online compiler for python but a complete playground for python. It has the full functionalities of an online python editor such as multi-color display, line number display, editing, etc. Please try it out and give feedback.
This tool is not a full-fledged IDE such as VSCode or Eclipse but it has core important features such as an editor, compiler, importer, etc. .
Why Python Playground and Online Python Compiler
Python Examples
A lot of important python examples have been built into the compiler itself. Click on the examples link at the top of the python playground and online python compiler to quickly see all the examples organized by categories. When you click on any of the examples, that example will automatically be copied into the Playground/Compiler and you can choose to edit and run the examples.
Below is the list of python examples that are included.
Embed Python Compiler
You will soon be able to embed the python compiler in your own blogs or any HTML pages with a single line of code. Since the compilation happens on the browser, python code runs almost instantly.
Users can use this python playground to compile and run the examples in your python programming article without going out of the website/page. This will increase the engagement of your website with your audience.
About Python
Python has become the most popular programming language after javascript. It is now more used programming language than the other popular programming language such as Java, C# etc.
Python is very easy to learn for beginners and is also used in a variety of computer science applications. It is used in building large-scale backend applications with frameworks such as Django. It is the defacto programming language to build most of the AI & ML, and Deep learning applications. It is also the go-to programming language for Data Science and Data Analytics. Python is also used as a scripting language to build various tools.
There have been attempts even to use python to build frontend applications.
Python playground на русском
How to use Python Playground tool?
- Copy the Python code from other places, paste it into the editing area on the left side of the Python Online Editor tool, or directly enter your Python code
- Click the Run button at the top to execute the code
- The right area will immediately display the running results of the Python code
- You can copy your Python code
- Above the editor on the left, you can select the code examples we provide to quickly experience the functions of the editor
- Below the editor on the left, you can select built-in dependencies for installation, including popular numpy, pandas, lxml, etc.
- Below the output area on the right, click the link icon to copy your code demo URL and share the code with your friends
What is Python?
Python was designed in the early 1990s by Guido van Rossum of the Netherlands Society for Mathematics and Computer Science as an alternative to a language called ABC. Python provides efficient high-level data structures, as well as simple and efficient object-oriented programming. Python syntax and dynamic typing, as well as the nature of an interpreted language, make it a programming language for scripting and rapid application development on most platforms. development of the project.
Why learn Python?
- Python syntax is simple and easy to learn
- Python lets you build more functionality with less code
- Python is cross-platform and open source
- Python can do web backend, web crawler, office automation, data analysis, artificial intelligence, automated testing, desktop applications, etc.
- Rich third-party libraries to meet almost all your development needs
- Active development community, detailed development documents, guides, tutorials
Why use Python Playground?
- Support Python 3.10
- Help beginners learn Python syntax quickly
- Open the browser to write Python code, just use it and go without installing a local Python environment
- Run Python code on the browser side, no need to interact with the server, and the response is fast
- Smart code prompts, auto-completion
- Quickly install third-party libraries
- Share your code with friends online
Fundamental
Pyodide is a Python distribution for the browser and Node.js based on WebAssembly: Pyodide