Skip to content

Instantly share code, notes, and snippets.

@nikhilkumarsingh
Created May 10, 2020 11:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhilkumarsingh/c4a2ab60759fd125ee03651be46e55ae to your computer and use it in GitHub Desktop.
Save nikhilkumarsingh/c4a2ab60759fd125ee03651be46e55ae to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# To install PyPy3\n",
"\n",
"### Ubuntu\n",
"\n",
"```bash\n",
"sudo add-apt-repository ppa:pypy/ppa\n",
"sudo apt update\n",
"sudo apt install pypy3\n",
"```\n",
"\n",
"### Mac\n",
"\n",
"```bash\n",
"brew install pypy3\n",
"```\n",
"\n",
"### Windows\n",
"\n",
"Go to [pypy.org/download](https://www.pypy.org/download.html) and download **Window Binary (32bit)**.\n",
"\n",
"\n",
"----------------\n",
"\n",
"# To install pip\n",
"\n",
"### Ubuntu\n",
"\n",
"```bash\n",
"wget https://bootstrap.pypa.io/get-pip.py\n",
"pypy3 get-pip.py\n",
"```\n",
"\n",
"### Mac & Windows\n",
"\n",
"```bash\n",
"pypy3 -m ensurepip\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Notes\n",
"\n",
"PyPy is a python implemenatation whose interprter has been written in RPython.\n",
"\n",
"PyPy is a reimplementation of Python in Python, using the RPython translation toolchain.\n",
"\n",
"> We aim to provide a compliant, flexible and fast implementation of the Python Language which uses the RPython toolchain to enable new advanced high-level features without having to encode the low-level details. We call this PyPy.\n",
"\n",
"RPython language is a restricted subset of the Python language. \n",
"\n",
"RPython is a framework for implementing interpreters and virtual machines for programming languages, especially dynamic languages.\n",
"\n",
"To make it more clear, we start with source code written in RPython, apply the RPython translation toolchain, and end up with PyPy as a binary executable. This executable is the Python interpreter.\n",
"\n",
"When a interpreter written in RPython is translated into an executable, the executable contains a full virtual machine that **can optionally include a Just-In-Time compiler**. This JIT compiler is generated automatically from the interpreter that we wrote in RPython.\n",
"\n",
"\n",
"Just-in-time compilation is a technique to increase execution speed of programs by compiling parts of a program to machine code at runtime.\n",
"\n",
"PyPy further supports an enhanced version of Python programming language — Stackless Python. Stackless Python is executed thread-based programs more efficiently than Python. It even helps programmers to avoid some of the complexity and performance issues related to conventional threads. While using PyPy, the programmers can even speed up applications by writing code in concurrent style.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](https://rpython.readthedocs.io/en/latest/_images/translation-greyscale-small.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](https://rpython.readthedocs.io/en/latest/_images/graphviz-170ef58d3331805d93fe0a9bfb194870a6a21ed6.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# References\n",
"\n",
"- https://doc.pypy.org/en/latest/introduction.html\n",
"- https://doc.pypy.org/en/latest/architecture.html\n",
"- https://rpython.readthedocs.io/en/latest/translation.html\n",
"- https://rpython.readthedocs.io/en/latest/jit/index.html\n",
"- https://en.wikipedia.org/wiki/Tracing_just-in-time_compilation\n",
"- https://www.pypy.org/download.html"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRJhVJJqOWtBZPuix-Q10lq-ocYrPKB3_LgqKZrVRXqfvNUCwj9&usqp=CAU)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment