The Configuration
See original GitHub issueLet’s use this issue to collect thoughts on how the construction of the configuration should work. Like with #663 I suggest we edit this issue to reflect the results of our discussion.
Construction
Ways to define a (default) config:
- Plain Dict
ex.add_config({'a': 10, 'b': 'foo'})
- Config Files
Essentially the same as plain dict, but from a file.
ex.add_config_file('my_config.json')
- Programmatically
This corresponds to current config scopes. Allows embedding some logic into the configuration process.
def configure(cfg): cfg.a = 10 cfg.b = 2 * cfg.a
- Gather from Functions
Collect configuration from the signatures of certain functions. Inspired by gin-config and gather_default_args.
@gather_config def some_function(a: int = 10, b: str = 'foo'): """ Possibly provide argument documentation in the doc-string""" ....
- Environment Variables
An optional env-key could be specified for the parameters to automatically load them from environment variables. This might require a type specification for converting the value. E.g.:
def configure(cfg): cfg.foo = Parameter(1337, env_key='SACRED_FOO', type=int)
Config Structure
The configuration should support:
- dotted access for keys that are valid python identifiers
- arbitrary (even non-str) keys as long as they are hashable builtin types (
str
,int
,float
,tuple
) - arbitrary objects as values (e.g.
pathlib.Path
,datetime
,numpy.array
, …)
Parameters
A Parameter
(Param
, Argument
, Arg
, Entry
, Value
) class keeps track of the all the meta information related to a configuration value. This includes:
- value
- description
- type
- validation
Serialization
Importantly the configuration has to be serializable to JSON, so that it can be easily stored in a MongoDB. This will require integration of a tool like jsonpickle
.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Configuration Definition & Meaning - Merriam-Webster
The meaning of CONFIGURATION is relative arrangement of parts or elements. How to use configuration in a sentence. Did you know?
Read more >What is configuration? | Definition from TechTarget
Generally, a configuration is the arrangement - or the process of making the arrangement - of the parts that make up a whole,...
Read more >Configuration - Wikipedia
Computer configuration or system configuration · Configuration file, a software file used to configure the initial settings for a computer program · Configurator, ......
Read more >configuration | molecular structure - Encyclopedia Britannica
configuration, in chemistry, the spatial arrangement of atoms in a molecule. The configuration is usually depicted by means of a three-dimensional model (a ......
Read more >Electron Configuration - Basic introduction - YouTube
This chemistry video tutorial provides a basic introduction into electron configuration. It contains plenty of practice problems and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am having a hard time figuring out how to properly design a “fully configurable” experiment. Let me explain my use case:
What is the best way to use Sacred? It looks like using automain does not fit properly since I need to rerun
exp.run('command')
with my programmatically updated configurations. Doing this reruns the basic configs scope thus clears out the configuration that I override in the command line.I may be missing something here but to my sense, the most global configuration (@exp.config decorator) should be run only once?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.