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.jsonis the default configuration file.
app/__init__.pycontains 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.pydefines specialized logging helper definitions.settings.pydefines program operating settings.
config/contains program JSON configuration files.tests/contains tests for the project (pytest).logs/contains program logs (debug, error, default).main.pyis 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, --helpprints command and syntax help for the program.-v, --verboseenables verbose output.-c, --configpoint to a non-default configuration file.--versionprints program version information.