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

Make reuse init reuse info present in pyproject.toml #345

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

CharString
Copy link

I was using reuse on an existing project and was surprised reuse init didn't use the info from pyproject.toml, so I wrote a patch.

See PEP 621 for the spec:
https://www.python.org/dev/peps/pep-0621/

Chris Wesseling added 2 commits April 7, 2021 11:46
In dev toml was installed as an implicit dependency from one of the
tools, but the Docker build failed.
@nicorikken
Copy link
Member

Seems to be a good idea. I think this needs some coordination with #240 which focuses more on version control being the source for author details.
I think we need to consider in which file the information is gathered, to avoid having settings be loaded in both the init.py and vcs.py files.
Also I'm not sure that the project file can always be considered the source of truth. I have experienced it is created once and hardly updated. So maybe there need to be some option whether the source files or the project file get a priority. Some elegant merging like in #328 could help here.

@CharString
Copy link
Author

CharString commented Apr 30, 2021

Maybe the invoker of reuse should be considered as the source of truth (author and user in vcs aren't always copyright holder either... Anything googlers make is owned by Google, for instance) and should reuse just collect all possible values from all sources and present them as possible defaults. Much like pdm init presents all python executables it can find, and asks which one to use and store in the config.

@nicorikken
Copy link
Member

@CharString I took a look at pdm init. So if I understand you correctly, you could be presented with a prompt like:

$ reuse addheader
No copyright holder provider, but found multiple options for copyright owner:
0. Jane Doe
1. J. Doe <[email protected]>
2. MyCorp
Please select: 

Considering that the output of pdm init is saved, this could also be done for reuse, but that might be overkill for a simple selection.

@CharString
Copy link
Author

CharString commented May 2, 2021

@nicorikken Yes, that's the idea. About saving the choices. I'm very new to reuse, and just started to use it on a toy project. The programmer in me will seek maximal automation and minimal repetitive action. But I'm not a lawyer and there are legal consequences to what reuse does, so my instinct says to err on presenting explicit choices to the user of the tool. On the other hand, it's the vcs commit action that makes these choices final, so maybe we can be aggressive in automation and consider ourselves nothing more but a fancy editor macro.

What do you think?

@nicorikken
Copy link
Member

Great. About saving it, that would only make sens if you'd run it often. For example each git commit, or in a continuous integration process. I'm not sure if anybody is doing something like that. You could always provide explicit parameters to the addheader command to avoid having to make a selection each time.

So thinking about it know, I think an interactive selection would be nice if multiple options are encountered (like in this PR and #240 ). And saving it could be a future extension.

Regarding this specific PR, I'm not a REUSE maintainer, so it's not my call. I like the idea in general. This of course could grow to many types of project files, so we'd just have to make sure this is worth adding.

@nicorikken
Copy link
Member

The current line of thought is not to bloat REUSE with all sort of configuration options and suggest helper scripts instead: https://reuse.readthedocs.io/en/latest/scripts.html Perhaps instead of this pull request we can come up with a oneliner or small script to read author information from the pyproject.toml?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants