Hacker News new | ask | show | jobs
by lijok 1042 days ago
It's probably because pyproject.toml is the direction in which the python ecosystem is going.

On that note, I will never understand why they chose .toml instead of just json or yaml..

3 comments

> On that note, I will never understand why they chose .toml instead of just json or yaml..

https://peps.python.org/pep-0518/#other-file-formats

Thanks this also gave another reason why they didn't use a dict for configuration https://peps.python.org/pep-0518/#python-literals
YAML is only fun when you're not tripping in the numerous landmines in the way: https://noyaml.com/
I think "easy for humans to edit" is where I mostly disagree with. To this day I have not worked with anyone that understood the .toml format.
Hey. I think I understand the .toml format. What do you want to know?
How much time have you spent towards TOML vs -- say -- YAML?

More editable than JSON and far simpler than YAML.

---

The Rust ecosystem also uses TOML.

YAML is one of the most ambiguous formats out there, and definitely an overkill for what's needed to describe metadata.

JSON - not the most convenient to use for human beings, too much quoting, not too git friendly because of disallowed trailing commas, etc.

TOML sits somewhere inbetween, easy to write but the spec is very short; also being used in Rust and a few other places.

Yes, but you can write a pyproject toml file also as a python dictionary.

Instead of:

[project] requires-python = ">=3.11" dependencies = [ "requests<3", "rich", ]

You could write:

{ "project": { "requires-python":">=3.11", "dependencies" : [ "requests<3", "rich" ] }

No way !

Gotta think carefully about this... Might upset some coworkers