Skip to content

notify function and conf defaults #3

@AFriemann

Description

@AFriemann

Hey there,

first of all thank you for this project. It comes down to a really nice solution overall.
Unfortunately I have 2 minor issues with it.

The notify function

While I agree that debug logging would be nice here, simply printing to stdout is kind of annoying. I'd like to have control over my application output without resorting to monkey patching your project. Using python logging would solve this easily

import logging
notify = logging.getLogger(__package__).debug

Would be the easiest solution here.

Config defaults

It would be nice to be able to set defaults for the configuration directory. E.g. I like to configure my projects from ~/.config/${PACKAGE}/config.{ini,yaml,cfg}.
Click comes with the get_app_dir() function which would make this really comfortable.
My current workaround is to set the environment variable

if not os.environ.get('CONF'):
    os.environ.update(CONF=click.get_app_dir(__package__))

Your type specification for the conf option gets in the way here, as exists is set to True and thus the directory needs to be created for this to work. It might be a good idea to make this behaviour configurable as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions