1
Fork 0
mirror of https://github.com/Steffo99/cfig.git synced 2024-11-22 07:54:21 +00:00
cfig/docs/index.rst

63 lines
1.4 KiB
ReStructuredText
Raw Normal View History

2022-04-19 02:09:05 +00:00
####
cfig
####
2022-04-20 02:15:10 +00:00
The :mod:`cfig` package provides a simple but powerful configuration manager for Python applications.
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
Goals
=====
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
A goal is to allow easy integration of an application with multiple configuration standards, such as environment
variables, dotenv files, and Docker Secrets files.
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
.. code-block:: python
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
@config.required()
def SECRET_KEY(val: str) -> str:
"Secret string used to manage tokens."
return val
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
Another goal is to provide informative error messages to the user who is configuring the application, so that they may
understand what they are doing wrong and fix it immediately.
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
.. code-block:: console
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
$ python -m cfig.sample
=== Configuration ===
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
SECRET_KEY → Required, but not set.
Secret string used to manage HTTP session tokens.
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
HIDDEN_STRING = 'amogus'
A string which may be provided to silently print a string to the console.
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
Finally, the last goal is having useful typing for developers using :mod:`cfig`, allowing them to make full use of the
features of their IDEs.
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
.. image:: example-typing.png
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
Example
=======
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
If you'd like to learn how to use :mod:`cfig` hands-on,
read `the source code of the cfig.sample module <https://github.com/Steffo99/cfig/tree/main/cfig/sample>`_!
2022-04-19 02:09:05 +00:00
2022-04-20 02:15:10 +00:00
Pages of this documentation
===========================
2022-04-19 02:09:05 +00:00
.. toctree::
2022-04-20 02:15:10 +00:00
terminology
reference
2022-04-19 02:09:05 +00:00
Other tables and links
======================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`