intake / intake

Intake is a lightweight package for finding, investigating, loading and disseminating data.
https://intake.readthedocs.io/
BSD 2-Clause "Simplified" License
1.01k stars 141 forks source link

intake server config yaml example looks to be out of date #437

Open zbarry opened 5 years ago

zbarry commented 5 years ago

I'm using Intake version 0.5.3 from conda-forge.

From this section of the docs: https://intake.readthedocs.io/en/latest/tools.html#configuration

In using this formulation of the intake server config provided:

auth:
  class: "intake.auth.base.BaseAuth"
port: 5000
catalog_path:
  - /home/myusername/special_dir

I get this error message when starting intake-server:

2019-11-06 11:08:03,389 - intake - INFO - __main__.py:main:L63 - Listening on port 5000
Traceback (most recent call last):
  File "/scratch/miniconda3/envs/inscopix/bin/intake-server", line 10, in <module>
    sys.exit(main())
  File "/scratch/miniconda3/envs/inscopix/lib/python3.7/site-packages/intake/cli/server/__main__.py", line 65, in main
    server = IntakeServer(catalog)
  File "/scratch/miniconda3/envs/inscopix/lib/python3.7/site-packages/intake/cli/server/server.py", line 33, in __init__
    self._auth = remake_instance(auth)
  File "/scratch/miniconda3/envs/inscopix/lib/python3.7/site-packages/intake/utils.py", line 127, in remake_instance
    mod, klass = data.pop('cls').rsplit('.', 1)
KeyError: 'cls'

Changing that nested auth section to just auth: "intake.auth.base.BaseAuth" solves the problem. I'm guessing that the docs are describing an old way to do it.

martindurant commented 5 years ago

Yes you are quite right, the line is

auth = conf.get('auth', 'intake.auth.base.BaseAuth')

but the default is 'auth': {'cls': 'intake.auth.base.BaseAuth'}, so this probably doesn't get called normally.

intake.tests.test_config::test_conf_auth seems to test passing auth in the config, and does indeed use cls, so it would be good to work out where the difference is coming from, why using just the string works for you.

martindurant commented 4 years ago

Are you still interested in fixing this?