-
Notifications
You must be signed in to change notification settings - Fork 2
Description
A local datafs config that overrides the global config in a given working directory
Purpose
A local datafs config would be useful for a couple reasons:
- It could make examples & testing much easier, as you would only need a local config file (override a non-existant global config file)
- It could handle additional use-specific parameters, such as
--profile - It would enable adding additional use-specific features down the line, such as requirement pinning
UI suggestion
I'm imagining something like this:
datafs --profile my_api create_archive my_archive
--description "my new archive" --project "myproj" --versioned Falsecould be replaced by
datafs create_archive my_archive --description "my new archive"in the presence of this .datafs.yml file
default_profile: my_api
archive_kwargs:
metadata:
project: "myproj"
versioned: FalseImplementation
Local version of global config options
Overriding existing configuration options is easy... just read a second config file and update (rather than replace) the elements in the config dictionary. For some nested items, such as profiles, it may be worth doing a nested update. Something like this would do:
import collections
def update(d, u):
for k, v in u.items():
if isinstance(v, collections.Mapping):
r = update(d.get(k, {}), v)
d[k] = r
else:
d[k] = u[k]
return dThis would be done in ./datafs/config/config_file.py:ConfigFile.parse_configfile_contents, which merges config dictionaries in with the defaults. If this were modified to handle updates more generally (as above) we could pass it multiple config files in series.
New archive config options
Adding the new "archive kwargs" and other options is a larger and longer-term project that is not essential for the Beta milestone.