tr11 / python-configuration

A Python library to load configuration parameters

Home Page:https://tr11.github.io/python-configuration/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve "Gettting started" and "Developing" sections in docs

dwich opened this issue · comments

Good project but I got stuck with two things at the begining and I suppose I am not alone. I couldn't find basic example until I dug deep. It's also not easy to guess - where does the config_from_* come from and what is the name of the installed package.

What I missed in the "Getting started" section was:

from config import config_from_dict

cfg = {
    'a': {
        'b': 'value'
    }
}

cfg = config_from_dict(cfg)

I also wanted to download the code, run the tests and eventually contribute at least some docs improvements as a PR. I use different tools than poetry and was stuck again. What I missed was an example: After you clone git repo, install packages using
poetry install or poetry install -E aws -E azure -E gcp -E toml -E yaml.
To run all the tests run pytest or poetry run pytest.

If the test diplays a message ValueError: Invalid tenant id provided., do this and that...

Thank you for the suggestions. Could you submit a PR with those changes? Thanks!

I'm new to python, but I'm an experienced full stack developer in other languages.

in my project I'm trying to load a default config file, and a 'local override' file, but I'm having trouble with the above content, and referencing the proper path of my config files.

I had to write a small function to fix the relative path to project files.

def fix_path(file_path):
    """fixes a path so project files can be located via a relative path"""
    script_path = os.path.dirname(__file__)
    return os.path.normpath(os.path.join(script_path, file_path))

What Python version are you using?