amazon-ion / ion-python

A Python implementation of Amazon Ion.
https://amazon-ion.github.io/ion-docs/
Apache License 2.0
261 stars 51 forks source link

Migrate to pyproject.toml #379

Open nirosys opened 1 month ago

nirosys commented 1 month ago

NOTE: DO NOT MERGE YET.

Issue #, if available: #305

Description of changes: This PR migrates ion-python over to a pyproject-based project. As part of this, it makes use of py-build-cmake in order to build both the extension and the ion-c submodule. This is a change from prior to this PR, where ion-c was ultimately downloaded and built during the execution of install.py. This will make it easier for developers to make debug builds of the extension, without having to modify install.py, and will allow us to more easily keep the ion-c dependency up-to-date.

Building the extension is now a simple:

$ python -m build
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - py-build-cmake~=0.1.8
* Getting build dependencies for sdist...
...
* Building wheel...
...
[100%] Built target _ioncmodule
-- Installing: /var/folders/ld/sktjjrk132z_f7_95g908dxr0000gr/T/tmp4ekl7bjs/staging/amazon/_ioncmodule.so
Successfully built amazon_ion-0.12.0.tar.gz and amazon_ion-0.12.0-cp312-cp312-macosx_13_0_x86_64.whl
(venv) glitch@147dda5e5395 ~/C/ion-python>

With the pyproject.toml we're able to place requirements into groups, allow us to separate the benchmarking dependencies from the user facing dependencies.

The C and python code has been split. All python code is now located in src-python/, and the c code is now in src/, this is a pattern that py-build-cmake uses, and works out pretty nicely.

Status

I need to incorporate some of the recent PRs into this PR, as well as the in-flight PR, and document the changes.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.