Black: Black fails to run if pyproject.toml has " }" after a boolean

Created on 11 Dec 2018  路  6Comments  路  Source: psf/black

Operating system: OSX High Sierra
Python version: 3.7.1
Black version: 18.9b0
Does also happen on master: Yes

Black gives the following error when you try to run in a folder with the following pyproject.toml:

[tool.poetry]
name = "test"
version = "0.1"
description = "test repo"
authors = ["Jason Giancono <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.7"

[tool.poetry.dev-dependencies]
black = { python=">3.6", version=">=18.9b0", allow_prereleases=true }
Error: <click.core.Context object at 0x100f02630>



md5-6b01f2e7e79b0d83cb22a180c09a1e01



[tool.poetry]
name = "test"
version = "0.1"
description = "test repo"
authors = ["Jason Giancono <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.7"

[tool.poetry.dev-dependencies]
black = {python=">3.6", version=">=18.9b0", allow_prereleases=true}

This happens if any config in pyproject.toml has "something=true }"

bug

Most helpful comment

A new version of toml has been released:

https://pypi.org/project/toml/0.10.1/

All 6 comments

Same error happens on mine as long as there is a boolean:

[tool.flit.metadata]
module = "pyfomod"
author = "Daniel Nunes"
author-email = "[email protected]"
home-page = "https://github.com/GandaG/pyfomod"
description-file = "README.rst"
requires-python = ">=3"
classifiers = [
    "Intended Audience :: Developers",
    "License :: OSI Approved :: Apache Software License",
    "Programming Language :: Python :: 3",
    "Topic :: Software Development :: Libraries",
]
requires = [
    "lxml",
]

[tool.flit.metadata.requires-extra]
dev = [
    "black",
    "isort",
]
test = [
    "pytest",
    "pytest-cov",
    "pytest-sugar",
]

[tool.isort]
multi_line_output = 3
force_grid_wrap = 0
line_length = 88
include_trailing_comma = True
use_parentheses = True

If the last two lines are removed, everything works.

Waiting for a new release of toml to fix this.

Just bumped into this myself after upgrading my system to try to understand the walrus operator - has toml really not released a new version in 15+ months?

Just bumped into this myself after upgrading my system to try to understand the walrus operator - has toml really not released a new version in 15+ months?

Correct, see https://github.com/uiri/toml/issues/267.

@GandaG
Please see #1410, those two lines are invalid according to the TOML documentation.

Boolean values use lowercase identifiers in TOML.
https://github.com/toml-lang/toml#user-content-boolean

A new version of toml has been released:

https://pypi.org/project/toml/0.10.1/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

testvinder picture testvinder  路  3Comments

JelleZijlstra picture JelleZijlstra  路  3Comments

craigmac picture craigmac  路  3Comments

dusty-phillips picture dusty-phillips  路  3Comments

decibyte picture decibyte  路  3Comments