2023-10-28 17:48:37 -05:00
|
|
|
|
|
|
|
WuttJamaican
|
|
|
|
============
|
|
|
|
|
|
|
|
aka. Whatcha Makin
|
|
|
|
|
|
|
|
This package provides a "base layer" of sorts, for apps built with it.
|
|
|
|
|
|
|
|
It mostly is a distillation of certain patterns developed within the
|
|
|
|
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`).
|
|
|
|
|
|
|
|
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...
|
|
|
|
|
2023-11-19 14:22:25 -06:00
|
|
|
Main points of focus so far are the configuration and command line
|
|
|
|
interfaces.
|
2023-10-28 17:48:37 -05:00
|
|
|
|
|
|
|
|
|
|
|
Basic Usage
|
|
|
|
-----------
|
|
|
|
|
|
|
|
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
|
2023-11-19 14:22:25 -06:00
|
|
|
words = the quick brown fox
|
2023-10-28 17:48:37 -05:00
|
|
|
|
|
|
|
In your app, load the config and reference its values as needed::
|
|
|
|
|
2023-11-19 00:52:50 -06:00
|
|
|
from wuttjamaican.conf import make_config
|
2023-10-28 17:48:37 -05:00
|
|
|
|
2023-11-19 00:52:50 -06:00
|
|
|
config = make_config('/path/to/my.conf')
|
2023-10-28 17:48:37 -05:00
|
|
|
|
2023-11-19 14:22:25 -06:00
|
|
|
# this call.. ..returns this value
|
2023-10-28 17:48:37 -05:00
|
|
|
|
2023-11-19 14:22:25 -06:00
|
|
|
config.get('foo.bar') # 'A'
|
2023-10-28 17:48:37 -05:00
|
|
|
|
2023-11-19 14:22:25 -06:00
|
|
|
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']
|
2023-10-28 17:48:37 -05:00
|
|
|
|
|
|
|
|
|
|
|
Contents
|
|
|
|
--------
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 3
|
|
|
|
|
|
|
|
api/index
|
|
|
|
|
|
|
|
|
|
|
|
Indices and tables
|
|
|
|
==================
|
|
|
|
|
|
|
|
* :ref:`genindex`
|
|
|
|
* :ref:`modindex`
|
|
|
|
* :ref:`search`
|