diff --git a/.vscode/settings.json b/.vscode/settings.json index ba2014c..32ee17e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" } \ No newline at end of file diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 2a04a36..129cba9 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -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. diff --git a/docs/source/introduction.rst b/docs/source/introduction.rst index e016cde..86d6c6e 100644 --- a/docs/source/introduction.rst +++ b/docs/source/introduction.rst @@ -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