Closed TheDataLeek closed 7 years ago
Further detailed in the wiki page Configuration.
The updated configuration is pretty much there in the dev branch now.
I will post an update about the proposed syntax soon here.
This is a 'config' function definition:
config(options: Dict, reset: bool=False)
And this is a default configuration merged with an 'options' dictionary on each call:
(None
means leave the previous value unchanged)
default_options = {
# Global enforce.py on/off switch
'enabled': None,
# Group related settings
'groups': {
# Dictionary of type {<name: str>: <status: bool>}
# Sets the status of specified groups
# Enable - True, disabled - False, do not change - None
'set': {},
# Sets the status of all groups to False before updating
'disable_previous': False,
# Sets the status of all groups to True before updating
'enable_previous': False,
# Deletes all the existing groups before updating
'clear_previous': False,
# Updating the default group status - default group is not affected by other settings
'default': None
},
# Sets the type checking mode
# Available options: 'invariant', 'covariant', 'contravariant', 'bivariant' and None
'mode': None
}
I think this general issue is now closed. Details and specifics should have their own issues.
It would be nice to be able to configure some basic settings globally, rather than having to set them on a per-function basis. This would extend #7 and #4.
Possible syntax is
This would allow to build programs where type checking can be enabled through command line arguments.
I'm not sure how the code to implement this would work, but I can start looking into it. It might not also hurt to have "tagged" functions so that you can configure groups of functions at a time. For example
I'm open to suggestions on syntax, especially for the function group config.