How would you like to declare runtime dependencies and Python requirements for PEP 723?

If we’re trying to pick a color of the bikeshed here, here’s a proposal…

# /// script
# dependencies = ["httpx"]
#
# [tool.magic]
# style = "interesting"
#
# [tool.linter]
# strict = true
# ///

This is literally script metadata, after all. Let’s call it that. That clearly indicates that it’s separate from project metadata or even how things are run or what a project is.

With this, you can have only linter configuration and it doesn’t look out of place.

# /// script
# [tool.linter]
# include = ["I"]
# ///

Or, you can only have the “how to run this” metadata and it doesn’t look out of place.

# /// script
# dependencies = ["httpx"]
# ///

If we want to have tool configuration at all, I’m struggling to understand why it should not look like TOML configuration that users have in other contexts already. Doing it differently in different contexts with the same markup language but with extra steps serves to increase cognitive load IMO.

Please, let’s not reinvent the concept of how to do namespaces by doing it at a layer above the TOML configuration, a configuration format whose structure is namespaces and key-value pairs. The /// foo syntax is more boilerplate than TOML’s [table] syntax, and doing it multiple times in the same script is… frivolous IMO.

19 Likes