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

Example implementation of REUSE specifications. #33

Merged
merged 4 commits into from
May 20, 2020

Conversation

Flameeyes
Copy link
Contributor

See discussion in adafruit/circuitpython#2887.

@Flameeyes
Copy link
Contributor Author

Hah, funny, I guess this could use a black pre-commit integration, too ;)

@Flameeyes Flameeyes force-pushed the master branch 2 times, most recently from c3d9450 to 6c592c3 Compare May 15, 2020 14:44
@Flameeyes
Copy link
Contributor Author

Because actions-ci is cloned, rather than used as a submodule, it turns out reuse lint can't pass on the CI system until adafruit/actions-ci-circuitpython-libs#8 (which basically does the same for the CI code.)

Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

I'm going to check with mgmt about some these, too, thanks.

.disabled.travis.yml Outdated Show resolved Hide resolved
README.rst.license Outdated Show resolved Hide resolved
docs/api.rst.license Outdated Show resolved Hide resolved
docs/index.rst.license Outdated Show resolved Hide resolved
@dhalbert
Copy link
Contributor

pre-commit is now catching some more missing entries

@Flameeyes
Copy link
Contributor Author

pre-commit is now catching some more missing entries

Yep it's finding the content of actionci that is checked out by the GitHub action in the same folder as the content of this repository.

That's what adafruit/actions-ci-circuitpython-libs#8 is about.

If it was a submodule, it would be ignored, and when running as part of a commit itself, pre-commit will run the tool in a "sterile" environment without non-staged files.

But when running as part if the continuous integration, it needs to use --all-files which expects even unstaged files to have a license. I thought that just adding the licenses to the appropriate files would be easier than figuring out how to change the action to checkout the files at a different path.

@sommersoft
Copy link
Collaborator

I dove in on this a bit this afternoon. A few personal notes/thoughts that I have so far:

  • Implementing REUSE across the ecosystem:

    • This seems to be a largely manual process. reuse addheader takes input arguments to set the respective SPDX information. This means that it isn't file aware, so each different copyright holder will have to be explicitly entered. Existing copyright lines are kept, and using a template could drop them; but, the SPDX info still needs to be explicitly set.
    • An external script could probably be written to at least handle the bulk of it with some introspection and feeding that to reuse (my wheels are already turning, hehe). Boilerplate copyright's would be included by file name/type, as well (e.g fav.ico). Example files are the hardest here though, since they have no real copyright reference outside of commit history.
  • Distribution: circuitpython-build-tools should be able to be massaged to include a master license folder for the Bundles, so that each library's copy isn't necessary. Each library's release artifact should be even easier.

  • Changes to build.yml are general enough that they should be adabot patchable to all the libraries. If implementing an external script from above though, probably best to include the updates there.

  • pre-commit: Probably not the intent, but this is my favorite part to this PR. 😄 When we were transitioning to black usage, I wanted to be able to supply a pre-commit hook for it across the ecosystem. Of course, git doesn't track them in remotes, so that wouldn't help much. This package could definitely facilitate that for contributors. Also, they have a GitHub Action workflow available/in development: https://github.com/pre-commit/action. I may do some testing on this, as it could remove some local work altogether.

@Flameeyes with your experience implementing REUSE, please feel free to correct any of my errors or misunderstandings of how reuse-tool works.

@Flameeyes
Copy link
Contributor Author

@sommersoft yeah that's pretty much all correct.

I'm also glad to hear you like pre-commit — it has indeed been a big timesaver for me on many projects now. When running locally it has the ability to fix, not just detect, issues.

Also regarding the examples copyright being difficult to track — that was indeed my original motivation. I have been looking at one of the esp32spi examples as I needed to model my code after it and wasn't sure what license it was released as, from the docs themselves.

The REUSE specifications[1] are meant to make it explicit and easier to
apply code licensing information for a project. The provided lint tool
makes it easy to ensure all the content (code and not code) is tagged.

Important notes:

 * All the code (and documentation) that otherwise didn't have an explicit
   license headers have been tagged with Kattni Rembor's copyright as per
   the LICENSE file.
 * The favicon.ico file has been tagged with CC-BY-4.0 license as per
   adafruit/circuitpython#2887 (comment)
   and Phillip Torrone's for Adafruit Industries copyright.
 * All configuration files have been tagged with Kattni Rembor's copyright
   and Unlicense[2]. The current REUSE recommendation is to use CC0-1.0,
   but that has… side effects. There's some discussion in [3] about the
   recommendation for likely-uncopyrightable files (such as configuration
   files).

[1]: https://reuse.software/
[2]: https://unlicense.org/
[3]: fsfe/reuse-docs#62
pre-commit.com provides a way to configure pre-commit hooks for multiple
tools, including `reuse lint` (configured here), isort, black, and more.

This is also integrated with GitHub actions in the example configuration.
For this to work, the black command line options need to be replaced with a
pyproject.toml file defining the settings, that can be reused.
These are minor, but avoids those coming up during reviews at all.
Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

OK, I re-ran the checks for this after merging adafruit/actions-ci-circuitpython-libs#8, and it's working fine, so now approving this.

@dhalbert dhalbert merged commit 82f0601 into adafruit:master May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants