Skip to content

allow specifying options in pyproject.toml #4843

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

Closed
DetachHead opened this issue Aug 23, 2023 · 8 comments
Closed

allow specifying options in pyproject.toml #4843

DetachHead opened this issue Aug 23, 2023 · 8 comments

Comments

@DetachHead
Copy link
Contributor

so instead of robot --outputdir output --listener Foo --listener Bar you could define it like this:

[tool.robot]
outputdir = "output"
listeners = ["Foo", "Bar"]
@pekkaklarck
Copy link
Member

I've been thinking it would be good to have support for configuration files and using a standard mechanism like pyproject.toml sounds good to me. Some questions about that:

  1. My understanding is that this file was at least initially targeted for build tools. Is it common for other tools to use it as well?
  2. Does Python standard library have tooling for discovering does such a file exist?
  3. Does Python standard library have tooling for parsing such files?

@DetachHead
Copy link
Contributor Author

DetachHead commented Aug 24, 2023

  1. Yes. Mypy, ruff, robotidy, robocop, Pytest and many other tools use it
  2. Not sure
  3. Yes, tomllib

@KotlinIsland
Copy link
Contributor

Not sure about 2, I'll have a look, but it's fairly standard to use tomllib for py >= 3.11 and tomli for everything less than 3.11

@pekkaklarck
Copy link
Member

Ok, if project.toml is widely used outside building and packaging, I guess we can use it too.

With config files it's pretty common that you can have a system wide config, a user config and a project level config. Not sure do we need all these levels, but some global config would be good in addition to the project config. Does project.toml support this? If not, we could add our own config files as well to get this behavior. We just needed to agree where to look these files and how should they be named.

We cannot make tomli a mandatory dependency with Python < 3.11. I guess it would be fine to support pyproject.toml only if a toml parser is available.

@pekkaklarck
Copy link
Member

One problem is how to integrate config file support with our old and ugly command line option handling code. If that requires bigger changes, rewriting the old code could be the best solution. I'd really like to do that at some point anyway.

@DetachHead
Copy link
Contributor Author

personally i don't see the point in global config. imo everything should be configured at the project level so that others working on the project aren't running tests with different settings to what's intended

@simonmeggle
Copy link

I am wondering whether it wouldn't make sense to build on what Daniel has implemented for RobotCode.

The robot.toml file covers all arguments for Robot Framework on the command line.
The Robotcode-Runner uses this file to build the Robot Framework call.
In addition, the creation of execution profiles, inline expressions etc... there are many good ideas in it.

@pekkaklarck
Copy link
Member

We have #5337 about configuration file support in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants