kaptan icon indicating copy to clipboard operation
kaptan copied to clipboard

when using files it does not:

Open alexsavio opened this issue 9 years ago • 4 comments

When using files, Kaptan does not:

  • check for '.py' extension from the file argument or,
    • this could be helpful for: not having to define a handler, being able to input a real file path to import_config
  • check if the file is in the path of the interpreter or,
    • this could be helpful for: being able to import a config file wherever it is.
from kaptan import Kaptan
kp = Kaptan()
kp.import_config('config.py')
ImportError
from kaptan import Kaptan
kp = Kaptan(handler='file')
kp.import_config('config.py')
ImportError
from kaptan import Kaptan
kp = Kaptan(handler='file')
kp.import_config('/home/user/project/config.py')
ImportError
from kaptan import Kaptan
kp = Kaptan(handler='file')
cfg = kp.import_config('config')

alexsavio avatar Dec 07 '15 11:12 alexsavio

Feel free to send a PR :-)

Not sure I have time these days. +1 for the suggestions though. That's definetely a to-do.

emre avatar Dec 07 '15 14:12 emre

@tony do you have time for this? :+1:

emre avatar Dec 07 '15 14:12 emre

Hi,

I have just done some kind of adapter here: https://github.com/Neurita/pypes/blob/wip/pypes/config.py#L60

But I can send a PR soon if you agree with the issue.

alexsavio avatar Dec 07 '15 14:12 alexsavio

sounds like a good idea

@alexsavio I'm happy to review / QA if you want to PR it. Be sure to include tests.

tony avatar Dec 07 '15 15:12 tony