Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jasongi-actu opened this issue Dec 10, 2018 · 6 comments · Fixed by uiri/toml#224 or #1501
Closed

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

jasongi-actu opened this issue Dec 10, 2018 · 6 comments · Fixed by uiri/toml#224 or #1501
Labels
T: bug Something isn't working

Comments

@jasongi-actu
Copy link

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 <jgiancono@actu.org.au>"]

[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>

However if you change the black line to not have a space after allow_prereleases=true then it works fine e.g

[tool.poetry]
name = "test"
version = "0.1"
description = "test repo"
authors = ["Jason Giancono <jgiancono@actu.org.au>"]

[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 }"

@GandaG
Copy link

GandaG commented Dec 19, 2018

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

[tool.flit.metadata]
module = "pyfomod"
author = "Daniel Nunes"
author-email = "daniel.henri.nunes@gmail.com"
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.

@zsol
Copy link
Collaborator

zsol commented Feb 14, 2019

Waiting for a new release of toml to fix this.

@AlexisGoodfellow
Copy link

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?

@hugovk
Copy link
Contributor

hugovk commented May 11, 2020

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 uiri/toml#267.

@ichard26
Copy link
Collaborator

ichard26 commented May 13, 2020

@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

@hugovk
Copy link
Contributor

hugovk commented May 14, 2020

A new version of toml has been released:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
6 participants