Updating documentation for new __header__ functionality

This commit is contained in:
2020-08-25 22:54:58 +01:00
parent 328b4ea1ea
commit 5f98d3825b
3 changed files with 30 additions and 3 deletions

View File

@@ -2,5 +2,6 @@
"python.linting.pylintEnabled": false,
"python.linting.prospectorEnabled": true,
"python.linting.enabled": true,
"python.pythonPath": ".venv/bin/python"
"python.pythonPath": ".venv/bin/python",
"restructuredtext.confPath": "${workspaceFolder}/docs/source"
}

View File

@@ -3,8 +3,34 @@ Configuration
panaetius is fairly easy to configure. There are just a couple of options to be aware of.
Manual configuration of ``Config`` instance
--------------------------------------------
Configuring with a ``__header__.py`` is deprecated. Manually set this value.
Use the following snippet to configure (in ``__init__.py``):
.. code-block:: python
import panaetius
from panaetius.config import Config
CONFIG = Config(path="~/.config/island-code-extractor", header="island-code-extractor")
panaetius.set_config(CONFIG, "reddit.secret")
Access this in your code by importing the ``CONFIG`` instance from your module:
.. code-block:: python
from island_code_extractor import CONFIG
from island_code_extractor import panaetius
CONFIG.reddit_output_path
panaetius.logger.info("Using logger")
__header__.py
----------
-------------
You should set a ``__header__.py`` next to your script or module.

View File

@@ -22,7 +22,7 @@ Setting a config file
The main functionality of ``panaetius`` is using a config file to store variables.
Your ``config.toml`` can be created and found in ~/.config/__header__/config.toml where __header__ is equal to the variable configured/set. `See how to configure`_ this variable in the configuration section of panaetius.
Your ``config.toml`` can be created and found in ``~/.config/__header__/config.toml`` where ``__header__`` is equal to the variable configured/set. `See how to configure`_ this variable in the configuration section of panaetius.
.. _See how to configure: https://panaetius.readthedocs.io/en/latest/configuration.html#header-py