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

Command "pdm show" fails when using PEP-621 license field #966

Closed
1 task done
mferriz opened this issue Mar 10, 2022 · 0 comments
Closed
1 task done

Command "pdm show" fails when using PEP-621 license field #966

mferriz opened this issue Mar 10, 2022 · 0 comments
Labels
🐛 bug Something isn't working

Comments

@mferriz
Copy link

mferriz commented Mar 10, 2022

Command pdm show seems to be enforcing draft PEP-639 and expects field license-expression to exist. The command cannot process standard PEP-621 license field.

This may be related to pdm-project/pdm-backend#78

  • I have searched the issue tracker and believe that this is not a duplicate.

Steps to reproduce

Create a project with a pyproject.toml and a license field containing:

license = {file = "LICENSE"}

Do pdm install and then pdm show

Actual behavior

When using pdm show -v:

/usr/local/Cellar/pdm/1.13.4/libexec/lib/python3.10/site-packages/pdm/models/project_info.py:48: PDMWarning: 'license-expression' is missing
  license_expression = getattr(metadata, "license_expression", None)
Traceback (most recent call last):
  File "/usr/local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/usr/local/Cellar/pdm/1.13.4/libexec/lib/python3.10/site-packages/pdm/core.py", line 233, in main
    return Core().main(args)
  File "/usr/local/Cellar/pdm/1.13.4/libexec/lib/python3.10/site-packages/pdm/core.py", line 168, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "/usr/local/Cellar/pdm/1.13.4/libexec/lib/python3.10/site-packages/pdm/core.py", line 163, in main
    f(options.project, options)
  File "/usr/local/Cellar/pdm/1.13.4/libexec/lib/python3.10/site-packages/pdm/cli/commands/show.py", line 72, in handle
    project.core.ui.display_columns(list(project_info.generate_rows()))
  File "/usr/local/Cellar/pdm/1.13.4/libexec/lib/python3.10/site-packages/pdm/termui.py", line 139, in display_columns
    sizes = list(
  File "/usr/local/Cellar/pdm/1.13.4/libexec/lib/python3.10/site-packages/pdm/termui.py", line 141, in <lambda>
    lambda column: max(map(lambda x: len(strip_ansi(x)), column)),
  File "/usr/local/Cellar/pdm/1.13.4/libexec/lib/python3.10/site-packages/pdm/termui.py", line 141, in <lambda>
    lambda column: max(map(lambda x: len(strip_ansi(x)), column)),
  File "/usr/local/Cellar/pdm/1.13.4/libexec/lib/python3.10/site-packages/click/_compat.py", line 494, in strip_ansi
    return _ansi_re.sub("", value)
TypeError: expected string or bytes-like object

When using pdm show --license -v:

/usr/local/Cellar/pdm/1.13.4/libexec/lib/python3.10/site-packages/pdm/models/project_info.py:48: PDMWarning: 'license-expression' is missing
  license_expression = getattr(metadata, "license_expression", None)
None

Expected behavior

Command pdm show should display the package information, including the license.

Environment Information

PDM version:        1.13.4
Python Interpreter: /usr/local/opt/python@3.9/bin/python3.9 (3.9)
Project Root:       /Users/mariof/Development/Project
Project Packages:   /Users/mariof/Development/Project/__pypackages__/3.9
{
  "implementation_name": "cpython",
  "implementation_version": "3.9.10",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "21.2.0",
  "platform_system": "Darwin",
  "platform_version": "Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64",
  "python_full_version": "3.9.10",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "darwin"
}
@mferriz mferriz added the 🐛 bug Something isn't working label Mar 10, 2022
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

1 participant