Skip to content

Installing prettytable via poetry does not install wcwidth dependency since prettytable 3.13.0 #362

Closed as not planned

Description

@loewexy

What did you do?

In a new empty python project I tried to install prettytable using poetry add prettytable. This does not install wcwidth as a dependency which makes prettytable fail on text table output.

What did you expect to happen?

wcwidth should automatically be installed as a dependency, which worked up until prettytable 3.12.0

What actually happened?

wcwidth was not installed as a dependency

What versions are you using?

  • OS: Ubuntu 22.0
  • Python: 3.12.2
  • PrettyTable: 3.14.0

Other info

I tried adding an older version of prettytable using poetry add prettytable==3.12.0 and this installs wcwidth as a dependency. If I explicitly specify prettytable 3.13.0 or 3.14.0 it does not work. So something must have been changed from 3.12.0 to 3.13.0.

Activity

  1. stuertz commented on Feb 6, 2025

    @stuertz
    Contributor

    Could you add an example, to reproduce?

  2. hugovk commented on Feb 6, 2025

    @hugovk
    Member

    I don't use Poetry much, but could not reproduce on macOS with Python 3.12 and Poetry 1.8.3:

    Details
    ❯ poetry init
    
    This command will guide you through creating your pyproject.toml config.
    
    Package name [prettypoetry]:
    Version [0.1.0]:
    Description []:
    Author [Hugo van Kemenade <[email protected]>, n to skip]:
    License []:
    Compatible Python versions [^3.12]:
    
    Would you like to define your main dependencies interactively? (yes/no) [yes]
    You can specify a package in the following forms:
      - A single name (requests): this will search for matches on PyPI
      - A name and a constraint (requests@^2.23.0)
      - A git url (git+https://github.com/python-poetry/poetry.git)
      - A git url with a revision (git+https://github.com/python-poetry/poetry.git#develop)
      - A file path (../my-package/my-package.whl)
      - A directory (../my-package/)
      - A url (https://example.com/packages/my-package-0.1.0.tar.gz)
    
    Package to add or search for (leave blank to skip):
    
    Would you like to define your development dependencies interactively? (yes/no) [yes]
    Package to add or search for (leave blank to skip):
    
    Generated file
    
    [tool.poetry]
    name = "prettypoetry"
    version = "0.1.0"
    description = ""
    authors = ["Hugo van Kemenade <[email protected]>"]
    readme = "README.md"
    
    [tool.poetry.dependencies]
    python = "^3.12"
    
    
    [build-system]
    requires = ["poetry-core"]
    build-backend = "poetry.core.masonry.api"
    
    
    Do you confirm generation? (yes/no) [yes]
    
    ❯ l
    drwxr-xr-x hugo wheel  96 B  Thu Feb  6 18:44:19 2025  .
    drwxrwxrwt root wheel 1.1 KB Thu Feb  6 18:43:34 2025  ..
    .rw-r--r-- hugo wheel 297 B  Thu Feb  6 18:44:19 2025  pyproject.toml
    
    ❯ cat pyproject.toml
    [tool.poetry]
    name = "prettypoetry"
    version = "0.1.0"
    description = ""
    authors = ["Hugo van Kemenade <[email protected]>"]
    readme = "README.md"
    
    [tool.poetry.dependencies]
    python = "^3.12"
    
    
    [build-system]
    requires = ["poetry-core"]
    build-backend = "poetry.core.masonry.api"
    
    ❯ poetry add prettytable
    Creating virtualenv prettypoetry-pYUagiwI-py3.12 in /Users/hugo/Library/Caches/pypoetry/virtualenvs
    Using version ^3.14.0 for prettytable
    
    Updating dependencies
    Resolving dependencies... (0.1s)
    
    Package operations: 2 installs, 0 updates, 0 removals
    
      - Installing wcwidth (0.2.13)
      - Installing prettytable (3.14.0)
    
    Writing lock file
    
    ❯ l
    drwxr-xr-x hugo wheel 128 B  Thu Feb  6 18:44:30 2025  .
    drwxrwxrwt root wheel 1.1 KB Thu Feb  6 18:43:34 2025  ..
    .rw-r--r-- hugo wheel 1.2 KB Thu Feb  6 18:44:30 2025  poetry.lock
    .rw-r--r-- hugo wheel 321 B  Thu Feb  6 18:44:30 2025  pyproject.toml
    
    ❯ cat poetry.lock
    # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
    
    [[package]]
    name = "prettytable"
    version = "3.14.0"
    description = "A simple Python library for easily displaying tabular data in a visually appealing ASCII table format"
    optional = false
    python-versions = ">=3.9"
    files = [
        {file = "prettytable-3.14.0-py3-none-any.whl", hash = "sha256:61d5c68f04a94acc73c7aac64f0f380f5bed4d2959d59edc6e4cbb7a0e7b55c4"},
        {file = "prettytable-3.14.0.tar.gz", hash = "sha256:b804b8d51db23959b96b329094debdbbdf10c8c3aa75958c5988cfd7f78501dd"},
    ]
    
    [package.dependencies]
    wcwidth = "*"
    
    [package.extras]
    tests = ["pytest", "pytest-cov", "pytest-lazy-fixtures"]
    
    [[package]]
    name = "wcwidth"
    version = "0.2.13"
    description = "Measures the displayed width of unicode strings in a terminal"
    optional = false
    python-versions = "*"
    files = [
        {file = "wcwidth-0.2.13-py2.py3-none-any.whl", hash = "sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859"},
        {file = "wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5"},
    ]
    
    [metadata]
    lock-version = "2.0"
    python-versions = "^3.12"
    content-hash = "4a2cd4629c892732746a282c1f7380c1af6c9fcdfa370c223e0b3d0017180729" 
  3. stuertz commented on Feb 6, 2025

    @stuertz
    Contributor

    Yeah, I don't use poetry that often either and tried the same thing you did with python 3.13 and prettytable 3.14 on macOS. Had no luck reproducing it either, which is why I asked for more details.

  4. loewexy commented on Feb 7, 2025

    @loewexy
    Author

    Thanks for your feedback. I essentially did the same as @hugovk but had the issue. After further debugging I found a difference. I am using a company internal artifactory as pypi mirror. When I configure that back to Pypi directly the issue is gone. So I assume this is some problem with my mirror and poetry, but which is triggered by some change from prettytable 3.12.0 to 3.13.0, since the older version works without problem in my setup and I do not see similar behavior with other packages.

  5. loewexy commented on Feb 7, 2025

    @loewexy
    Author

    Can confirm that this was an issue with my poetry setup. This behavior is a known bug with poetry and artifactory with packages using newer metadata versions namely 2.3 and 2.4. I assume prettytable moved to a newer format in 3.13.0 which triggered the poetry bug for me. Upgrading pkginfo in the poetry venv fixes this bug.

  6. hugovk commented on Feb 7, 2025

    @hugovk
    Member

    That's right, we started using the new 2.4 metadata in #350 to use the new license expressions.

    I think it would have happened anyway, as we don't upper-pin Hatchling, but we do specifically need 2.4 for #350.

    Thank you for finding the issue is with Poetry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions