PyCapsule is an appreciation project for Python, it is a project for
preserving stories from Python users about
their journey with the Python language over the years.
PyCapsule is unique in that it is one of the very few websites
on the web whose both
Yes, the front-end is client-side rendered using Python and a
Python interpreter. are written in Python and front-end Due to the development of WASM and the
Pyodide project, you can now execute Python code within
the browser, and can access the DOM in your Python code. I
recommend you view the source code of this page in your browser
to see the python code in use, and recommend you check out the
Python is a language with a long history, and I never thought I
would see the day where it could be run in the browser. I hope
this project can capture some of the history from its users, and
can't wait to see what the future holds for Python.
Note: Some mobile and desktop browsers may not have the necessary WASM or JS API's
to run this application. Try using Firefox or Chrome on the computer for best results.
Add a Post to PyCapsule
The PyCapsule is currently closed. Thanks to all for making posts! I've kept the source
code of the page the same so others can study the source, but have detached the
AWS Post Lambda from the API gateway to prevent further posting.
Post (characters remaining:
What is PyCapsule?
PyCapsule is a small project for preserving Python's history by hearing the
stories of its users, while also showcasing what the future of python
might look like.
Why did you make PyCapsule?
I have been using Python for years. It's an amazing language with an
incredible community who built the entire thing from the ground
up through the gradual contributions of thousands of individuals. The web,
similarly, is an amazing platform that has seen huge innovations,
especially within the past decade. When I found the Pyodide project,
tested out the functionality, and saw the potential future of
python on the web, I was inspired to put together a website that
preserves the past of the language and showcases what the future of
language might hold.
How are you using Python in the browser?
At the top level of the tech stack I am using
is a project by Mozilla
that brings Python (as well as many libraries
commonly used in the Python scientific stack such as
Matplotlib) to the browser via
WebAssembly is a binary-code format for executable programs
that allows you to achieve near native execution speed in the
browser and else where.
What are you using for the back-end for PyCapsule?
On the back-end I am using Python coded
AWS Serverless Lambdas
(using Python 3.8 and the
boto3 SDK) attached to an
AWS API gateway, as well as a NoSQL
AWS DynamoDB database to store the data.
How many posts can I make?
As many as you want. There is a rate limiter that will allow
an IP address to only make 2 posts a day. When a post is made,
a salted hash of the IP address is stored within the database to
implement the rate limiting.
Should I use Python in the browser for my web app?
Running Python in the browser to create web applications is very fun and
an interesting take on where web development might end up in the future.
Given the current limitations of WASM and its relatively short history,
the size of shipping a Python interpreter through the network, the
cost from running multiple languages in the browser, and the
lack of WASM support by older browsers,
it is best to stick with your current
technology stacks for making web applications. However for small
hobby projects it can be fun to use and works quite well!
the source code for this project, while almost the entire web application is
to interface between Python and the browser. Additionally, Web API's, like the
Python acting as an interface to these API's. However, it is possible that in
the future WASM could develop further to the point where it can interface with
the DOM directly and can be used to create full blown web applications that use
There are quite a few actually! One well known one used primarily for making web
applications is the
Blazor project by Microsoft,
which uses the Mono C# runtime compiled to WASM and allows you to create web applications
the background to interface with WASM, the browser, and the DOM in your C# code.
Here is a list of some lesser known projects that allow you to use other languages
in the browser:
What is the future of Python in the browser?
Python may become a truely viable option for the browser in the future
to make SPAs and other web applications. WASM is improving and becoming
faster, projects like
may allow for smaller Python interpreters
to be shipped, tools can be made to only include the Python code that is
actually used in the application, and caching from CDNs can make load times
much faster (especially if multiple websites are using Python and linking to
the same CDN). I think it is possible that Python may have a future in the
browser and on the web outside of the server!