I'm releasing my app as a pip package. I want users to be able to type "my_app" at the command line. I want this main script to take a Hydra configuration as input.
What works:
python -m my_app.gui.main
What doesn't work:
my_app
In my_app\gui\main:
@hydra.main(config_path='../conf/gui.yaml')
def run(cfg: DictConfig) -> None:
log.info('CWD: {}'.format(os.getcwd()))
In my setup.py:
entry_points={
'console_scripts':[
'my_app= my_app.gui.main:run']
},
* Stack trace/error message *
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\deg\Scripts\my_app-script.py", line 11, in <module>
load_entry_point('my_app==0.0.1', 'console_scripts', 'my_app')()
File "C:\ProgramData\Anaconda3\envs\deg\lib\site-packages\hydra\main.py", line 24, in decorated_main
strict=strict,
File "C:\ProgramData\Anaconda3\envs\deg\lib\site-packages\hydra\_internal\utils.py", line 147, in run_hydra
calling_file, calling_module, config_dir
File "C:\ProgramData\Anaconda3\envs\deg\lib\site-packages\hydra\_internal\utils.py", line 120, in create_automatic_config_search_path
message="Primary config dir not found: {}".format(search_path_dir),
hydra.errors.MissingConfigException: Primary config dir not found: C:\ProgramData\Anaconda3\envs\deg\Scripts\conf
I tried to follow the formula outlined in this issue here
Edit: I think it was just a versioning issue. Switching to the "old" version of issue #92 works fine.
@jbohnslav, this is the doc for the app packaging.
There is a link there to a working example you should base your thing on.
When 1.0.0 is out, the example in master will be the correct one to follow.