-
Notifications
You must be signed in to change notification settings - Fork 45
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
refactor: parameter license_classifier expects a list #133
Conversation
I actually intended to write a test that captures the issue that #132 (comment) describes, but this seemed simpler. In general I find the logic is challenging to test. @raimon49 I might be willing to spend some time to (rigorously) refactor the code in some weeks if you are interested, but only if you are (1) open to that and (2) willing to spend time to think along. For example, I wonder whether |
This prevents multiple branches in select_license_by_source
d099e8a
to
ccc4790
Compare
Codecov Report
@@ Coverage Diff @@
## release-4.0.0 #133 +/- ##
===============================================
Coverage 100.00% 100.00%
===============================================
Files 1 1
Lines 374 371 -3
===============================================
- Hits 374 371 -3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
classifiers = metadata.get_all("classifier") | ||
if classifiers: | ||
pkg_info['license_classifier'] = \ | ||
find_license_from_classifier(classifiers) | ||
classifiers = metadata.get_all("classifier", []) | ||
pkg_info['license_classifier'] = \ | ||
find_license_from_classifier(classifiers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have checked API Reference of importlib_metadata.
It's a simple and beautiful solution 👍
Refactoring to make it testable is a "nice to have." Perhaps this can be done by proceeding in small scopes of separation. A huge release may not move forward due to my lack of time or ability to do so. e.g.) After v4.0.0 shipped,
We cannot decide here and now what order to work in, but small separated patches are acceptable. |
Alternative solution to #132. This solution ensures that parameter
license_classifier
toselect_license_by_source
is alist
, resulting in code that is easier to reason about.