You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Poetry uses tomlkit for parsing their poetry.lock files
I recently had a merge conflict on my lock file
Poetry catches TOMLKitError and stringifies it to report their error:
Unable to read the lock file (Invalid TOML file /Users/anentropic/myproject/poetry.lock: Key "description " already exists.).
The problem for me is that the lock file is a) large and b) has a repetitive structure, so there are many objects with key "description" and finding the one with a duplicate is not so fun
I originally thought this was a Poetry problem where they could report more detail. I had a look in tomlkit src and sure enough there is a ParseError which reports the line and column number.
Poetry uses tomlkit for parsing their poetry.lock files
I recently had a merge conflict on my lock file
Poetry catches
TOMLKitError
and stringifies it to report their error:The problem for me is that the lock file is a) large and b) has a repetitive structure, so there are many objects with key
"description"
and finding the one with a duplicate is not so funI originally thought this was a Poetry problem where they could report more detail. I had a look in tomlkit src and sure enough there is a
ParseError
which reports the line and column number.But it turns out my error is a
KeyAlreadyPresent
, which doesn't inherit fromParseError
😞 https://github.com/sdispater/tomlkit/blob/master/tomlkit/exceptions.py#L191The error arises when reading the lock file https://github.com/python-poetry/poetry/blob/master/src/poetry/packages/locker.py#L454 so it would be lovely if this could be a
ParseError
so that lib can report helpful info to the userHad a very quick look through the code and I wonder perhaps if errors like
KeyAlreadyPresent
could be caught e.g. here https://github.com/sdispater/tomlkit/blob/193b859d97afd703a70e76f347a3c198abc3dc74/tomlkit/parser.py#L149 and re-raised as an equivalent ParseError with position context info?The text was updated successfully, but these errors were encountered: