Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
also accept .yml (not just .yaml) as configuration extension #232
Most tools I know use ".yml" as extension for YAML files (docker-compose for example).
No big deal but nice to have.
I feel like I had a specific reason for not honoring both, but cannot remember offhand what that was (or if I am misremembering). May have been due to an earlier use of a third party lib in the config stuff, for example (which no longer applies).
Seems like the primary reason besides "it's cleaner to only support one" is that we'd have to declare a separate "load order" for yml vs yaml, should the user have both in the same location for whatever reason, and this was likely to be confusing and/or more complex to implement.
Alternately, we could just explode angrily as per the Zen of Python.
I haven't looked in the config junk basically since that ticket completed...if it's reasonably easy to actually implement this (preferably the explosion option), I would probably be +1 on it, as then the benefits would outweigh the negatives.
It seems to be as easy as:
diff --git a/invoke/config.py b/invoke/config.py index 9ab852e..1ca28fc 100644 --- a/invoke/config.py +++ b/invoke/config.py @@ -278,7 +278,7 @@ class Config(DataProxy): prefix. """ # Config file suffixes to search, in preference order. - self._file_suffixes = ('yaml', 'json', 'py') + self._file_suffixes = ('yaml', 'yml', 'json', 'py') # Technically an implementation detail - do not expose in public API. # Stores merged configs and is accessed via DataProxy. @@ -557,6 +557,8 @@ class Config(DataProxy): with open(path) as fd: return yaml.load(fd) + _load_yml = _load_yaml + def _load_json(self, path): with open(path) as fd: return json.load(fd)
(plus documentation changes, of course). I'm happy to make the changes if @bitprophet concurs.