FHPythonUtils/LicenseCheck

Feature: Support the ``project.dependencies`` field in ``pyproject.toml`` (``pyproject.toml`` without ``poetry``)

psasselum opened this issue · 3 comments

Thank you for this project !

Is your feature request related to a problem? Please describe

Right now licensecheck fail this way:

Traceback (most recent call last):
  File "/home/pierre/git/tiger/venv/lib/python3.10/site-packages/licensecheck/get_deps.py", line 110, in do_get_reqs
    project = pyproject["tool"]["poetry"]
KeyError: 'poetry'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pierre/git/tiger/venv/bin/licensecheck", line 8, in <module>
    sys.exit(cli())
  File "/home/pierre/git/tiger/venv/lib/python3.10/site-packages/licensecheck/cli.py", line 86, in cli
    sysexit(main(args))
  File "/home/pierre/git/tiger/venv/lib/python3.10/site-packages/licensecheck/cli.py", line 120, in main
    myLice, depsWithLicenses = get_deps.getDepsWithLicenses(
  File "/home/pierre/git/tiger/venv/lib/python3.10/site-packages/licensecheck/get_deps.py", line 217, in getDepsWithLicenses
    reqs = getReqs(using, skipDependencies)
  File "/home/pierre/git/tiger/venv/lib/python3.10/site-packages/licensecheck/get_deps.py", line 62, in getReqs
    return do_get_reqs(using, skipDependencies, extras, pyproject, requirementsPaths)
  File "/home/pierre/git/tiger/venv/lib/python3.10/site-packages/licensecheck/get_deps.py", line 114, in do_get_reqs
    raise RuntimeError(msg) from error
RuntimeError: Could not find specification of requirements (pyproject.toml).

Describe the solution you'd like

Use project dependencies from the metadata, use poetry only if there's a poetry entry.

try licensecheck -u PEP631

Hi thanks for this! As @RomainBrault says use licensecheck with -u PEP631`

Shouldn't the crash be prevented ? Is using the -u PEP631 option directly in a try catch too complicated ? Maybe a better crash message with indication about what to do ?