FCP-INDI / C-PAC

Configurable Pipeline for the Analysis of Connectomes
https://fcp-indi.github.io/
GNU Lesser General Public License v3.0
64 stars 40 forks source link

📦️ PEP 518: Set `[build-system]` in `pyproject.toml` #2111

Closed shnizzedy closed 4 months ago

shnizzedy commented 4 months ago

Related to

Related to :snake: PEP 518 – Specifying Minimum Build System Requirements for Python Projects Related to :octocat:/childmindresearch/nodeblock-testing

Description

  1. Adds a pyproject.toml file with just a license and build system requirements https://github.com/FCP-INDI/C-PAC/blob/3f23711275ebcb5de6ca99ed338c26d6ea230f42/pyproject.toml#L17-L19
  2. Prepends the source path to sys.path https://github.com/FCP-INDI/C-PAC/blob/3f23711275ebcb5de6ca99ed338c26d6ea230f42/setup.py#L50-L51 to be able to import from CPAC.info at build-time https://github.com/FCP-INDI/C-PAC/blob/3f23711275ebcb5de6ca99ed338c26d6ea230f42/setup.py#L52-L67
  3. Switches the PyPEER dependency from https://github.com/ChildMindInstitute/PyPEER/commit/6965d2b2bea0fef824e885fec33a8e0e6bd50a97 (⚠️ This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.) to https://github.com/shnizzedy/PyPEER/commit/6965d2b2bea0fef824e885fec33a8e0e6bd50a97
  4. Moves pygraphviz from requirements to optional requirements in the "graphviz" extras, and updates all the Dockerfiles to install with the "graphviz" extras.

Technical details

  1. C-PAC was created long before the current Python packaging standards were formalized (e.g., the current standard uses a pyproject.toml file, and the initial release of TOML hadn't come out when this project started). The build system in C-PAC is pretty idiosyncratic, using Python 3 and setuptools but with style remnants from Python 2 and distutils, with some nipype and numpy flavor sprinkled in. I think we'll eventually want to migrate most-to-all of the build info to pyproject.toml, but for the prototype of :octocat:/childmindresearch/nodeblock-testing, defining the build system is all we need.
  1. PyPEER is pretty stale (ChildMindInstitute/PyPEER#28), and none of us except @js545 have write access to that repo. In the current build style, GitHub finds the commit in its global tree, but some builders (at least poetry) are more careful and won't grab the commit if it's not in the specified fork.
  2. Some dev or testing environments don't have graphviz installed, and don't necessarily need it. With this packaging change, we'll still always have it in the image, but for things like :octocat:/childmindresearch/nodeblock-testing we don't have to install graphviz just to import some CPAC functions.

Checklist

Developer Certificate of Origin

Developer Certificate of Origin ``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ```