metapy: (experimental) Python bindings for MeTA
This fork of metapy aims to simplify the maintenance of the project
for its use in CS 410 Text Information Systems at
the University of Illinois at Urbana-Champaign. Thus, a containerized version of metapy
,
Python wheels, and Google Colab notebooks are provided instead of the original installation instructions for each
platform. The container, based on Ubuntu 22.04 LTS, includes a pre-built version
of MeTA and metapy with support for amd64
and arm64
architectures.
This project provides Python (3.7 - 3.10 are supported) bindings for the MeTA toolkit. They are still very much under construction, but the goal is to make it seamless to use MeTA's components within any Python application (e.g., a Django or Flask web app).
This project is made possible by the excellent pybind11 library.
A Docker image with a pre-built version of MeTA and metapy
is available
on Docker Hub.
docker pull josecols/metapy:0.2.14
This Docker image simplifies the execution of Python scripts that rely on metapy
. For example, to run CS 410 Text
Information Systems MP assignments, simply run the following command at the MP directory's root.
docker run -it --rm --name metapy --mount type=bind,source=$(pwd),target=/app --entrypoint bash josecols/metapy:0.2.14
Then, you can run the Python scripts as usual, e.g., python mp1.py
. Keep in mind that any changes to files in your
current directory that occur within the container will be automatically reflected on your host file system.
Example for MP1
Clone the MP1 repository using Git.
# Use your own MP1 repository
git clone git@github.com:CS410Assignments/MP1.git
Run the Docker container using the MP1
directory as the working directory.
cd MP1/
docker run -it --rm --name metapy --mount type=bind,source=$(pwd),target=/app --entrypoint bash josecols/metapy:0.2.14
Install other dependencies, if needed.
# (inside the container). The `pytoml` package is needed for MP1
pip install pytoml
Run the Python script.
# (inside the container)
python example.py
Download the latest wheel from the releases page corresponding to your
Python and OS version. Then, install the wheel using pip
:
# Ensure your pip is up to date
pip install --upgrade pip
# For Python 3.8 and Linux (x86_64)
pip install https://github.com/illinois/metapy/releases/download/v0.2.14/metapy-0.2.14-cp38-cp38-manylinux_2_24_x86_64.whl
A series of tutorials using Jupyter Notebooks is provided in the tutorials directory. To run the tutorials,
you will need to install Jupyter Notebook and metapy
(see above). Alternatively, each tutorial can be opened
using Google Colab.