Add narrative docs for app configuration
This commit is contained in:
parent
f9a7b41f94
commit
4641e24afd
11 changed files with 596 additions and 47 deletions
|
@ -2,62 +2,28 @@
|
|||
WuttJamaican
|
||||
============
|
||||
|
||||
aka. Whatcha Makin
|
||||
|
||||
This package provides a "base layer" of sorts, for apps built with it.
|
||||
This package provides a "base layer" for custom apps.
|
||||
|
||||
It mostly is a distillation of certain patterns developed within the
|
||||
Rattail Project, which are deemed generally useful. (At least,
|
||||
`Rattail Project`_, which are deemed generally useful. (At least,
|
||||
according to the author.) It roughly corresponds to the "base layer"
|
||||
as described in the Rattail Manual (see :doc:`rattail-manual:base/index`).
|
||||
as described in the Rattail Manual (see
|
||||
:doc:`rattail-manual:base/index`).
|
||||
|
||||
.. _Rattail Project: https://rattailproject.org/
|
||||
|
||||
Good documentation and 100% test coverage are priorities for this project.
|
||||
|
||||
Much remains to be done, and it may be slow going since I'll be trying
|
||||
to incorporate this package into the main Rattail package along the
|
||||
way. So we'll see where this goes...
|
||||
|
||||
Main points of focus so far are the configuration and command line
|
||||
interfaces.
|
||||
Rattail is still the main use case so far, and will be refactored
|
||||
along the way to incorporate what this package has to offer.
|
||||
|
||||
|
||||
Basic Usage
|
||||
-----------
|
||||
Features
|
||||
--------
|
||||
|
||||
Install with:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
pip install wuttjamaican
|
||||
|
||||
Create a config file, e.g. ``my.conf``:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[foo]
|
||||
bar = A
|
||||
baz = 2
|
||||
feature = true
|
||||
words = the quick brown fox
|
||||
|
||||
In your app, load the config and reference its values as needed::
|
||||
|
||||
from wuttjamaican.conf import make_config
|
||||
|
||||
config = make_config('/path/to/my.conf')
|
||||
|
||||
# this call.. ..returns this value
|
||||
|
||||
config.get('foo.bar') # 'A'
|
||||
|
||||
config.get('foo.baz') # '2'
|
||||
config.get_int('foo.baz') # 2
|
||||
|
||||
config.get('foo.feature') # 'true'
|
||||
config.get_bool('foo.feature') # True
|
||||
|
||||
config.get('foo.words') # 'the quick brown fox'
|
||||
config.get_list('foo.words') # ['the', 'quick', 'brown', 'fox']
|
||||
* flexible configuration, using config files and/or DB settings table
|
||||
* flexible command line interface, with arbitrary top-level and
|
||||
subcommands
|
||||
|
||||
|
||||
Contents
|
||||
|
@ -66,6 +32,8 @@ Contents
|
|||
.. toctree::
|
||||
:maxdepth: 3
|
||||
|
||||
glossary
|
||||
narr/index
|
||||
api/index
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue