-
Notifications
You must be signed in to change notification settings - Fork 17
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
Bug: crash where no classifiers field exists #14
Comments
Have you specified the license at all in the pyproject.toml file? For example [tool.poetry]
license= "mit" |
Yes I did, although my value is: license = "proprietary" I thought licensecheck completly ignored that. |
If you change that to mit for the purposes of testing then it should work fine What I'll need to do is provide some more useful warnings/errors in the case of an 'invalid' license and in the event license and classifiers are blank |
Fixed in 746eace |
@FredHappyface the #15 was fixed, but #14 is still there 746eace#diff-f57c096bd6398fbed56e24e43f5e856dbe357704addd15869f01809a20e9627eR204 licenseClassifier = licenseFromClassifierlist(metaData["classifiers"]) I believe should be licenseClassifier = licenseFromClassifierlist(metaData.get("classifiers", [])) Note that I don't know if metaData is a dict() so this might still be wrong. |
I am very confused. Even on pretty much the simplest poetry project I can imagine running
Steps to reproduce: $ git clone https://github.com/bruceadams/discovery-files.git
Cloning into 'discovery-files'...
remote: Enumerating objects: 239, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 239 (delta 0), reused 3 (delta 0), pack-reused 235
Receiving objects: 100% (239/239), 144.36 KiB | 4.25 MiB/s, done.
Resolving deltas: 100% (140/140), done.
$ cd discovery-files
$ poetry install
Creating virtualenv discovery-files-bb0M-Gbu-py3.9 in /Users/bruce/Library/Caches/pypoetry/virtualenvs
Installing dependencies from lock file
Package operations: 38 installs, 0 updates, 0 removals
• Installing certifi (2021.10.8)
• Installing charset-normalizer (2.0.11)
• Installing idna (3.3)
• Installing six (1.16.0)
• Installing urllib3 (1.26.8)
• Installing attrs (21.4.0)
• Installing lazy-object-proxy (1.7.1)
• Installing pyjwt (2.3.0)
• Installing pyparsing (3.0.7)
• Installing python-dateutil (2.8.2)
• Installing requests (2.27.1)
• Installing tomli (2.0.0)
• Installing types-setuptools (57.4.8)
• Installing typing-extensions (4.0.1)
• Installing wrapt (1.13.3)
• Installing astroid (2.9.3)
• Installing click (8.0.3)
• Installing fhconfparser (2022)
• Installing ibm-cloud-sdk-core (0.5.2)
• Installing iniconfig (1.1.1)
• Installing isort (5.10.1)
• Installing mccabe (0.6.1)
• Installing mypy-extensions (0.4.3)
• Installing packaging (21.3)
• Installing pathspec (0.9.0)
• Installing platformdirs (2.4.1)
• Installing pluggy (1.0.0)
• Installing py (1.11.0)
• Installing requirements-parser (0.5.0)
• Installing toml (0.10.2)
• Installing tomlkit (0.9.0)
• Installing websocket-client (0.48.0)
• Installing black (22.1.0)
• Installing ibm-watson (3.4.2)
• Installing licensecheck (2022)
• Installing mypy (0.931)
• Installing pylint (2.12.2)
• Installing pytest (6.2.5)
$ poetry run licensecheck
Traceback (most recent call last):
File "/Users/bruce/Library/Caches/pypoetry/virtualenvs/discovery-files-bb0M-Gbu-py3.9/bin/licensecheck", line 8, in <module>
sys.exit(cli())
File "/Users/bruce/Library/Caches/pypoetry/virtualenvs/discovery-files-bb0M-Gbu-py3.9/lib/python3.9/site-packages/licensecheck/__init__.py", line 90, in cli
dependenciesWLicenses = get_deps.getDepsWLicenses(
File "/Users/bruce/Library/Caches/pypoetry/virtualenvs/discovery-files-bb0M-Gbu-py3.9/lib/python3.9/site-packages/licensecheck/get_deps.py", line 107, in getDepsWLicenses
myLiceTxt = packageinfo.getMyPackageLicense()
File "/Users/bruce/Library/Caches/pypoetry/virtualenvs/discovery-files-bb0M-Gbu-py3.9/lib/python3.9/site-packages/licensecheck/packageinfo.py", line 143, in getMyPackageLicense
licenseClassifier = licenseFromClassifierlist(metaData["classifiers"])
File "/Users/bruce/Library/Caches/pypoetry/virtualenvs/discovery-files-bb0M-Gbu-py3.9/lib/python3.9/site-packages/tomlkit/items.py", line 1229, in __getitem__
return cast(Item, self._value[key])
File "/Users/bruce/Library/Caches/pypoetry/virtualenvs/discovery-files-bb0M-Gbu-py3.9/lib/python3.9/site-packages/tomlkit/container.py", line 606, in __getitem__
raise NonExistentKey(key)
tomlkit.exceptions.NonExistentKey: 'Key "classifiers" does not exist.' |
@bruceadams This is what I was talking about. I think you should open a brand new issue, and could reference this one. I believe this issue no longer notifies the author about responses. |
You're correct, just seen this now - apologies for this. Reopened |
Oh! If I just add |
Yeah absolutely, I've updated with (hopefully) a fix and removed a couple packages - the update (2022.0.1) does require py >= 3.8 though |
Keeping this open awaiting confirmation this time. Sorry again for missing the comments before |
Updating to licensecheck 2022.0.1 and all is good! 🎉🎊 Thanks!
I'm mostly on Python 3.9; requiring 3.8 is no problem at all for me. |
@FredHappyface after the update I got:
Also I got this error when trying to update
But, after I removed |
I think the conflict could be that previously |
Maybe close ticket? Or some problem still exists? |
Good point, after that I did not see it happening anymore, so I'm closing it. |
Bug
outcome including screenshots where appropriate
System info
Describe the bug
When classifiers is not defined in pyproject.toml licensecheck crashes with an error that can confuse new users.
Expected outcome
Program working
Actual outcome
Exception like this:
The text was updated successfully, but these errors were encountered: