A boilerplate python project that implements a CLI, logging, settings and file-based configuration loading.
- Enter virtual environment with
pipenv shell
- Install dependencies by running
pipenv install
- Run tool with
python main.py
- 😎 That's it!
- All configuration for the program will go in
config/
.config.json
is the default configuration file.
app/
__init__.py
contains 3 important methods:init(args)
is the initial configuration stage of the program.load_config(args)
is the configuration file loading stage.process(args, config)
is the main logic of the program.
logging.py
defines specialized logging helper definitions.settings.py
defines program operating settings.
config/
contains program JSON configuration files.tests/
contains tests for the project (pytest).logs/
contains program logs (debug, error, default).main.py
is the main entry point of the program.
You can define your own schema as you see fit. Just make sure to adjust the DEFAULT_CONFIG in app/settings.py
.
This template uses argparse to define CLI commands.
-h, --help
prints command and syntax help for the program.-v, --verbose
enables verbose output.-c, --config
point to a non-default configuration file.--version
prints program version information.