Skip to content

Poetry allows multiline descriptions which causes problems with pip installing extras #1372

Closed
python-poetry/poetry-core
#219

Description

@OK-UNDP
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

The issue was discovered while publishing docs from undp/MsGraphExporter on ReadTheDocs. When pyproject.toml option description has a multi-line string enclosed in """ (which is perfectly legit for a string in TOML), it causes poetry to build the package with multi-line Summary in info/METADATA which does not seem to be valid according to pypa/pip#7010 (comment)

Perhaps poetry could just truncate the multi-line description, make it a single-lined one or flag the issue with poetry check.

Originally posted by @OK-UNDP in readthedocs/readthedocs.org#6151 (comment)

Activity

  1. stale commented on Nov 13, 2019

    @stale

    Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

  2. rrei commented on May 28, 2020

    @rrei

    @sdispater thank you very much for creating poetry! I am absolutely in love with this tool ❤️

    Any news on this topic? I just spent way too much time banging my head against the wall because of this... 😭

    According to this link (https://packaging.python.org/specifications/core-metadata/#summary) and what @OK-UNDP said, I believe poetry should enforce a single-line description field (during poetry build and poetry check). Also, it would be nice if this restriction was mentioned in the documentation (https://python-poetry.org/docs/pyproject/#description).

    As it stands now, no error occurs when building, poetry check says everything is okay, and pip only installs my library and none of its dependencies, but it doesn't display any errors either, which makes it extremely hard to find the source of the error. Worse still, pip installing the sdist does install dependencies!

    A simple example that breaks without any useful feedback (I am using Poetry 1.0.5):

    [build-system]
    requires = ["poetry>=0.12"]
    build-backend = "poetry.masonry.api"
    
    [tool.poetry]
    name = "example-lib"
    version = "0.1.0"
    description = """
    First line
    Second line (BOOOOOM)"""
    authors = ["John Doe <john.doe@example.org>"]
    packages = [{ include = "example", from = "src" }]
    
    [tool.poetry.dependencies]
    python = "^3.8"
    addict = "^2.2.1"
    loguru = "^0.5.0"
    typer = {extras = ["all"], version = "^0.2.1"}
    wcmatch = "^6.0.1"

    @sdispater if you agree with my suggestion to enforce the single-line description field, I'd be happy to give it a try and submit a PR 😃

  3. Jhraumg commented on Feb 9, 2021

    @Jhraumg

    Same problem here. It causes pkginfo to leave metadata as is instead of interpreting them :

    metadata_version: 2.1
    name: my-package
    version: 0.0.1.dev0
    summary: First line
    description: Second line with CR
    
    Author: Jhraumg
    Requires-Python: >=3.8,<4
    Classifier: Programming Language :: Python :: 3
    Classifier: Programming Language :: Python :: 3.8
    Classifier: Programming Language :: Python :: 3.9
    Requires-Dist: autologging
    Requires-Dist: flask
    Requires-Dist: jsonpickle
    Requires-Dist: logutils
    Requires-Dist: marshmallow
    Requires-Dist: numpy
    Requires-Dist: requests
    Requires-Dist: ruamel-yaml
    Requires-Dist: six
    

    vs

    metadata_version: 2.1
    name: my-package
    version: 0.0.1.dev0
    summary: Single line
    description:
    author: Jhraumg
    classifiers: ['Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9']
    requires_python: >=3.8,<4
    requires_dist: ['autologging', 'flask', 'jsonpickle', 'logutils', 'marshmallow', 'numpy', 'requests', 'ruamel-yaml', 'six']
    
  4. Jhraumg commented on Feb 9, 2021

    @Jhraumg

    In fact, per https://packaging.python.org/specifications/core-metadata/#description
    adding | (with 7 spaces) after each description \n should get poetry in line with the spec.

    pkginfo manages to parse most of metadata when I do so in pyproject.toml

  5. bmoeskau commented on Jun 23, 2021

    @bmoeskau

    I also ran into this today, and spent multiple hours trying to figure out why my package deps were not installing. Funny enough, I accidentally fixed it at one point just through the course of generally editing the file, then reverted that and broke it again -- never once understanding cause and effect. Amazingly frustrating!

    I really, really appreciate the work on this project, and know what it's like to maintain OSS. Not complaining (too loudly) -- but consider this a vote to fix this to help the next person avoid hours of pain :)

  6. github-actions commented on Mar 2, 2024

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  7. locked as resolved and limited conversation to collaborators on Mar 2, 2024
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

    area/build-systemRelated to PEP 517 packaging (see poetry-core)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions