Skip to content

Commit

Permalink
Add ConfigPath documentation (closes #20)
Browse files Browse the repository at this point in the history
  • Loading branch information
okomestudio committed Apr 22, 2020
1 parent 1346f3f commit 2c37932
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ ResConfig Object
:show-inheritance:


ConfigPath Object
-----------------

.. module:: resconfig.io.paths

.. autoclass:: ConfigPath
:show-inheritance:

.. autoclass:: INIPath
:show-inheritance:

.. autoclass:: JSONPath
:show-inheritance:

.. autoclass:: TOMLPath
:show-inheritance:

.. autoclass:: YAMLPath
:show-inheritance:


Actions
-------

Expand Down
30 changes: 30 additions & 0 deletions docs/source/config_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,33 @@ errors.

The “``~``” character in file paths will be expanded to the path
defined in the ``HOME`` environment variable.


File Types
----------

:class:`.ResConfig` understands the following file formats:

- INI (`.ini`)
- JSON (`.json`)
- TOML (`.toml`)
- YAML (`.yaml` or `.yml`)

with the given filename extensions.

By default, a filename without extension is assumed to be of INI
type. If you wish to explicitly specify file type, you may do so using
a :class:`.ConfigPath` subclass as follows:

.. code-block:: python
from resconfig.io.paths import YAMLPath
config = ResConfig(config_files=[YAMLPath("myconf"),
YAMLPath("~/.myconf),
YAMLPath("/etc/myconf")])
This way, all the files are considered to be of YAML type, regardless
of extension. :class:`.ResConfig` supplies :class:`.INIPath`,
:class:`.JSONPath`, :class:`TOMLPath`, and :class:`YAMLPath` for this
purpose.

0 comments on commit 2c37932

Please sign in to comment.