Skip to content

Initial version of pre-commit "Check SPDX-License-Identifier" #625

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

Merged
merged 16 commits into from
May 14, 2025

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented May 12, 2025

Description

Closes #586

Minimalistic implementation: toolshed/check_spdx.py

New .spdx-ignore: enumerates all files that do not contain SPDX-License-Identifier:

Copy link
Contributor

copy-pr-bot bot commented May 12, 2025

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@rwgk rwgk marked this pull request as ready for review May 12, 2025 17:45
Copy link
Contributor

copy-pr-bot bot commented May 12, 2025

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@rwgk rwgk requested a review from kkraus14 May 12, 2025 17:46
@rwgk
Copy link
Collaborator Author

rwgk commented May 12, 2025

@kkraus14 @leofang Currently we have:

$ git ls-files | wc -l
340
$ tail -n +2 .spdx-ignore | wc -l
195

Do you want to do the cleanup (add missing SPDX identifiers) in this PR, or separately?

@leofang
Copy link
Member

leofang commented May 12, 2025

Let's exclude the following files:

  • .gitattributes & .gitignore: it is just odd to even touch Git-related files
  • .github/BACKPORT_BRANCH: adding comments to this file requires fixing parsing logics
  • all markdown (.md) files: I've never see copyright statements or spdx identifiers added to them
  • all LICENSE files: ditto, they need to be presented exactly with the verbatim from legal as-is
  • all binary files (ex: .png)
  • all files under cuda_bindings/examples:
  • cuda_core/cuda/core/experimental/dlpack.h: this is vendored from the public repo, we should not change its license

@rwgk
Copy link
Collaborator Author

rwgk commented May 12, 2025

Let's exclude the following files:

  • .gitattributes & .gitignore: it is just odd to even touch Git-related files

  • .github/BACKPORT_BRANCH: adding comments to this file requires fixing parsing logics

  • all markdown (.md) files: I've never see copyright statements or spdx identifiers added to them

  • all LICENSE files: ditto, they need to be presented exactly with the verbatim from legal as-is

  • all binary files (ex: .png)

  • all files under cuda_bindings/examples:

  • cuda_core/cuda/core/experimental/dlpack.h: this is vendored from the public repo, we should not change its license

All done.

This is a full cleanup now:

  • The .spdx-ignore file is much smaller now, and uses the exact same syntax as .gitignore (implemented via pathspec.PathSpec.from_lines("gitwildmatch", lines)).

  • I fixed up all other files. Please see the individual commits for the steps.

  • As the last step, I removed the EULA paragraphs, thinking that they are obsolete after adding the SPDX-License-Identifier lines. (That's easy to undo, if necessary.)

Could you please do a full review?

After this PR is approved I will:

  • Trigger GitHub Actions. — To not waste CI runner time, I only tested locally thus far; it seems pretty unlikely that the changes here cause breakages.

  • Backport the changes here to the code generator inputs (and verify that the code generator outputs match what we have here).

  • Wait for you to review the code generator changes, then merge everything in short succession.

leofang
leofang previously approved these changes May 12, 2025
Copy link
Member

@leofang leofang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the cleanup, Ralf!

As the last step, I removed the EULA paragraphs, thinking that they are obsolete after adding the SPDX-License-Identifier lines.

Yes, I agree this makes it cleaner. The two lines (copyright & SPDX license identifier) are enough.

@leofang leofang added this to the cuda.core beta 4 milestone May 13, 2025
@leofang leofang added support All things related to the project that can't be categorized P1 Medium priority - Should do cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module labels May 13, 2025
@rwgk
Copy link
Collaborator Author

rwgk commented May 13, 2025

/ok to test 85e0182

This comment has been minimized.

@kkraus14
Copy link
Collaborator

If we're doing a big cleanup here, we should also move the copyright statements to use SPDX copyright statements instead. I.e. SPDX-FileCopyrightText.

@rwgk
Copy link
Collaborator Author

rwgk commented May 13, 2025

If we're doing a big cleanup here, we should also move the copyright statements to use SPDX copyright statements instead. I.e. SPDX-FileCopyrightText.

Sounds good. I could try to squeeze that in later (another weekend). I wouldn't know what exactly to do though. Could you please describe the exact requirements in an issue?

@kkraus14
Copy link
Collaborator

Might be worth trying this pre-commit hook as well: https://github.com/espressif/check-copyright

It looks to have the ability to automatically update files that don't meet the check as well?

@rwgk
Copy link
Collaborator Author

rwgk commented May 13, 2025

It looks to have the ability to automatically update files that don't meet the check as well?

We have the unusual situation that we have to backport to the code generators (in two different repos), which is probably 99% of the manual work, as it stands.

I want to propose to take one step at a time.

  • Let's get into a clean(er) state with something straightforward like this PR. — This PR takes care of SPDX-License-Identifier and is basically done already, except for the work to backport.

  • Follow-on PR to take care of SPDX-License-Identifier. (Whenever I get to it, considering main priorities; currently CCCL C: NVRTC and nvJitLink should be loaded at run-time instead of dynamically linked cccl#3979)

  • Then maybe swap out the (really small) toolshed script with an off-the-shelf pre-commit hook.

@rwgk

This comment was marked as off-topic.

@rwgk rwgk changed the title [WIP] Initial version of pre-commit "Check SPDX-License-Identifier" Initial version of pre-commit "Check SPDX-License-Identifier" May 13, 2025
@rwgk
Copy link
Collaborator Author

rwgk commented May 13, 2025

/ok to test 9c54b37

@rwgk
Copy link
Collaborator Author

rwgk commented May 13, 2025

@leofang Assuming testing here passes as expected, this PR and the cython-gen update are ready for merging.

@rwgk
Copy link
Collaborator Author

rwgk commented May 13, 2025

Forgot to add: no changes needed for cybind

@leofang
Copy link
Member

leofang commented May 14, 2025

Everything as before, but using -DCMAKE_BUILD_TYPE=MinSizeRel, I'm also getting the double free or corruption error.

I am not sure I follow -- what's this for?

@rwgk
Copy link
Collaborator Author

rwgk commented May 14, 2025 via email

@rwgk
Copy link
Collaborator Author

rwgk commented May 14, 2025

/ok to test 33f5a49

@rwgk
Copy link
Collaborator Author

rwgk commented May 14, 2025

I didn't trigger the CI because the only file changed since the last full run is .pre-commit-config.yaml. pre-commit.ci - pr runs immediately on push, and succeeded. If there are no further changes, this could be admin-merged.

The codegen PR is in sync, and I ran the codegen for all modules (driver, runtime, nvrtc) to be sure there are no overlooked sideeffects anymore.

@leofang leofang merged commit d1072a2 into NVIDIA:main May 14, 2025
1 check passed
@rwgk rwgk deleted the check_spdx branch May 14, 2025 15:39
Copy link

Doc Preview CI
Preview removed because the pull request was closed or merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module P1 Medium priority - Should do support All things related to the project that can't be categorized
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI: Enforce SPDX identifier check
3 participants