Sitemap
PythonIQ

Take your Python coding to the next level and learn from others with these practical, thought-provoking, and insightful articles. We’re all about programming in Python.

Member-only story

Write Chrome Extensions in Python (Part 1)

4 min readNov 11, 2022

--

Press enter or click to view image in full size
Screenshot by author: Chrome in dark mode with an extension written in Python/PyScript

PyScript has been around for a while now and provides a remarkably easy way to embed Python code directly into HTML pages. But until now, the creation of browser extensions in Python has been something of a closed door — a private members’ club exclusively for JavaScript developers. Well, not any more!

I was lucky enough to enlist the help of PyScript’s Engineering Manager and finally worked out how to run a Python script as a Chrome Extension, displaying output and providing interaction via a Popup box (see the screenshot above). This throws the doors wide open to all sorts of other Python/PyScript possibilities, building on the foundations which I’m about to share…

Create Your Extension Files

Create a new folder for your Extension and download or clone the following repository into it:

  1. Add your own Python code in between the <py-script> tags and/or <py-repl>in popup.html .

--

--

Pete Fison
Pete Fison

Written by Pete Fison

Experienced Python developer with a special interest in web scraping, data wrangling, ETL, NLP, APIs, and AI. Former IT Director & Video Producer.

PythonIQ
PythonIQ

Published in PythonIQ

Take your Python coding to the next level and learn from others with these practical, thought-provoking, and insightful articles. We’re all about programming in Python.