python-poetry / python-poetry/poetry

Report actual pyproject.toml error text in event of InvalidRequirement error

Open
#1,739 1 comment 1 reaction 1 assignee View on GitHub

@Secrus is already working on this.

Since Sep 25, 2024.

area/error-handling kind/bug kind/enhancement
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Upon a parse error of a package name in pyproject.toml, poetry reports the a portion of the malformed package name in its canonicalized form, with no indication that it is canonicalized, and reports characters following the error, but not including the error.

Example:

[tool.poetry]
name = "Malformed PackageName"
version= "1.0"
description = "The package name should not have spaces"
authors = [ "shintoo" ]

Running e.g. poetry update produces the following error:

[InvalidRequirement]                 
Invalid requirement, parse error at "'packagen'"  

As the text does not match the actual text in pyproject.toml, it becomes more difficult to track down the source of the user error, especially considering that it merely reports the 8 characters following the error location (but not the error itself). Poetry should report the actual text that is malformed in order to aid the user in fixing their error.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.