Configuration Utility

Configuration Utility Files

Framework File

In order to streamline my application configuration process, I put together a utility that can be useful in creating and managing file-based settings.  The tool is a command line script that has some optional arguments.

$ python -h
usage: [-h] [-k] [-d] [-f FILE] [-c CONVERT]

Process PokeyConfig files

optional arguments:
  -h, --help            show this help message and exit
  -k, --skip            Skip the intro banner
  -d, --debug           Enable debugging messages
  -f FILE, --file FILE  Specify a file
  -c CONVERT, --convert CONVERT
                        w/--file, convert file format, 1=json,2=yaml

To convert, pass a legacy file and conversion format
You will be prompted for a delimiter (not yet enabled).


Interacting with options and values requires the use of the menu system. This release will be limited in functionality to opening and editing files – conversion functions are built but not yet vetted, and should be skipped until future notice.

You can suppress the banner with the -k –skip argument.  Hit o to specify a file to open.  Everything is prompted, and the functions are very straightforward.  The available functions have been tested in a limited capacity.

There is not much output in this version, errors will show stack traces in some cases, this is an alpha release.  I’m working up the logging, debug, and other messaging, and additional functionality like directed conversions.  As it stands, the utility should function nicely in editing files created using the PokeyConfig class.

Start by copying the example file in the /resources/frameworks/ directory and open it to edit the options.

$ cp example.json app_config.json
$ python -k --file app_config.json
Opening app_config.json

View options
Add an option
Edit an option
Remove an option
Write config

Selection > 

To utilize the file in your application, use the pokeyworks.PokeyConfig class.

>>> from pokeyworks import PokeyConfig
>>> cfg = PokeyConfig('app_config.json',PokeyConfig.json,True)
>>> cfg.version

Full details on PokeyConfig.  This class is only useful for file-based configuration of Python applications, future versions will include python-based file configurations.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.