Skip to content

Parsing setup.cfg classifiers for license results in UNKNOWN and prompt to the user (for own project at least) #74

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

Closed
2 tasks done
Ronnie-Jensen-Vigilant-AI opened this issue Mar 20, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Ronnie-Jensen-Vigilant-AI

Before You Begin

Before proceeding, please make sure to follow these steps:

  • I have checked for similar issues in the project's issue tracker.
  • I have searched closed issues to see if a similar problem was reported before.

Description

I have a small project that uses setup.cfg for PyPI packaging, and using licensecheck I get prompted to enter the license for my own project, even though the license is listed in the classifiers under metadata in setup.cfg, as well as directly with "license =" in the metadata.

Looking through the earlier issues I think this comes from:
#23

I do not understand the original motivation for using the construct here, so I might be missing something, however I can fix the problem for my situation by removing the ".dict" in:

packageinfo.py : getMyPackageLicense()
from:

 if "metadata" in config.sections() and "license" in config["metadata"]:
     return config["metadata"].__dict__

to:

 if "metadata" in config.sections() and "license" in config["metadata"]:
     return config["metadata"]    

Simply getting rid of the construct using .dict , it starts returning the metadata correctly, it finds the license classifier and it does not prompt the user for the information etc. It is also curious that it here checks for the presence of "license" in the metadata, but then later uses the "classifers" entry instead?

Otherwise this looks like a great tool and many thanks to the developers for making this available!

System Information

  • Operating System (OS): Ubuntu 22.04.3
  • Python Version: 3.10.12
@FredHappyface
Copy link
Member

Ah thanks for the issue, and the investigation too!

Really frustrating that I introduced a big there, so apologies. Basically it was to make the type checker (pyright/ pylance) happy and I thought I'd tested it thoroughly, clearly not! I'll add it to my to-do list :)

@FredHappyface
Copy link
Member

@Ronnie-Jensen-Vigilant-AI
Copy link
Author

Fantastic! Thank you! That was extremely fast!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants