#73·pifs

πEP 314: Python bindings

Author: MaxwellWibertCreated Dec 19, 2023Updated Dec 19, 2023

Let's imagine for a moment, the possibilities that would avail themselves if we were somehow able to combine the beauty and elegance of Python with the incredible efficiency of πfs. It would be great if we could add python bindings for this library using Python's CFFI, and publish it as a Python package, which I propose be called pyπfs . We can host pyπfs on the Python Package Index (which is developed and maintained by the Python Packaging Authority), with a set of optional dependencies that allow us to pipe the output of pyπfs into modules from other libraries, like SciPy.io.

Then whenever we need to access the filesystem pipes in a new SciPy project, we simply have to run

bash
pip install SciPy pyπfs[πiopipes] # (from the PyPI)

or, if perhaps you prefer PyPy, you could run

bash
pypy -m pip install SciPy pyπfs[πiopipes] # (from PyPI (by the PyPA))

Naturally, once a user has installed pyπfs once on their system, they should no longer need to make calls to the PyPI since, all of its packages are already in the digits of $\pi$, so I further propose we include a utility module, πιπ which retrieves any package you might need from the πfs-encoded python package index. Obviously for security and sustainability, we should form a committee that ensures that any package indexed in the πPyPI adheres with best practices, i.e. is πEP compliant. The πPyPA would do just that. When our work is done the above installation is as simple as

bash
pypy -m πfs.πιπ install SciPy pyπfs[πiopipes] # (from πPyPI (by the πPyPA))

Then in our python code we could load arrays into the program from the πfs as follows

python
from pyπfs import πiopipes, πpath
import scipy.io

with πiopipes.pipe(scipy.io) as scipyπiopipe:
     Io_πpath = πpath.join("path", "to", "Io.io")
     Io = scipyπiopipe.read(Io_πpath)

Simple. Elegant. Efficient. Need I say more?