Skip to content

pyscript/pyscript-packages

Repository files navigation

PyScript Package Tracker 📦

A simple website to display Python package support within PyScript.

Use this site to check if a certain Python package is supported in the PyScript ecosystem (both Pyodide and MicroPython).

On the site's front page is a list of the most popular Python packages on PyPI (collected via https://pypistats.org/), along with an indication via RAG (red/amber/green 🚦) of the package's status for use with PyScript. A red status 🟥 means the package is not, or cannot be supported by PyScript, an amber status 🟨 means either the status of PyScript support is unknown or requires adjustment, and a green status 🟩 means the package is supported by PyScript. Clicking on the package takes you to the page for that package with more details.

At the top of the front page is a search box for package names on PyPI 🔍. Hitting return or pressing the "search" button returns a page for the given package name. If no package exists with this name you'll be prompted to search PyPI for the correct / matching package.

Each package has a page for it. The url for such page will be via the /package?package=<package_name> endpoint.

This page will display three possible states:

  1. Red (this package is not supported by PyScript). Information about why this package isn't supported by PyScript will be displayed.
  2. Amber (the status of this package is unknown or pending). The website will automatically try to serve a simple PyScript based project using this package, so importing the package can be attempted. A form will be displayed to allow folks to submit a report about the status of the package.
  3. Green (this package is supported by PyScript). Any information about special cases for this package will also be displayed.

API

The PyScript Packages website offers a simple API to access package information programmatically.

Retrieve the status and metadata of packages in JSON format by making a GET request to the following endpoint:

GET /api/package/<package_name>.json

This will return a JSON object containing the following metadata (or respond with a 404 status code if the package is not found):

  • status: The support status of the package (e.g., "green", "amber", "red").
  • summary: The summary of the package from PyPI.
  • notes: Brief notes, in Markdown, about the package's compatibility with PyScript.
  • updated_by: The name or handle of the person who last updated this information.
  • updated_at: The ISO 8601 timestamp of when this information was last updated.

For example, in Python, you can use the requests library to fetch such data about the pandas package:

import requests

response = requests.get("https://pkg.pyscript.net/api/package/pandas.json")
if response.status_code == 200:
    package_data = response.json()
    print(package_data)
else:
    print("Package not found or API error.")

If you wish to access data for all packages at once, you can use the following endpoint:

GET /api/all.json

Data about the top 100 packages is also available through this endpoint:

GET /api/top_100_pypi_packages.json

Developer Setup

This is a very simple static website.

  1. Fork the project found at: https://github.com/pyscript/pyscript-packages
  2. Clone your fork of the repository, and change into the resulting directory:
$ git clone git@github.com:<YOUR_USERNAME>/pyscript-packages.git
$ cd pyscript-packages
  1. Start a local server:
$ python -m http.server
  1. Visit localhost:8000 to see the site working!
  2. To build and refresh the site's data, ensure you have requests installed and run:
$ python build_data.py
  1. The home.py fragment is the PyScript code for the front page. The /package/main.py fragment is the PyScript app for displaying specific package information.

That's it! Feel free to create PR's via GitHub. Thank you! 💐

Acknowledgements

Anaconda

Huge thanks to Anaconda for their continued support of PyScript.

About

A simple website to display Python package support within PyScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published