jpuigcerver / openfst-python

Self-contained Python package for OpenFst
Apache License 2.0
50 stars 12 forks source link

Implement PEP-518 configuration #7

Open ianlini opened 1 year ago

ianlini commented 1 year ago

PEP-518 becomes very essential nowadays. It prevents multi-step pip install when building from source:

# before
pip install setuptools requests cython
pip install openfst-python

# after
pip install openfst-python

Besides, tools like Poetry won't even work if the build requirements are not defined using PEP-518.

Reference: Build System Support - setuptools.

What I have tested (using CPython 3.8.10):

  1. pip install . without installing any Python packages beforehand.
  2. pip install git+https://github.com/ianlini/openfst-python.git@pep-518, which is actually very similar to 1.
  3. python -m build --sdist and then pip install dist/openfst_python-1.7.9.tar.gz.
  4. python -m build --wheel and then pip install dist/openfst_python-1.7.9-cp38-cp38-linux_x86_64.whl.

All of them work as expected.

However, I didn't test create_wheels.sh because it looks quite complicated. I also recommend adding python -m build --sdist into create_wheels.sh so that you won't forget to publish the source distribution. For example, 1.7.3 on PyPI doesn't include the source distribution.