Repository: facebookresearch/hydra

Issue:
[Bug] handle yaml file with dot in the name
# 🐛 Bug

<!-- A clear and concise description of what the bug is. -->
When creating yaml file that has dot in the base name, `config_loader.py` erroneously misses the `.yaml` extension which results in a `hydra.errors.MissingConfigException`.

## To reproduce
configuration groups:
```
├── conf
│   └── lr
│       ├── 0.1.yaml
│       └── 0.01.yaml
└── my_app.py
```
with minimum `my_app.py` setup same as in the tutorial
```
python my_app.py lr=0.1
```
Traceback:
```
Traceback (most recent call last):
  File "app.py", line 9, in <module>
    app()
  File "/home/yjxiao/miniconda3/lib/python3.7/site-packages/hydra/main.py", line 24, in decorated_main
    strict=strict,
  File "/home/yjxiao/miniconda3/lib/python3.7/site-packages/hydra/_internal/utils.py", line 56, in run_hydra
    hydra.run(overrides=args.overrides)
  File "/home/yjxiao/miniconda3/lib/python3.7/site-packages/hydra/_internal/hydra.py", line 103, in run
    cfg = self._load_config(overrides)
  File "/home/yjxiao/miniconda3/lib/python3.7/site-packages/hydra/_internal/hydra.py", line 345, in _load_config
    cfg = self.config_loader.load_configuration(overrides)
  File "/home/yjxiao/miniconda3/lib/python3.7/site-packages/hydra/_internal/config_loader.py", line 56, in load_configuration
    cfg = self._merge_defaults(hydra_cfg, defaults, split_at)
  File "/home/yjxiao/miniconda3/lib/python3.7/site-packages/hydra/_internal/config_loader.py", line 395, in _merge_defaults
    cfg = merge_defaults(cfg, user_list)
  File "/home/yjxiao/miniconda3/lib/python3.7/site-packages/hydra/_internal/config_loader.py", line 374, in merge_defaults
    required=not is_optional,
  File "/home/yjxiao/miniconda3/lib/python3.7/site-packages/hydra/_internal/config_loader.py", line 301, in _merge_config
    raise MissingConfigException(msg, new_cfg, options)
hydra.errors.MissingConfigException: Could not load lr/0.1, available options:
lr:
	0.01
	0.1
```
## Questions
- Currently, I have to edit `config_loader.py` file to add the `.yaml` extension whenever it is missing. Would this cause any unwanted behavior with other features? 
- Is it generally not advisable to name config files with, say, float values? Are there better ways to incorporate float values in the config?


Discussion:
Hi @yjxiao,
Thanks for reporting, this is a bug.
Your example makes me wonder if you are using Hydra properly here.
can you share the content of your 0.1.yaml file?
Hi @omry, thanks for the reply. The content of `0.1.yaml` is a single line:
```
lr: 0.1
```

I also tried with a config group:
```
lr:
    value: 0.1
    name: foo
```
`python my_app.py lr.value=0.1` works but `python my_app.py lr=0.1` yields the same error.
the error is a bug.
However, I don't see why you need a config group if all you have there is this one line.

if you want to associate more things (like name: foo) with lr=0.1 it makes sense, but if you only want to set the learning rate to 0.1 you can just override it directly from the command line.

Resolving patch:
diff --git a/hydra/_internal/config_loader.py b/hydra/_internal/config_loader.py
--- a/hydra/_internal/config_loader.py
+++ b/hydra/_internal/config_loader.py
@@ -358,9 +358,9 @@ def _exists(is_pkg, filename):
     def _merge_defaults(self, cfg, defaults, split_at):
         def get_filename(config_name):
             filename, ext = os.path.splitext(config_name)
-            if ext == "":
-                ext = ".yaml"
-            return "{}{}".format(filename, ext)
+            if ext not in (".yaml", ".yml"):
+                config_name = "{}{}".format(config_name, ".yaml")
+            return config_name
 
         def merge_defaults(merged_cfg, def_list):
             cfg_with_list = OmegaConf.create(dict(defaults=def_list))
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -104,7 +104,7 @@ def run(self):
             "Operating System :: Microsoft :: Windows",
         ],
         install_requires=[
-            "omegaconf>=1.4.0rc1",
+            "omegaconf>=1.4.0rc2",
             'pathlib2>=2.2.0;python_version<"3.0"',
         ],
         # Install development dependencies with


Test patch:
diff --git a/hydra/test_utils/configs/group1/abc.cde.yaml b/hydra/test_utils/configs/group1/abc.cde.yaml
new file mode 100644
--- /dev/null
+++ b/hydra/test_utils/configs/group1/abc.cde.yaml
@@ -0,0 +1 @@
+abc=cde
\ No newline at end of file
diff --git a/tests/test_conf_loader.py b/tests/test_conf_loader.py
--- a/tests/test_conf_loader.py
+++ b/tests/test_conf_loader.py
@@ -175,6 +175,16 @@ def test_override_with_equals(self, path):
         del cfg["hydra"]
         assert cfg == OmegaConf.create({"normal_yaml_config": True, "abc": "cde=12"})
 
+    def test_compose_file_with_dot(self, path):
+        config_loader = ConfigLoader(
+            config_search_path=create_search_path([path]),
+            strict_cfg=False,
+            config_file="compose.yaml",
+        )
+        cfg = config_loader.load_configuration(["group1=abc.cde"])
+        del cfg["hydra"]
+        assert cfg == {"abc=cde": None, "bar": 100}
+
 
 @pytest.mark.parametrize(
     "primary,merged,result",