Repository navigation
Description
Robot Framework should get support for configuration files. Configuration files should be loaded automatically (unless disabled) and allow specifying same settings that can be given from the command line. This would make it possible to, for example, to automatically enable the RPA mode, specify listeners that should always be used, and so on. This would be especially useful with features that require more complex configuration such as custom settings (#4409).
The main reason Robot currently doesn't support configuration files is that it has its own argument file concept that has many of the same benefits. Argument files aren't loaded automatically, though, and them being a Robot-only solution means that you cannot have all project configuration in one place.
Although the basic idea is clear, there are lot of design decisions to be made:
- What format? Python has pretty much standardized to TOML as configuration syntax and I rather strongly believe we should use that too. tomllib is only available starting from Python 3.11, but we can require people using older Python versions to install a backport if they want to use config files.
- Should we support the standard
pyproject.tomlor a customrobot.toml? I believe we should support both. Actual settings should also be exactly the same regardless the file, but the top level table structure is naturally different. - Where should we look for configuration files? My understanding is that
pyproject.tomlshould be only looked from the current directory, but with ourrobot.tomlit would probably make sense to support system wide, user wide, project wide, and custom configuration so that the latter ones have precedence over earlier ones. System wide and user wide configs would be loaded from an OS specific configuration file locations, project wide configuration from the current directory, and custom configs could be given using a command like option like--config path/to/custom.toml. There should also be a way to disable loading configuration files automatically. - How should each command line option be supported in a configuration file? It's probably best to return to this when implementation starts. This is an important topic, because making changes later causes backwards compatibility problems.
Activity
rinatagishev commentedon Feb 13, 2025
What is this configuration for?
tests filtering?
variables setting or referencing variables file?
binding other configs, including configs based on existing variables?
LucianCrainic commentedon Mar 8, 2025
Hello @pekkaklarck any updates on this ? Will there be a toml / yaml file for configuration settings ? What purpose will it serve ?
pekkaklarck commentedon Mar 27, 2025
I finally updated the description so hopefully it now answers your questions @rinatagishev and @LucianCrainic.
While updating the description I realized now many design decisions there are to be made and how much getting all this implemented does. In addition to the support for finding and loading configuration files, we need to integrate it with the current code for parsing command line options and handling settings internally. Unfortunately most of the current code is pretty bad, and I believe we should rewrite it as part of this project. That allows us to design this properly, but it also increases the development effort.
My current thinking is that this is so big task that it's better to move it to RF 8.0 scope. Doing this in a major release would also help a little if we needed to make some backwards incompatible changes. If you feel that this should be implemented earlier, please comment this issue. In that case you need to be prepared to help with the design and implementation work, though.
Noordsestern commentedon Mar 27, 2025
Not sure if you are aware:
Robotcode introduced
robot.tomlmore than a year ago and the configs are pretty well used. It even supports execution profiles and IDE integration of the configs: https://robotcode.io/01_about/#configure-your-robot-framework-environment-with-robot-tomlMaybe, the efforts could be less when adopting the approach of Robotcode. That would save design and implementation efforts.
Until then, users can already use configuration files by utilizing Robotcode.
jyligehc commentedon Apr 7, 2025
Hi Pekka,
This feature sounds a good idea.
Your point 3 sounds good and, in fact, it pretty much follows what is being done in
invoke(tool also being used in Robot development process).https://docs.pyinvoke.org/en/stable/concepts/configuration.html#config-hierarchy
Points 3-7 in the documentation.
In point 5 the configuration could come from pyproject.toml if robot.toml is not found.
It could try to search these from the current directory and its parent directories.
I also think that while configuration is being processed it would be quite easy to handle environment variables and including them as one source of configuration as well.
pyproject.toml#4843 as a duplicate of this issuebhirsz commentedon Aug 20, 2026
As already mentioned, some tools in robot ecosystem already use toml files (I adopted robot.toml as well, after robotcode). Configuration file support is something I rewrote completely few times until I reached satysfying point. And it looks like current robocop design could be reused for robot itself (how we manage config Discovery, schemat, building from multiple sources etc). I agree with all previous statements from initial post, but I have some new questions:
bhirsz commentedon Aug 27, 2026
I will attempt implementing it. I had short discussion with Pekka on the slack regarding this, we have decided it may be good idea to develop it as external module: the reason is that several tools and libraries may need similiar capability and we can easily vendor-in it in the robotframework itself (so it will be developed separetely for now, so we can start working on it already, and later we will copy it to robot).
We have some basic requirements for now:
pyproject.toml(required section[tools.robot]) androbot.toml(with optional section). we will discuss later whether we want to haverobotframewort.toml(and/instead)I will open separate repositorium and keep ideas / technical decisions here, and get back to this issue once we have clarified approach.
pekkaklarck commentedon Aug 28, 2026
Quick comments to what @bhirsz wrote above:
Implementing this in a separate project is definitely a good idea for various reasons:
I like how with Robot you can nowadays define options by writing a
--helptext and our argument parser then parsing all information from there. Enhancing it to support default values, list of accepted values, type information, and so on is likely not possible, so we need to come up with something new. Whatever we come up with should be convenient to use and be based on conventions rather than heavy configuration.RF 8.0 will be out after Python 3.10 has reached its EOL.
tomllibis new in Python 3.11 and we can either make that the minimum version or require Python 3.10 users to install the externaltomllibmodule. Either way, we don't need to care abouttomllibnot being available.pekkaklarck commentedon Aug 28, 2026
We did some very initial design discussion and I proposed this kind of approach:
The above would automatically parse command line options
--name (-N),--console-width (-W)and--listener, and searchname,console_widthandlistenersfrom the config files. It would also figure out default values, types (and do automatic conversion), whether an option is allowed once or multiple times, and so on.Incidentally RoboCop uses something similar, so it seems we have the base design done. Let's continue the design discussion in the new project @bhirsz will set up.
bhirsz commentedon Aug 28, 2026
Robocop uses different approach - we use typer for cli parsing. However we reuse similiar approach in different parts of the tool, and we also use 'class-based' approach for config parsing etc.
I've created https://github.com/MarketSquare/confargs repository. I've also implemented the MVP of tool.
The equivalent of robot framework parser lies here: https://github.com/MarketSquare/confargs/blob/main/tests/robot_cli.py
Now I will focus on code review (it was mostly generated, based on my requirements) and adding some acceptance tests to see what we are still missing. Also some features are still not implemented.
Replace robot/rebot CLI parsing with confargs and add config file sup…
Replace robot/rebot CLI parsing with confargs and add config file sup…
Replace robot/rebot CLI parsing with confargs and add config file sup…
Replace robot/rebot CLI parsing with confargs and add config file sup…
Replace robot/rebot CLI parsing with confargs and add config file sup…
Replace robot/rebot CLI parsing with confargs and add config file sup…
Replace robot/rebot CLI parsing with confargs and add config file sup…
Replace robot/rebot CLI parsing with confargs and add config file sup…
Replace robot/rebot CLI parsing with confargs and add config file sup…
Replace robot/rebot CLI parsing with confargs and add config file sup…
bhirsz commentedon Sep 18, 2026
I had questions regarding robotcode <> robot configuration file syntax portability. The aim it so have as closest syntax as possible, but most likely there will be breaking changes between the two. For example if robotcode keeps robtcode specific parameter names inside tool.robot section - if we use strict mode on default, it will report unknown parameter.
Additional differences:
<array>may be also confusingThere are some pros of robotcode approach, but I must admit I had to consult the documentation first when I simply tried to use robot cli parameter names in toml in the past. We could support both (singular/plurar names for list-like options, and support list/dict for variables).