Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ“¦οΈ PEP 518: Set [build-system] in pyproject.toml #2111

Merged
merged 5 commits into from
May 22, 2024

Conversation

shnizzedy
Copy link
Member

@shnizzedy shnizzedy commented May 10, 2024

Related to

Related to 🐍 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

    C-PAC/pyproject.toml

    Lines 17 to 19 in 3f23711

    [build-system]
    requires = ["nipype", "numpy", "pyyaml", "setuptools", "voluptuous"]
    build-backend = "setuptools.build_meta"
  2. Prepends the source path to sys.path

    C-PAC/setup.py

    Lines 50 to 51 in 3f23711

    # prepend this file's parent directory to sys.path to find CPAC when building
    sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
    to be able to import from CPAC.info at build-time

    C-PAC/setup.py

    Lines 52 to 67 in 3f23711

    from CPAC.info import (
    AUTHOR,
    AUTHOR_EMAIL,
    CLASSIFIERS,
    DESCRIPTION,
    DOWNLOAD_URL,
    LICENSE,
    LONG_DESCRIPTION,
    MAINTAINER,
    MAINTAINER_EMAIL,
    NAME,
    PLATFORMS,
    REQUIREMENTS,
    URL,
    VERSION,
    )
  3. Switches the PyPEER dependency from ChildMindInstitute/PyPEER@6965d2b (⚠️ This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.) to shnizzedy/PyPEER@6965d2b
  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 (πŸ”– Tag / release changes since peer-betaΒ 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

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the develop branch of the repository.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I updated the changelog.
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

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.

@shnizzedy shnizzedy self-assigned this May 10, 2024
@shnizzedy shnizzedy added this to the 1.8.8 release milestone May 10, 2024
@shnizzedy shnizzedy added the python Pull requests that update Python code label May 10, 2024
@shnizzedy shnizzedy requested a review from a team May 17, 2024 18:56
@shnizzedy shnizzedy merged commit 5bcde5b into develop May 22, 2024
43 checks passed
@shnizzedy shnizzedy deleted the pyproject.toml branch July 3, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops python Pull requests that update Python code
Projects
Status: βœ… Done
Development

Successfully merging this pull request may close these issues.

2 participants