-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add ability to get parsed configs #3369
Comments
there is nothing like that at the moment |
@wimglenn are you thinking about a method in It should be very simple to implement, not sure if it is a good idea though... your suggestion is that would be used when a plugin provides the same option both from the command-line and in |
Yes, |
Not sure we should use a special method for that, it might be not entirely obvious that (badgers badgers badgers..., snake snake oooh that's a snake!!) |
Hmm, on the contrary, I've actually incorrectly assumed the attribute access |
well - there currently is a major probem with that one - ini config items and cli option items have ever so slightly different semantics for definition at the moment also there is the idea of eventually supporting pyproject.toml, which is different yet again just pretending these things are the same will be problematic - i would like to see a unification that brings together the config formats and the cli in a more consistent manner myself |
Does pytest have final applied options? I mean we can write something like def __getitem__(self, item):
option = None
try:
option = getattr(get_config().option, item)
except ValueError:
pass
return option in |
@feuillemorte -1 - that just raises the responsibilities of the config object, currently those are broken and complex ^^ |
Ok, I want to try to understand how to unificate different config options. Could you tell me what I need to watch for this? |
@feuillemorte many of those are "deprecated" apis which where not propperly deprecated as we simply didnt deprecate i would like to see a common way to declare parsed options, inifile components, toml values, but i dont really want to even work on that if we cant even initialize the config object without heisenbugs |
It is not clear to me exactly what are the problems you are discussing @RonnyPfannschmidt (mind I'm not saying that there are none, just that I honestly don't know what you are talking about specifically). Could you please elaborate exactly what are the current problems and what you envision would be the proper solution? Points which are fuzzy to me:
And I know my way a bit around the code, people who are new to the code probably don't have any idea of what the above means. I fear that without a proper explanation this issue will sit here effectively blocked forever because nobody else but you knows what should be done to move this forward. 😕 |
a good starting point would be a new way to introduce configuration values, and then expand ini configuration and commandline configuration to push to configuration values instead of the current storage followin gthat we could then deprecate the distinct old ways and migrate to the new system before doing that i would like to de-tangle config object initialization, as we currently initialize config objects in a inconsistent way that's broken for xdist and certain other usages |
Could devs please add a high-level interface to get parsed configuration values, the ones which will eventually be used? Currently I check in
request.config.option.myconfig
(which comes from command-line) and if that'sNone
then I check inrequest.config.getini('myconfig')
(which comes from config file). I'm not sure if there can be maybe environment variables inbetween cmdline and file conf too, because I don't generally use those. It would be nice to have one config map to encapsulate this layered lookup (may I suggest a collectionsChainMap
- cmdline, environment, file, defaults)...or is it already there, and I'm missing something obvious?
The text was updated successfully, but these errors were encountered: