Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TOML how to have key without value

Many Python tools these days are using pyproject.toml as a config file, and mirror the tool's command line arguments with config file keys. Tools may have command line flags that are not passed any arguments:

sometool --some-flag

Now, I am trying to place this --some-flag into a pyproject.toml config file and can't figure out how to have a key without any value.

[tool.sometool]
# Both of the below are invalid
some-flag
some-flag =

In TOML, is it possible to have a key without a value?

like image 866
Intrastellar Explorer Avatar asked Sep 06 '25 03:09

Intrastellar Explorer


1 Answers

This is not possible.

It'd depend on the tool how they are doing this, so please refer to their documentation. I would guess they are treating those flags as a boolean.

[tool.sometool]
some-flag = true
like image 154
FFY00 Avatar answered Sep 08 '25 01:09

FFY00