sacred icon indicating copy to clipboard operation
sacred copied to clipboard

Adding period to name argument of Experiment modifies function names.

Open cwitkowitz opened this issue 1 year ago • 2 comments

I've stumbled across a weird issue that occurs if I simply change Experiment('hello_config') to Experiment('hello_config.') in the following example (from the quickstart guide):

from sacred import Experiment

ex = Experiment('hello_config')

@ex.config
def my_config():
    recipient = "world"
    message = "Hello %s!" % recipient

@ex.automain
def my_main(message):
    print(message)

This results in the following error:

Usage:
  test.py [(with UPDATE...)] [options]
  test.py help [COMMAND]
  test.py (-h | --help)
  test.py COMMAND [(with UPDATE...)] [options]
Error: Command "my_main" not found. Available commands are: rint_config, rint_dependencies, ave_config, rint_named_configs, y_main

cwitkowitz avatar Mar 23 '23 17:03 cwitkowitz

Hey @cwitkowitz! Thanks for bringing this up! I remember that this issue, or at least something related to periods in experiment or config names, came already up some time ago (before I became a collaborator), but I don't remember which issue it was...

This is clearly not the desired behavior. But, what is desired here? Should it "just work" or should this become an error?

thequilo avatar Mar 28 '23 06:03 thequilo

I think either solution would be fine, however, from a user-pointing perspective the experiment name is just a string, so it seems one should be able to specify any arbitrary string. The main problem is that the behavior is completely unexpected and hard to trace back to having a period in the config name. As far as I am aware, there is also nothing in the docs that indicates this can happen.

cwitkowitz avatar Mar 28 '23 13:03 cwitkowitz