python-poetry / python-poetry/poetry

Improved Error detection / reporting on invalid configuration

Open
#4,015 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I am on the latest Poetry version. - v1.1.6
  • 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).
  • OS version and name: macOS 11.3
  • Poetry version: 1.1.6

Issue

Something of a simple request that came up whilst trying to debug another issue (to follow).

pyproject.toml snippet...

[tool.poetry.source]
name = "pages-oxnet-atlas"
url = "https://oxnetcnsc01.oxnet.nhs.uk/api/v4/projects/202/packages/pypi/simple"
secondary = true

... is demonstrably an invalid bit of config - though not for any reason I can easily grasp. With the above as is, when I attempt to add a new package (e.g. poetry add atlas-models -vvv) I get the following errors (amongst the python snippets):

RuntimeError

  The Poetry configuration is invalid:
    - [source] {'name': 'pages-oxnet-atlas', 'url': 'https://oxnetcnsc01.oxnet.nhs.uk/api/v4/projects/202/packages/pypi/simple', 'secondary': True} is not of type 'array'
    - [source.name] 'pages-oxnet-atlas' is not of type 'object'
    - [source.secondary] True is not of type 'object'
    - [source.url] 'https://oxnetcnsc01.oxnet.nhs.uk/api/v4/projects/202/packages/pypi/simple' is not of type 'object'

Now, I know that the fix here is to adjust the pyproject.toml to use double square brackets around [tool.poetry.source] -> [[tool.poetry.source]]. Doing so removes these misleading errors (and sends me back to my bigger bug issue).

What I can't understand from the documentation is why this specific configuration needs double brackets?

Whilst I found an example in the documentation showing such a section with the double brackets, by contrast to all the other examples it seemed like it's a typo given the unremarked difference here.

Could someone explain why this is an apparent exception to the rest of the configuration conventions? And can the documentation be updated to highlight this specific need/variance please?

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.

Research direction

Start with the Poetry documentation examples for tool.poetry.source and review how TOML array-of-tables syntax explains the double brackets. Update the relevant documentation to explain why this form is required and clarify the misleading invalid-configuration errors; done when the distinction is explicit and the example is unambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.