mirror of
https://github.com/dtomlinson91/panaetius.git
synced 2025-12-22 04:55:44 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03be9558f8 | ||
| bd1aa09b4c | |||
| b0d635eb04 | |||
| 1d72b976a4 |
17
.vscode/settings.json
vendored
17
.vscode/settings.json
vendored
@@ -4,20 +4,5 @@
|
||||
"python.linting.enabled": true,
|
||||
"python.pythonPath": ".venv/bin/python",
|
||||
"restructuredtext.confPath": "${workspaceFolder}/docs/source",
|
||||
"peacock.color": "#307E6A",
|
||||
"workbench.colorCustomizations": {
|
||||
"editorGroup.border": "#3ea389",
|
||||
"panel.border": "#3ea389",
|
||||
"sash.hoverBorder": "#3ea389",
|
||||
"sideBar.border": "#3ea389",
|
||||
"statusBar.background": "#307e6a",
|
||||
"statusBar.foreground": "#e7e7e7",
|
||||
"statusBarItem.hoverBackground": "#3ea389",
|
||||
"statusBarItem.remoteBackground": "#307e6a",
|
||||
"statusBarItem.remoteForeground": "#e7e7e7",
|
||||
"titleBar.activeBackground": "#307e6a",
|
||||
"titleBar.activeForeground": "#e7e7e7",
|
||||
"titleBar.inactiveBackground": "#307e6a99",
|
||||
"titleBar.inactiveForeground": "#e7e7e799"
|
||||
}
|
||||
"peacock.color": "#307E6A"
|
||||
}
|
||||
|
||||
@@ -32,16 +32,21 @@ See Tembo for an example: <https://github.com/tembo-pages/tembo-core/blob/main/t
|
||||
Example snippet to use in a module:
|
||||
|
||||
```python
|
||||
"""Subpackage that contains the CLI application."""
|
||||
|
||||
import os
|
||||
from typing import Any
|
||||
|
||||
import panaetius
|
||||
from panaetius.exceptions import LoggingDirectoryDoesNotExistException
|
||||
|
||||
|
||||
if (config_path := os.environ.get("TEMBO_CONFIG")) is not None:
|
||||
CONFIG = panaetius.Config("tembo", config_path, skip_header_init=True)
|
||||
CONFIG: Any = panaetius.Config("tembo", config_path, skip_header_init=True)
|
||||
else:
|
||||
CONFIG = panaetius.Config("tembo", "~/tembo/.config", skip_header_init=True)
|
||||
CONFIG = panaetius.Config(
|
||||
"tembo", "~/tembo/.config", skip_header_init=True
|
||||
)
|
||||
|
||||
|
||||
panaetius.set_config(CONFIG, "base_path", "~/tembo")
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line, and also
|
||||
# from the environment for the first two.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
@@ -1,35 +0,0 @@
|
||||
@ECHO OFF
|
||||
|
||||
pushd %~dp0
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set SOURCEDIR=source
|
||||
set BUILDDIR=build
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
|
||||
:end
|
||||
popd
|
||||
@@ -1,87 +0,0 @@
|
||||
@import url("css/theme.css");
|
||||
|
||||
.modname {
|
||||
font-size: 0.8em;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.modname::before {
|
||||
content: '- ';
|
||||
}
|
||||
.title {
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
background-color: #eee;
|
||||
display: block;
|
||||
padding: 1px 5px;
|
||||
border-left: 2px solid #ddd;
|
||||
}
|
||||
|
||||
/*colour of the text in the toc*/
|
||||
.wy-menu-vertical header, .wy-menu-vertical p.caption{
|
||||
color: #b26d46;;
|
||||
}
|
||||
|
||||
/*colour of the top left header*/
|
||||
.wy-side-nav-search{
|
||||
background-color: #31465a;
|
||||
}
|
||||
|
||||
/*colours of the class definitions*/
|
||||
.rst-content dl:not(.docutils) dt{
|
||||
background: #e2d7d1;
|
||||
color: #0b2852;
|
||||
border-top: solid 3px #31465a;
|
||||
}
|
||||
|
||||
/*colour of the link in the class defintions*/
|
||||
.rst-content .viewcode-link, .rst-content .viewcode-back{
|
||||
color: #4b674a;
|
||||
}
|
||||
|
||||
/*colour of the function definitions*/
|
||||
.rst-content dl:not(.docutils) dl dt{
|
||||
border-left: solid 3px #31465a;
|
||||
background: #e2d7d1;
|
||||
color: #0b2852;
|
||||
}
|
||||
|
||||
/*colour of the link in the function definitions*/
|
||||
.rst-content .viewcode-link, .rst-content .viewcode-back{
|
||||
color: #4b674a;
|
||||
}
|
||||
|
||||
/*edit the width of the body*/
|
||||
.wy-nav-content{
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
/*code example blocks*/
|
||||
.rst-content pre.literal-block, .rst-content div[class^="highlight"] pre, .rst-content .linenodiv pre{
|
||||
background: #b4bec8;
|
||||
color: black;
|
||||
/*border-style: solid;*/
|
||||
/*border-width: thin;*/
|
||||
}
|
||||
|
||||
/*colour of inline code blocks using ``*/
|
||||
.rst-content tt.literal, .rst-content tt.literal, .rst-content code.literal{
|
||||
color: #b26d46;
|
||||
}
|
||||
|
||||
/* Change code blocks font and bump up font size slightly (normally 12px)*/
|
||||
.rst-content pre.literal-block, .rst-content div[class^="highlight"] pre, .rst-content .linenodiv pre {
|
||||
font-family: 'Inconsolata', monospace !important;
|
||||
font-size: 14px !important;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* Change code descriptions and literal blocks (inline code via ``) to match the normal font size being used in the sphinx_RTD_theme text (normally 14px)*/
|
||||
.rst-content dl:not(.docutils) tt.descname,.rst-content dl:not(.docutils) tt.descclassname,.rst-content dl:not(.docutils) tt.descname,.rst-content dl:not(.docutils) code.descname,.rst-content dl:not(.docutils) tt.descclassname,.rst-content dl:not(.docutils) code.descclassname, code.docutils {
|
||||
font-family: 'Inconsolata', monospace !important;
|
||||
font-size: 14px !important;
|
||||
}
|
||||
|
||||
/*variables text*/
|
||||
dl.class > dd > table.docutils.field-list tbody tr.field-odd.field th.field-name::before{
|
||||
content: '(Class Attributes) ';
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
Version history
|
||||
================
|
||||
|
||||
1.1
|
||||
----
|
||||
|
||||
- Adding overwrite to ``__header__`` functionality. See the Configuration documentation page on how to configure.
|
||||
|
||||
1.0.2
|
||||
------
|
||||
|
||||
- Minor fixes and documentation updates.
|
||||
|
||||
1.0
|
||||
--------
|
||||
|
||||
- Initial release.
|
||||
@@ -1,95 +0,0 @@
|
||||
# Configuration file for the Sphinx documentation builder.
|
||||
#
|
||||
# This file only contains a selection of the most common options. For a full
|
||||
# list see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
|
||||
# -- Path setup --------------------------------------------------------------
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
# import os
|
||||
# import sys
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
import panaetius
|
||||
from panaetius.__version__ import __version__ as version
|
||||
import sphinx_rtd_theme
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'panaetius'
|
||||
copyright = '2019, Daniel Tomlinson'
|
||||
author = 'Daniel Tomlinson'
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = version
|
||||
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.viewcode',
|
||||
'sphinx.ext.napoleon',
|
||||
'sphinx.ext.todo',
|
||||
]
|
||||
|
||||
# -- Napoleon Settings -----------------------------------------------------
|
||||
napoleon_google_docstring = False
|
||||
napoleon_numpy_docstring = True
|
||||
napoleon_include_init_with_doc = True
|
||||
napoleon_include_private_with_doc = False
|
||||
napoleon_include_special_with_doc = False
|
||||
napoleon_use_admonition_for_examples = False
|
||||
napoleon_use_admonition_for_notes = False
|
||||
napoleon_use_admonition_for_references = False
|
||||
napoleon_use_ivar = True
|
||||
napoleon_use_param = True
|
||||
napoleon_use_rtype = True
|
||||
napoleon_use_keyword = True
|
||||
autodoc_member_order = 'bysource'
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This pattern also affects html_static_path and html_extra_path.
|
||||
exclude_patterns = []
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
html_static_path = ['_static']
|
||||
html_context = {'css_files': ['_static/custom.css']}
|
||||
html_theme_options = {
|
||||
'collapse_navigation': True,
|
||||
'display_version': True,
|
||||
'prev_next_buttons_location': 'both',
|
||||
#'navigation_depth': 3,
|
||||
}
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# Enable todo
|
||||
todo_include_todos = True
|
||||
@@ -1,68 +0,0 @@
|
||||
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.
|
||||
|
||||
This ``__header__.py`` should contain a ``__header__`` variable that sets the name of your project/script.
|
||||
|
||||
E.g a ``__header__.py`` for the module ``plex_posters`` would look like:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
__header__ = 'plex_posters'
|
||||
|
||||
Your config file can then be created at ``~/.config/__header__/config.toml``.
|
||||
|
||||
Your environment variables can be created with:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
HEADER_FOO = "bar"
|
||||
HEADER_SUBSECTION_FOO = "bar"
|
||||
|
||||
The headers of the toml file would look like:
|
||||
|
||||
.. code-block:: toml
|
||||
|
||||
[__header__]
|
||||
foo = bar
|
||||
|
||||
[__header__.subsection]
|
||||
foo = bar
|
||||
|
||||
If you are writing a script, simply place this ``__header__.py`` along side your script. Panaetius will pick this up when the script is ran.
|
||||
|
||||
If you are writing a module, you can either place the ``__header__.py`` alongside the script that uses your module. If this is not possible, panaetius will set the default ``__header__`` variable to the name of the virtualenv that the script is activated from.
|
||||
|
||||
If neither of the above aren't possible (say your script is running in a lambda on AWS), then ``__header__`` will be set to the default of ``panaetius``.
|
||||
@@ -1,5 +0,0 @@
|
||||
.. role:: modname
|
||||
:class: modname
|
||||
|
||||
.. role:: title
|
||||
:class: title
|
||||
@@ -1,3 +0,0 @@
|
||||
Table of Contents
|
||||
=================
|
||||
.. include:: toc.rst
|
||||
@@ -1,154 +0,0 @@
|
||||
Introduction
|
||||
=============
|
||||
|
||||
.. image:: https://img.shields.io/readthedocs/panaetius?style=for-the-badge :target: https://panaetius.readthedocs.io/en/latest/?badge=latest
|
||||
:alt: Documentation Status
|
||||
|
||||
.. image:: https://img.shields.io/github/v/tag/dtomlinson91/panaetius?style=for-the-badge :alt: GitHub tag (latest by date)
|
||||
|
||||
.. image:: https://img.shields.io/github/commit-activity/m/dtomlinson91/panaetius?style=for-the-badge :alt: GitHub commit activity
|
||||
|
||||
.. image:: https://img.shields.io/github/issues/dtomlinson91/panaetius?style=for-the-badge :alt: GitHub issues
|
||||
|
||||
.. image:: https://img.shields.io/github/license/dtomlinson91/panaetius?style=for-the-badge :alt: GitHubtbc
|
||||
|
||||
Python module to gracefully handle a .config file/environment variables for scripts, with built in masking for sensitive options. Provides a Splunk friendly formatted logger instance.
|
||||
|
||||
Usage
|
||||
------
|
||||
|
||||
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.
|
||||
|
||||
.. _See how to configure: https://panaetius.readthedocs.io/en/latest/configuration.html#header-py
|
||||
|
||||
Setting values in a config.toml/environment variables
|
||||
#######################################################
|
||||
|
||||
A ``config.toml`` can be created in the default folder for the module. In this example this would be found in ``~/.config/example_module/config.toml``.
|
||||
|
||||
An example ``config.toml`` could look like:
|
||||
|
||||
.. code-block:: toml
|
||||
|
||||
[example_module]
|
||||
test = "a6cbf36649b029f3618a0cc1"
|
||||
|
||||
[example_module.logging]
|
||||
path = "~/.config/example_module"
|
||||
level = "DEBUG"
|
||||
|
||||
[example_module.foo]
|
||||
bar = "6b3b96815218960ceaf7cceb"
|
||||
|
||||
These are equivalent to the environment variables:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
EXAMPLE_MODULE_TEST
|
||||
EXAMPLE_MODULE_LOGGING_PATH
|
||||
EXAMPLE_MODULE_LOGGING_LEVEL
|
||||
EXAMPLE_MODULE_FOO_BAR
|
||||
|
||||
|
||||
.. Attention::
|
||||
Environment variables take precedent over the ``config.toml``. If both are set then the environment variable will be used.
|
||||
|
||||
You can overwrite the ``config.toml`` location by setting the environment variable:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
DEFAULT_CONFIG_PATH = "~/path/to/config"
|
||||
|
||||
|
||||
Setting values in your code
|
||||
############################
|
||||
|
||||
Values in a ``config.toml`` or from an environment variable need to be set in your work in order for you to use them. You can do this easily by
|
||||
|
||||
- importing panaetius.
|
||||
- using the :func:`~panaetius.library.set_config` function.
|
||||
|
||||
E.g your script could contain:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import panaetius
|
||||
panaetius.set_config(panaetius.CONFIG, 'logging.path')
|
||||
|
||||
.. Note::
|
||||
|
||||
The ``key`` attribute in :func:`~panaetius.library.set_config` is specified as a string, with the hirearchy in the config file split with a ``.``
|
||||
|
||||
.. Important::
|
||||
|
||||
The default value for a variable defined using :func:`~panaetius.library.set_config` is ``None``. See the documentation of this function to see all the options available.
|
||||
|
||||
|
||||
Accessing values
|
||||
#################
|
||||
|
||||
You can then access the result of this variable later in your code:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
panaetius.CONFIG.logging_path
|
||||
|
||||
|
||||
Logging
|
||||
~~~~~~~~
|
||||
|
||||
In order to save to disk, you need to specify a path for the log file in the config file/environment variable. There is no need to register this with :func:`~panaetius.library.set_config` as ``panaetius`` will do this automatically.
|
||||
|
||||
There are other options available for you to configure a logger. These are (including the default values which can be overwritten):
|
||||
|
||||
.. code-block:: toml
|
||||
|
||||
[example_module.logging]
|
||||
backup_count = 3
|
||||
format = "{\n\t"time": "%(asctime)s",\n\t"file_name": "%(filename)s",'
|
||||
'\n\t"module": "%(module)s",\n\t"function":"%(funcName)s",\n\t'
|
||||
'"line_number": "%(lineno)s",\n\t"logging_level":'
|
||||
'"%(levelname)s",\n\t"message": "%(message)s"\n}"
|
||||
level = "INFO" # Level should be in CAPS
|
||||
rotate_bytes = 512000
|
||||
|
||||
You can use the logger in your code by:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
panaetius.logger.info('some log message')
|
||||
|
||||
which gives an output of:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"time": "2020-01-13 23:07:17,913",
|
||||
"file_name": "test.py",
|
||||
"module": "test",
|
||||
"function":"<module>",
|
||||
"line_number": "33",
|
||||
"logging_level":"INFO",
|
||||
"message": "some logging message"
|
||||
}
|
||||
|
||||
|
||||
Importing and using the api
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
See `panaetius api page`_ on how to use and import the module.
|
||||
|
||||
.. _panaetius api page: https://panaetius.readthedocs.io/en/latest/modules/panaetius.html
|
||||
|
||||
|
||||
Configuration
|
||||
---------------
|
||||
|
||||
See `configuration page`_ on how to configure ``panaetius``.
|
||||
|
||||
.. _configuration page: https://panaetius.readthedocs.io/en/latest/configuration.html
|
||||
@@ -1,9 +0,0 @@
|
||||
.. include:: ../global.rst
|
||||
|
||||
panaetius.config :modname:`panaetius.config`
|
||||
---------------------------------------------
|
||||
|
||||
.. automodule:: panaetius.config
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,9 +0,0 @@
|
||||
.. include:: ../global.rst
|
||||
|
||||
panaetius.config_inst :modname:`panaetius.config_inst`
|
||||
--------------------------------------------------------
|
||||
|
||||
.. automodule:: panaetius.config_inst
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,9 +0,0 @@
|
||||
.. include:: ../global.rst
|
||||
|
||||
panaetius.db :modname:`panaetius.db`
|
||||
-------------------------------------
|
||||
|
||||
.. automodule:: panaetius.db
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,9 +0,0 @@
|
||||
.. include:: ../global.rst
|
||||
|
||||
panaetius.header :modname:`panaetius.header`
|
||||
---------------------------------------------
|
||||
|
||||
.. automodule:: panaetius.header
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,9 +0,0 @@
|
||||
.. include:: ../global.rst
|
||||
|
||||
panaetius.library :modname:`panaetius.library`
|
||||
------------------------------------------------
|
||||
|
||||
.. automodule:: panaetius.library
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,9 +0,0 @@
|
||||
.. include:: ../global.rst
|
||||
|
||||
panaetius.logging :modname:`panaetius.logging`
|
||||
----------------------------------------------
|
||||
|
||||
.. automodule:: panaetius.logging
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,66 +0,0 @@
|
||||
.. include:: ../global.rst
|
||||
|
||||
*********
|
||||
panaetius
|
||||
*********
|
||||
|
||||
API
|
||||
===
|
||||
|
||||
The following is availble by importing the module:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import panaetius
|
||||
|
||||
|
||||
panaetius.CONFIG
|
||||
----------------
|
||||
|
||||
:obj:`panaetius.CONFIG` provides an instance of :class:`panaetius.config.Config`
|
||||
|
||||
|
||||
panaetius.set_config()
|
||||
-----------------------
|
||||
|
||||
Conveniently provides :func:`panaetius.library.set_config`
|
||||
|
||||
Use in your module/script with:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
panaetius.set_config(panaetius.CONFIG, 'aws.secret_key', str, mask=True)
|
||||
|
||||
|
||||
panaetius.CONFIG.aws_secret_key
|
||||
-------------------------------
|
||||
|
||||
Conveniently provides access to all attributes that have been declared with :func:`panaetius.library.set_config`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
my_secret_key = panaetius.CONFIG.aws_secret_key
|
||||
|
||||
|
||||
panaetius.logger
|
||||
-----------------
|
||||
|
||||
:obj:`panaetius.logger` provides a logger instance already formatted with a nice json output.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
panaetius.logger.info('some logging message')
|
||||
|
||||
This gives a logger output of:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"time": "2020-01-13 23:07:17,913",
|
||||
"file_name": "test.py",
|
||||
"module": "test",
|
||||
"function":"<module>",
|
||||
"line_number": "33",
|
||||
"logging_level":"INFO",
|
||||
"message": "some logging message"
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Overview
|
||||
:titlesonly:
|
||||
|
||||
introduction
|
||||
configuration
|
||||
changelog
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
:caption: Modules
|
||||
:titlesonly:
|
||||
|
||||
modules/panaetius.rst
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
:caption: Submodules
|
||||
:titlesonly:
|
||||
|
||||
modules/panaetius.config.rst
|
||||
modules/panaetius.config_inst.rst
|
||||
modules/panaetius.db.rst
|
||||
modules/panaetius.header.rst
|
||||
modules/panaetius.library.rst
|
||||
modules/panaetius.logging.rst
|
||||
232
duties.py
232
duties.py
@@ -1,13 +1,15 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
from io import StringIO
|
||||
|
||||
from duty import duty
|
||||
|
||||
|
||||
PACKAGE_NAME = "panaetius"
|
||||
|
||||
|
||||
@@ -16,6 +18,11 @@ def update_deps(ctx, dry: bool = False):
|
||||
"""
|
||||
Update the dependencies using Poetry.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
dry (bool, optional) = If True will update the `poetry.lock` without updating the
|
||||
dependencies themselves. Defaults to False.
|
||||
|
||||
Example:
|
||||
`duty update_deps dry=False`
|
||||
"""
|
||||
@@ -28,21 +35,32 @@ def update_deps(ctx, dry: bool = False):
|
||||
|
||||
@duty
|
||||
def test(ctx):
|
||||
"""Run tests using pytest"""
|
||||
pytest_results = ctx.run(["pytest", "-v"])
|
||||
"""
|
||||
Run tests using pytest.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
"""
|
||||
pytest_results = ctx.run(["pytest", "-v"], pty=True)
|
||||
print(pytest_results)
|
||||
|
||||
|
||||
@duty
|
||||
def coverage(ctx):
|
||||
"""
|
||||
Generate a coverage HTML report.
|
||||
Generate a coverage report and save to XML and HTML.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
|
||||
Example:
|
||||
`duty coverage`
|
||||
"""
|
||||
ctx.run(["coverage", "run", "--source", PACKAGE_NAME, "-m", "pytest"])
|
||||
res = ctx.run(["coverage", "report"], pty=True)
|
||||
print(res)
|
||||
ctx.run(["coverage", "html"])
|
||||
ctx.run(["coverage", "xml"])
|
||||
|
||||
|
||||
@duty
|
||||
@@ -51,6 +69,7 @@ def version(ctx, bump: str = "patch"):
|
||||
Bump the version using Poetry and update _version.py.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
bump (str, optional) = poetry version flag. Available options are:
|
||||
patch, minor, major, prepatch, preminor, premajor, prerelease.
|
||||
Defaults to patch.
|
||||
@@ -68,8 +87,7 @@ def version(ctx, bump: str = "patch"):
|
||||
version_file = pathlib.Path(PACKAGE_NAME) / "_version.py"
|
||||
with version_file.open("w", encoding="utf-8") as version_file:
|
||||
version_file.write(
|
||||
f'"""Module containing the version of {PACKAGE_NAME}."""\n\n'
|
||||
+ f'__version__ = "{new_version.group(1)}"\n'
|
||||
f'"""Module containing the version of {PACKAGE_NAME}."""\n\n' + f'__version__ = "{new_version.group(1)}"\n'
|
||||
)
|
||||
print(f"Bumped _version.py to {new_version.group(1)}")
|
||||
|
||||
@@ -77,7 +95,10 @@ def version(ctx, bump: str = "patch"):
|
||||
@duty
|
||||
def build(ctx):
|
||||
"""
|
||||
Build with poetry and extract the `setup.py` and copy to project root.
|
||||
Build with poetry and extract the setup.py and copy to project root.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
|
||||
Example:
|
||||
`duty build`
|
||||
@@ -101,3 +122,200 @@ def build(ctx):
|
||||
|
||||
# cleanup
|
||||
shutil.rmtree(extracted_path)
|
||||
|
||||
|
||||
@duty
|
||||
def export(ctx):
|
||||
"""
|
||||
Export the dependencies to a requirements.txt file.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
|
||||
Example:
|
||||
`duty export`
|
||||
"""
|
||||
requirements_content = ctx.run(
|
||||
[
|
||||
"poetry",
|
||||
"export",
|
||||
"-f",
|
||||
"requirements.txt",
|
||||
"--without-hashes",
|
||||
]
|
||||
)
|
||||
requirements_dev_content = ctx.run(
|
||||
[
|
||||
"poetry",
|
||||
"export",
|
||||
"-f",
|
||||
"requirements.txt",
|
||||
"--without-hashes",
|
||||
"--dev",
|
||||
]
|
||||
)
|
||||
|
||||
requirements = pathlib.Path(".") / "requirements.txt"
|
||||
requirements_dev = pathlib.Path(".") / "requirements_dev.txt"
|
||||
|
||||
with requirements.open("w", encoding="utf-8") as req:
|
||||
req.write(requirements_content)
|
||||
|
||||
with requirements_dev.open("w", encoding="utf-8") as req:
|
||||
req.write(requirements_dev_content)
|
||||
|
||||
|
||||
@duty
|
||||
def publish(ctx, password: str):
|
||||
"""
|
||||
Publish the package to pypi.org.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
password (str): pypi.org password.
|
||||
|
||||
Example:
|
||||
`duty publish password=$my_password`
|
||||
"""
|
||||
dist_dir = pathlib.Path(".") / "dist"
|
||||
rm_result = rm_tree(dist_dir)
|
||||
print(rm_result)
|
||||
|
||||
publish_result = ctx.run(["poetry", "publish", "-u", "dtomlinson", "-p", password, "--build"])
|
||||
print(publish_result)
|
||||
|
||||
|
||||
@duty(silent=True)
|
||||
def clean(ctx):
|
||||
"""
|
||||
Delete temporary files.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
"""
|
||||
ctx.run("rm -rf .mypy_cache")
|
||||
ctx.run("rm -rf .pytest_cache")
|
||||
ctx.run("rm -rf tests/.pytest_cache")
|
||||
ctx.run("rm -rf build")
|
||||
ctx.run("rm -rf dist")
|
||||
ctx.run("rm -rf pip-wheel-metadata")
|
||||
ctx.run("rm -rf site")
|
||||
ctx.run("rm -rf coverage.xml")
|
||||
ctx.run("rm -rf pytest.xml")
|
||||
ctx.run("rm -rf htmlcov")
|
||||
ctx.run("find . -iname '.coverage*' -not -name .coveragerc | xargs rm -rf")
|
||||
ctx.run("find . -type d -name __pycache__ | xargs rm -rf")
|
||||
ctx.run("find . -name '*.rej' -delete")
|
||||
|
||||
|
||||
@duty
|
||||
def format(ctx):
|
||||
"""
|
||||
Format code using Black and isort.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
"""
|
||||
res = ctx.run(["black", "--line-length=99", PACKAGE_NAME], pty=True, title="Running Black")
|
||||
print(res)
|
||||
|
||||
res = ctx.run(["isort", PACKAGE_NAME])
|
||||
print(res)
|
||||
|
||||
|
||||
@duty(pre=["check_code_quality", "check_types", "check_docs", "check_dependencies"])
|
||||
def check(ctx):
|
||||
"""
|
||||
Check the code quality, check types, check documentation builds and check dependencies for vulnerabilities.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
"""
|
||||
|
||||
|
||||
@duty
|
||||
def check_code_quality(ctx):
|
||||
"""
|
||||
Check the code quality using prospector.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
"""
|
||||
ctx.run(["prospector", PACKAGE_NAME], pty=True, title="Checking code quality with prospector")
|
||||
|
||||
|
||||
@duty
|
||||
def check_types(ctx):
|
||||
"""
|
||||
Check the types using mypy.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
"""
|
||||
ctx.run(["mypy", PACKAGE_NAME], pty=True, title="Checking types with MyPy")
|
||||
|
||||
|
||||
@duty
|
||||
def check_docs(ctx):
|
||||
"""
|
||||
Check the documentation builds successfully.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
"""
|
||||
ctx.run(["mkdocs", "build"], title="Building documentation")
|
||||
|
||||
|
||||
@duty
|
||||
def check_dependencies(ctx):
|
||||
"""
|
||||
Check dependencies with safety for vulnerabilities.
|
||||
|
||||
Args:
|
||||
ctx: The context instance (passed automatically).
|
||||
"""
|
||||
for module in sys.modules:
|
||||
if module.startswith("safety.") or module == "safety":
|
||||
del sys.modules[module]
|
||||
|
||||
importlib.invalidate_caches()
|
||||
|
||||
from safety import safety
|
||||
from safety.formatter import report
|
||||
from safety.util import read_requirements
|
||||
|
||||
requirements = ctx.run(
|
||||
"poetry export --dev --without-hashes",
|
||||
title="Exporting dependencies as requirements",
|
||||
allow_overrides=False,
|
||||
)
|
||||
|
||||
def check_vulns():
|
||||
packages = list(read_requirements(StringIO(requirements)))
|
||||
vulns = safety.check(packages=packages, ignore_ids="41002", key="", db_mirror="", cached=False, proxy={})
|
||||
output_report = report(vulns=vulns, full=True, checked_packages=len(packages))
|
||||
print(vulns)
|
||||
if vulns:
|
||||
print(output_report)
|
||||
|
||||
ctx.run(
|
||||
check_vulns,
|
||||
stdin=requirements,
|
||||
title="Checking dependencies",
|
||||
pty=True,
|
||||
)
|
||||
|
||||
|
||||
def rm_tree(directory: pathlib.Path):
|
||||
"""
|
||||
Recursively delete a directory and all its contents.
|
||||
|
||||
Args:
|
||||
directory (pathlib.Path): The directory to delete.
|
||||
"""
|
||||
for child in directory.glob("*"):
|
||||
if child.is_file():
|
||||
child.unlink()
|
||||
else:
|
||||
rm_tree(child)
|
||||
directory.rmdir()
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""Module containing the version of panaetius."""
|
||||
|
||||
__version__ = "2.3.1"
|
||||
__version__ = "2.3.3"
|
||||
|
||||
@@ -79,9 +79,7 @@ class Config:
|
||||
if self.skip_header_init:
|
||||
config_file_location = self.config_path / "config.yml"
|
||||
else:
|
||||
config_file_location = (
|
||||
self.config_path / self.header_variable / "config.yml"
|
||||
)
|
||||
config_file_location = self.config_path / self.header_variable / "config.yml"
|
||||
try:
|
||||
with open(config_file_location, "r", encoding="utf-8") as config_file:
|
||||
# return dict(toml.load(config_file))
|
||||
|
||||
@@ -106,6 +106,11 @@ class LoggingData(metaclass=ABCMeta):
|
||||
def format(self) -> str:
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def logging_level(self) -> str:
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self, logging_level: str):
|
||||
raise NotImplementedError
|
||||
@@ -119,8 +124,12 @@ class SimpleLogger(LoggingData):
|
||||
'"%(levelname)s",\n\t"message": "%(message)s"\n}',
|
||||
)
|
||||
|
||||
@property
|
||||
def logging_level(self) -> str:
|
||||
return self._logging_level
|
||||
|
||||
def __init__(self, logging_level: str = "INFO"):
|
||||
self.logging_level = logging_level
|
||||
self._logging_level = logging_level
|
||||
|
||||
|
||||
class AdvancedLogger(LoggingData):
|
||||
@@ -133,8 +142,12 @@ class AdvancedLogger(LoggingData):
|
||||
'"%(levelname)s",\n\t"message": "%(message)s"\n}',
|
||||
)
|
||||
|
||||
@property
|
||||
def logging_level(self) -> str:
|
||||
return self._logging_level
|
||||
|
||||
def __init__(self, logging_level: str = "INFO"):
|
||||
self.logging_level = logging_level
|
||||
self._logging_level = logging_level
|
||||
|
||||
|
||||
class CustomLogger(LoggingData):
|
||||
@@ -142,6 +155,10 @@ class CustomLogger(LoggingData):
|
||||
def format(self) -> str:
|
||||
return str(self._format)
|
||||
|
||||
@property
|
||||
def logging_level(self) -> str:
|
||||
return self._logging_level
|
||||
|
||||
def __init__(self, logging_format: str, logging_level: str = "INFO"):
|
||||
self.logging_level = logging_level
|
||||
self._logging_level = logging_level
|
||||
self._format = logging_format
|
||||
|
||||
0
panaetius/py.typed
Normal file
0
panaetius/py.typed
Normal file
167
poetry.lock
generated
167
poetry.lock
generated
@@ -72,6 +72,37 @@ category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "certifi"
|
||||
version = "2021.10.8"
|
||||
description = "Python package for providing Mozilla's CA Bundle."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "charset-normalizer"
|
||||
version = "2.0.7"
|
||||
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.5.0"
|
||||
|
||||
[package.extras]
|
||||
unicode_backport = ["unicodedata2"]
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
version = "8.0.3"
|
||||
description = "Composable command line interface toolkit"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
colorama = {version = "*", markers = "platform_system == \"Windows\""}
|
||||
importlib-metadata = {version = "*", markers = "python_version < \"3.8\""}
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.4"
|
||||
@@ -99,6 +130,22 @@ category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "dparse"
|
||||
version = "0.5.1"
|
||||
description = "A parser for Python dependency files"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
|
||||
[package.dependencies]
|
||||
packaging = "*"
|
||||
pyyaml = "*"
|
||||
toml = "*"
|
||||
|
||||
[package.extras]
|
||||
pipenv = ["pipenv"]
|
||||
|
||||
[[package]]
|
||||
name = "duty"
|
||||
version = "0.7.0"
|
||||
@@ -182,6 +229,14 @@ python-versions = ">=3.7"
|
||||
gitdb = ">=4.0.1,<5"
|
||||
typing-extensions = {version = ">=3.7.4.3", markers = "python_version < \"3.10\""}
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "3.3"
|
||||
description = "Internationalized Domain Names in Applications (IDNA)"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
|
||||
[[package]]
|
||||
name = "importlib-metadata"
|
||||
version = "4.8.1"
|
||||
@@ -209,7 +264,7 @@ python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "isort"
|
||||
version = "5.9.3"
|
||||
version = "5.10.1"
|
||||
description = "A Python utility / library to sort Python imports."
|
||||
category = "dev"
|
||||
optional = false
|
||||
@@ -578,6 +633,24 @@ category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[[package]]
|
||||
name = "requests"
|
||||
version = "2.26.0"
|
||||
description = "Python HTTP for Humans."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
|
||||
|
||||
[package.dependencies]
|
||||
certifi = ">=2017.4.17"
|
||||
charset-normalizer = {version = ">=2.0.0,<2.1.0", markers = "python_version >= \"3\""}
|
||||
idna = {version = ">=2.5,<4", markers = "python_version >= \"3\""}
|
||||
urllib3 = ">=1.21.1,<1.27"
|
||||
|
||||
[package.extras]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
|
||||
use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"]
|
||||
|
||||
[[package]]
|
||||
name = "requirements-detector"
|
||||
version = "0.7"
|
||||
@@ -589,6 +662,20 @@ python-versions = "*"
|
||||
[package.dependencies]
|
||||
astroid = ">=1.4"
|
||||
|
||||
[[package]]
|
||||
name = "safety"
|
||||
version = "1.10.3"
|
||||
description = "Checks installed dependencies for known vulnerabilities."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
|
||||
[package.dependencies]
|
||||
Click = ">=6.0"
|
||||
dparse = ">=0.5.1"
|
||||
packaging = "*"
|
||||
requests = "*"
|
||||
|
||||
[[package]]
|
||||
name = "setoptconf-tmp"
|
||||
version = "0.3.1"
|
||||
@@ -652,6 +739,14 @@ category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "types-pyyaml"
|
||||
version = "6.0.1"
|
||||
description = "Typing stubs for PyYAML"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "types-toml"
|
||||
version = "0.10.1"
|
||||
@@ -668,6 +763,19 @@ category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "urllib3"
|
||||
version = "1.26.7"
|
||||
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
|
||||
|
||||
[package.extras]
|
||||
brotli = ["brotlipy (>=0.6.0)"]
|
||||
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "wrapt"
|
||||
version = "1.12.1"
|
||||
@@ -691,7 +799,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.7"
|
||||
content-hash = "dcca7e2e7b6854ab40c11f6e3385b08fffb34b874981f1079205855badd7caea"
|
||||
content-hash = "e9da2be8225df95a41d2027f5c9cdaa7f744beff549d915d9922d7ddead8dc54"
|
||||
|
||||
[metadata.files]
|
||||
ansimarkup = [
|
||||
@@ -718,6 +826,18 @@ cached-property = [
|
||||
{file = "cached-property-1.5.2.tar.gz", hash = "sha256:9fa5755838eecbb2d234c3aa390bd80fbd3ac6b6869109bfc1b499f7bd89a130"},
|
||||
{file = "cached_property-1.5.2-py2.py3-none-any.whl", hash = "sha256:df4f613cf7ad9a588cc381aaf4a512d26265ecebd5eb9e1ba12f1319eb85a6a0"},
|
||||
]
|
||||
certifi = [
|
||||
{file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"},
|
||||
{file = "certifi-2021.10.8.tar.gz", hash = "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"},
|
||||
]
|
||||
charset-normalizer = [
|
||||
{file = "charset-normalizer-2.0.7.tar.gz", hash = "sha256:e019de665e2bcf9c2b64e2e5aa025fa991da8720daa3c1138cadd2fd1856aed0"},
|
||||
{file = "charset_normalizer-2.0.7-py3-none-any.whl", hash = "sha256:f7af805c321bfa1ce6714c51f254e0d5bb5e5834039bc17db7ebe3a4cec9492b"},
|
||||
]
|
||||
click = [
|
||||
{file = "click-8.0.3-py3-none-any.whl", hash = "sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3"},
|
||||
{file = "click-8.0.3.tar.gz", hash = "sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b"},
|
||||
]
|
||||
colorama = [
|
||||
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
|
||||
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
|
||||
@@ -761,6 +881,10 @@ dodgy = [
|
||||
{file = "dodgy-0.2.1-py3-none-any.whl", hash = "sha256:51f54c0fd886fa3854387f354b19f429d38c04f984f38bc572558b703c0542a6"},
|
||||
{file = "dodgy-0.2.1.tar.gz", hash = "sha256:28323cbfc9352139fdd3d316fa17f325cc0e9ac74438cbba51d70f9b48f86c3a"},
|
||||
]
|
||||
dparse = [
|
||||
{file = "dparse-0.5.1-py3-none-any.whl", hash = "sha256:e953a25e44ebb60a5c6efc2add4420c177f1d8404509da88da9729202f306994"},
|
||||
{file = "dparse-0.5.1.tar.gz", hash = "sha256:a1b5f169102e1c894f9a7d5ccf6f9402a836a5d24be80a986c7ce9eaed78f367"},
|
||||
]
|
||||
duty = [
|
||||
{file = "duty-0.7.0-py3-none-any.whl", hash = "sha256:45068baf1639f16464aa40e9d8f698f0ae09408368fe53a34e9bfe6993dfd743"},
|
||||
{file = "duty-0.7.0.tar.gz", hash = "sha256:5ebfd4640ab41e3058f1d8433f74228d60c9a808def1784e65319ef1899a9d15"},
|
||||
@@ -789,6 +913,10 @@ gitpython = [
|
||||
{file = "GitPython-3.1.24-py3-none-any.whl", hash = "sha256:dc0a7f2f697657acc8d7f89033e8b1ea94dd90356b2983bca89dc8d2ab3cc647"},
|
||||
{file = "GitPython-3.1.24.tar.gz", hash = "sha256:df83fdf5e684fef7c6ee2c02fc68a5ceb7e7e759d08b694088d0cacb4eba59e5"},
|
||||
]
|
||||
idna = [
|
||||
{file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"},
|
||||
{file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"},
|
||||
]
|
||||
importlib-metadata = [
|
||||
{file = "importlib_metadata-4.8.1-py3-none-any.whl", hash = "sha256:b618b6d2d5ffa2f16add5697cf57a46c76a56229b0ed1c438322e4e95645bd15"},
|
||||
{file = "importlib_metadata-4.8.1.tar.gz", hash = "sha256:f284b3e11256ad1e5d03ab86bb2ccd6f5339688ff17a4d797a0fe7df326f23b1"},
|
||||
@@ -798,8 +926,8 @@ iniconfig = [
|
||||
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
|
||||
]
|
||||
isort = [
|
||||
{file = "isort-5.9.3-py3-none-any.whl", hash = "sha256:e17d6e2b81095c9db0a03a8025a957f334d6ea30b26f9ec70805411e5c7c81f2"},
|
||||
{file = "isort-5.9.3.tar.gz", hash = "sha256:9c2ea1e62d871267b78307fe511c0838ba0da28698c5732d54e2790bf3ba9899"},
|
||||
{file = "isort-5.10.1-py3-none-any.whl", hash = "sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7"},
|
||||
{file = "isort-5.10.1.tar.gz", hash = "sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951"},
|
||||
]
|
||||
jinja2 = [
|
||||
{file = "Jinja2-3.0.3-py3-none-any.whl", hash = "sha256:077ce6014f7b40d03b47d1f1ca4b0fc8328a692bd284016f806ed0eaca390ad8"},
|
||||
@@ -835,9 +963,6 @@ markupsafe = [
|
||||
{file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad"},
|
||||
{file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d"},
|
||||
{file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646"},
|
||||
{file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:4dc8f9fb58f7364b63fd9f85013b780ef83c11857ae79f2feda41e270468dd9b"},
|
||||
{file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:20dca64a3ef2d6e4d5d615a3fd418ad3bde77a47ec8a23d984a12b5b4c74491a"},
|
||||
{file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:cdfba22ea2f0029c9261a4bd07e830a8da012291fbe44dc794e488b6c9bb353a"},
|
||||
{file = "MarkupSafe-2.0.1-cp310-cp310-win32.whl", hash = "sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28"},
|
||||
{file = "MarkupSafe-2.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134"},
|
||||
{file = "MarkupSafe-2.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51"},
|
||||
@@ -849,9 +974,6 @@ markupsafe = [
|
||||
{file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c"},
|
||||
{file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724"},
|
||||
{file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145"},
|
||||
{file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:deb993cacb280823246a026e3b2d81c493c53de6acfd5e6bfe31ab3402bb37dd"},
|
||||
{file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:63f3268ba69ace99cab4e3e3b5840b03340efed0948ab8f78d2fd87ee5442a4f"},
|
||||
{file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:8d206346619592c6200148b01a2142798c989edcb9c896f9ac9722a99d4e77e6"},
|
||||
{file = "MarkupSafe-2.0.1-cp36-cp36m-win32.whl", hash = "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d"},
|
||||
{file = "MarkupSafe-2.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9"},
|
||||
{file = "MarkupSafe-2.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567"},
|
||||
@@ -863,9 +985,6 @@ markupsafe = [
|
||||
{file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85"},
|
||||
{file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6"},
|
||||
{file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864"},
|
||||
{file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d6c7ebd4e944c85e2c3421e612a7057a2f48d478d79e61800d81468a8d842207"},
|
||||
{file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:f0567c4dc99f264f49fe27da5f735f414c4e7e7dd850cfd8e69f0862d7c74ea9"},
|
||||
{file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:89c687013cb1cd489a0f0ac24febe8c7a666e6e221b783e53ac50ebf68e45d86"},
|
||||
{file = "MarkupSafe-2.0.1-cp37-cp37m-win32.whl", hash = "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415"},
|
||||
{file = "MarkupSafe-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914"},
|
||||
{file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9"},
|
||||
@@ -878,9 +997,6 @@ markupsafe = [
|
||||
{file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b"},
|
||||
{file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a"},
|
||||
{file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6"},
|
||||
{file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:aca6377c0cb8a8253e493c6b451565ac77e98c2951c45f913e0b52facdcff83f"},
|
||||
{file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:04635854b943835a6ea959e948d19dcd311762c5c0c6e1f0e16ee57022669194"},
|
||||
{file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6300b8454aa6930a24b9618fbb54b5a68135092bc666f7b06901f897fa5c2fee"},
|
||||
{file = "MarkupSafe-2.0.1-cp38-cp38-win32.whl", hash = "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64"},
|
||||
{file = "MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833"},
|
||||
{file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26"},
|
||||
@@ -893,9 +1009,6 @@ markupsafe = [
|
||||
{file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1"},
|
||||
{file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac"},
|
||||
{file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6"},
|
||||
{file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:4296f2b1ce8c86a6aea78613c34bb1a672ea0e3de9c6ba08a960efe0b0a09047"},
|
||||
{file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f02365d4e99430a12647f09b6cc8bab61a6564363f313126f775eb4f6ef798e"},
|
||||
{file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5b6d930f030f8ed98e3e6c98ffa0652bdb82601e7a016ec2ab5d7ff23baa78d1"},
|
||||
{file = "MarkupSafe-2.0.1-cp39-cp39-win32.whl", hash = "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74"},
|
||||
{file = "MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8"},
|
||||
{file = "MarkupSafe-2.0.1.tar.gz", hash = "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"},
|
||||
@@ -1054,9 +1167,17 @@ pyyaml = [
|
||||
{file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"},
|
||||
{file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"},
|
||||
]
|
||||
requests = [
|
||||
{file = "requests-2.26.0-py2.py3-none-any.whl", hash = "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24"},
|
||||
{file = "requests-2.26.0.tar.gz", hash = "sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"},
|
||||
]
|
||||
requirements-detector = [
|
||||
{file = "requirements-detector-0.7.tar.gz", hash = "sha256:0d1e13e61ed243f9c3c86e6cbb19980bcb3a0e0619cde2ec1f3af70fdbee6f7b"},
|
||||
]
|
||||
safety = [
|
||||
{file = "safety-1.10.3-py2.py3-none-any.whl", hash = "sha256:5f802ad5df5614f9622d8d71fedec2757099705c2356f862847c58c6dfe13e84"},
|
||||
{file = "safety-1.10.3.tar.gz", hash = "sha256:30e394d02a20ac49b7f65292d19d38fa927a8f9582cdfd3ad1adbbc66c641ad5"},
|
||||
]
|
||||
setoptconf-tmp = [
|
||||
{file = "setoptconf-tmp-0.3.1.tar.gz", hash = "sha256:e0480addd11347ba52f762f3c4d8afa3e10ad0affbc53e3ffddc0ca5f27d5778"},
|
||||
{file = "setoptconf_tmp-0.3.1-py3-none-any.whl", hash = "sha256:76035d5cd1593d38b9056ae12d460eca3aaa34ad05c315b69145e138ba80a745"},
|
||||
@@ -1113,6 +1234,10 @@ typed-ast = [
|
||||
{file = "typed_ast-1.4.3-cp39-cp39-win_amd64.whl", hash = "sha256:9c6d1a54552b5330bc657b7ef0eae25d00ba7ffe85d9ea8ae6540d2197a3788c"},
|
||||
{file = "typed_ast-1.4.3.tar.gz", hash = "sha256:fb1bbeac803adea29cedd70781399c99138358c26d05fcbd23c13016b7f5ec65"},
|
||||
]
|
||||
types-pyyaml = [
|
||||
{file = "types-PyYAML-6.0.1.tar.gz", hash = "sha256:2e27b0118ca4248a646101c5c318dc02e4ca2866d6bc42e84045dbb851555a76"},
|
||||
{file = "types_PyYAML-6.0.1-py3-none-any.whl", hash = "sha256:d5b318269652e809b5c30a5fe666c50159ab80bfd41cd6bafe655bf20b29fcba"},
|
||||
]
|
||||
types-toml = [
|
||||
{file = "types-toml-0.10.1.tar.gz", hash = "sha256:5c1f8f8d57692397c8f902bf6b4d913a0952235db7db17d2908cc110e70610cb"},
|
||||
{file = "types_toml-0.10.1-py3-none-any.whl", hash = "sha256:8cdfd2b7c89bed703158b042dd5cf04255dae77096db66f4a12ca0a93ccb07a5"},
|
||||
@@ -1122,6 +1247,10 @@ typing-extensions = [
|
||||
{file = "typing_extensions-3.10.0.2-py3-none-any.whl", hash = "sha256:f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34"},
|
||||
{file = "typing_extensions-3.10.0.2.tar.gz", hash = "sha256:49f75d16ff11f1cd258e1b988ccff82a3ca5570217d7ad8c5f48205dd99a677e"},
|
||||
]
|
||||
urllib3 = [
|
||||
{file = "urllib3-1.26.7-py2.py3-none-any.whl", hash = "sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844"},
|
||||
{file = "urllib3-1.26.7.tar.gz", hash = "sha256:4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece"},
|
||||
]
|
||||
wrapt = [
|
||||
{file = "wrapt-1.12.1.tar.gz", hash = "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"},
|
||||
]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[tool.poetry]
|
||||
name = "panaetius"
|
||||
version = "2.3.1"
|
||||
version = "2.3.3"
|
||||
description = "Python module to gracefully handle a .config file/environment variables for scripts, with built in masking for sensitive options. Provides a Splunk friendly formatted logger instance."
|
||||
license = "MIT"
|
||||
authors = ["dtomlinson <dtomlinson@panaetius.co.uk>"]
|
||||
readme = "./README.rst"
|
||||
readme = "./README.md"
|
||||
homepage = "https://github.com/dtomlinson91/panaetius"
|
||||
repository = "https://github.com/dtomlinson91/panaetius"
|
||||
documentation = "https://panaetius.readthedocs.io/en/latest/introduction.html"
|
||||
@@ -35,6 +35,23 @@ pytest-datadir = "^1.3.1"
|
||||
pytest-xdist = "^2.4.0"
|
||||
coverage = "^6.0.2"
|
||||
duty = "^0.7.0"
|
||||
types-PyYAML = "^6.0.1"
|
||||
isort = "^5.10.1"
|
||||
mypy = "^0.910"
|
||||
safety = "^1.10.3"
|
||||
|
||||
[tool.black]
|
||||
line-length = 120
|
||||
|
||||
[tool.isort]
|
||||
line-length = 120
|
||||
not_skip = "__init__.py"
|
||||
multi_line_output = 3
|
||||
force_single_line = false
|
||||
balanced_wrapping = true
|
||||
default_section = "THIRDPARTY"
|
||||
known_first_party = "duty"
|
||||
include_trailing_comma = true
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
|
||||
@@ -1,7 +1,2 @@
|
||||
pylite==0.1.0 \
|
||||
--hash=sha256:e338d20d3f8f72dd84d1e58f2fd6dba008d593e0cfacfb5fbdd5a297b830628e \
|
||||
--hash=sha256:eb46f5beb1f2102672fd4355c013ac2feebc0df284d65f7711f2041a0a410141
|
||||
toml==0.10.0 \
|
||||
--hash=sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c \
|
||||
--hash=sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e \
|
||||
--hash=sha256:f1db651f9657708513243e61e6cc67d101a39bad662eaa9b5546f789338e07a3
|
||||
pyyaml==6.0; python_version >= "3.6"
|
||||
toml==0.10.2; (python_version >= "2.6" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0")
|
||||
|
||||
61
requirements_dev.txt
Normal file
61
requirements_dev.txt
Normal file
@@ -0,0 +1,61 @@
|
||||
ansimarkup==1.5.0; python_version >= "3.6"
|
||||
astroid==2.8.2; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.6.1"
|
||||
atomicwrites==1.4.0; python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6") or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.4.0" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6")
|
||||
attrs==21.2.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
bandit==1.7.0; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.5"
|
||||
cached-property==1.5.2; python_version < "3.8" and python_version >= "3.6"
|
||||
colorama==0.4.4; sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.6.1" and python_version < "4.0" and platform_system == "Windows" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6")
|
||||
coverage==6.0.2; python_version >= "3.6"
|
||||
dodgy==0.2.1; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
duty==0.7.0; python_version >= "3.6"
|
||||
execnet==1.9.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
failprint==0.8.0; python_version >= "3.6"
|
||||
flake8-polyfill==1.0.2; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
flake8==2.3.0; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
gitdb==4.0.7; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.7"
|
||||
gitpython==3.1.24; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.7"
|
||||
importlib-metadata==4.8.1; python_version < "3.8" and python_version >= "3.6" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6") and python_full_version >= "3.6.1"
|
||||
iniconfig==1.1.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
isort==5.9.3; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.6"
|
||||
jinja2==3.0.3; python_version >= "3.6"
|
||||
lazy-object-proxy==1.6.0; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.6.1"
|
||||
markupsafe==2.0.1; python_version >= "3.6"
|
||||
mccabe==0.6.1; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.6"
|
||||
mypy-extensions==0.4.3; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.5"
|
||||
mypy==0.910; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.5"
|
||||
packaging==21.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
pbr==5.6.0; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.6"
|
||||
pep8-naming==0.10.0; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
pep8==1.7.1; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
platformdirs==2.4.0; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.6.1"
|
||||
pluggy==1.0.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
prospector==1.5.1; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
ptyprocess==0.7.0; sys_platform != "win32" and python_version >= "3.6"
|
||||
py==1.10.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
pycodestyle==2.8.0; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
pydocstyle==6.1.1; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.6"
|
||||
pyflakes==2.3.1; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
pylint-celery==0.3; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
pylint-django==2.4.4; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
pylint-flask==0.6; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
pylint-plugin-utils==0.6; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
pylint==2.11.1; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.6.1"
|
||||
pyparsing==2.4.7; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
|
||||
pytest-datadir==1.3.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
|
||||
pytest-forked==1.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
pytest-xdist==2.4.0; python_version >= "3.6"
|
||||
pytest==6.2.5; python_version >= "3.6"
|
||||
pyyaml==6.0; python_version >= "3.6"
|
||||
requirements-detector==0.7; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
setoptconf-tmp==0.3.1; python_full_version >= "3.6.1" and python_version < "4.0"
|
||||
six==1.16.0; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.5"
|
||||
smmap==4.0.0; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.7"
|
||||
snowballstemmer==2.1.0; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.6"
|
||||
stevedore==3.4.0; python_full_version >= "3.6.1" and python_version < "4.0" and python_version >= "3.6"
|
||||
toml==0.10.2; (python_version >= "2.6" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0")
|
||||
typed-ast==1.4.3; python_full_version >= "3.6.1" and python_version < "3.8" and python_version >= "3.6" and implementation_name == "cpython"
|
||||
types-pyyaml==6.0.1
|
||||
types-toml==0.10.1
|
||||
typing-extensions==3.10.0.2; python_full_version >= "3.6.1" and python_version < "3.8" and python_version >= "3.7"
|
||||
wrapt==1.12.1; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.6.1"
|
||||
zipp==3.6.0; python_version < "3.8" and python_version >= "3.6"
|
||||
56
rewrite.todo
56
rewrite.todo
@@ -1,56 +0,0 @@
|
||||
Testing:
|
||||
To Write:
|
||||
☐ Document coverage commands
|
||||
`coverage run --source=./panaetius -m pytest`
|
||||
`coverage report` & `coverage html` > gives ./htmlcov/index.html
|
||||
Documentation:
|
||||
☐ Rewrite documentation using `mkdocs` and using `.md`.
|
||||
☐ Update the metadata in the `pyproject.toml`.
|
||||
☐ Create a new `Readme.md` and remove the `.rst`.
|
||||
☐ Document the logging strategy
|
||||
CLI tools should use `logger.critical` and raise SystemExit(1)
|
||||
Libraries should raise custom errors and have a `logger.critical(exec_info=1)`
|
||||
Typing:
|
||||
☐ Go over typing, make sure what's passed in are generics where possible.
|
||||
Docstrings:
|
||||
☐ Update class docstrings so attributes are in class.
|
||||
Misc:
|
||||
☐ Use the python runner to build the docs & run the tests (including coverage html)
|
||||
coverage run -m pytest && coverage report && coverage html
|
||||
☐ document this in trilium
|
||||
|
||||
Archive:
|
||||
✔ Test the Config file skipping header with `skip_header_init` @done(21-10-25 23:34) @project(Testing.To Write)
|
||||
✔ Document for abstract methods should raise NotImplementedError @done(21-10-25 23:39) @project(Testing.To Write)
|
||||
✔ Document https://stackoverflow.com/a/9212387 @done(21-10-25 23:40) @project(Testing.To Write)
|
||||
✘ Bump the version to release 2.0 @cancelled(21-10-23 05:36) @project(Misc)
|
||||
✔ Handle if a bool is passed in as a default @done(21-10-16 05:25) @project(Coding.No Config File)
|
||||
✔ Handle if a bool is passed in as a default @done(21-10-16 05:25) @project(Coding.Config File)
|
||||
✔ Create SimpleLogger, AdvancedLogger, CustomLogger classes @done(21-10-16 16:22) @project(Coding.Logging)
|
||||
✔ Logging path should take by default the config path unless overwritten? @done(21-10-16 23:49) @project(Coding.Logging)
|
||||
✔ Check logging path + config path are valid, if not raise error. @done(21-10-18 00:04) @project(Coding.Errors)
|
||||
✔ Add tests for these. @done(21-10-18 00:04) @project(Coding.Errors)
|
||||
✔ Check for a key > 2 levels, raise custom error, write test @done(21-10-17 23:30) @project(Coding.Errors)
|
||||
✔ Check all functions and annotations. @done(21-10-18 01:07) @project(Coding.Linting)
|
||||
✔ Write the docstrings for public functions/methods. @done(21-10-18 02:29) @project(Coding.Docstrings)
|
||||
✔ When both a config file and a env var is found, use the env var. @done(21-10-18 00:38) @project(Coding.Functionality)
|
||||
✔ If loading from a default, don't covert to TOML @done(21-10-17 20:33) @project(Tests.Bugfixes)
|
||||
✔ Env Vars should be given as python objects @done(21-10-17 20:33) @project(Tests.Bugfixes)
|
||||
The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None.
|
||||
use ast.literal_eval()
|
||||
https://docs.python.org/3/library/ast.html#ast.literal_eval
|
||||
✔ Test default config path set to "~/.config" @done(21-10-17 17:25) @project(Tests.__init__)
|
||||
✔ Test config path is set when passed in @done(21-10-17 17:25) @project(Tests.__init__)
|
||||
✔ Check testing config file is returned as dict @done(21-10-17 17:25) @project(Tests.config property)
|
||||
✔ Check _self.missing_config and empty dict is returned @done(21-10-17 17:25) @project(Tests.config property)
|
||||
✔ Arrays & tables loaded correctly from config file @done(21-10-17 20:34) @project(Tests.get_value.config_file)
|
||||
✔ test when key length is 1 the value is returned @done(21-10-17 18:55) @project(Tests.get_value.config_file)
|
||||
✔ test when key length is 2 the value is returned @done(21-10-17 18:55) @project(Tests.get_value.config_file)
|
||||
✔ test when key not found and no env var default is loaded @done(21-10-17 19:01) @project(Tests.get_value.config_file)
|
||||
✔ test bool's are properly converted @done(21-10-17 19:01) @project(Tests.get_value.config_file)
|
||||
✔ test when key not found and env var is set value is loaded @done(21-10-17 20:43) @project(Tests.get_value.config_file)
|
||||
✔ check if env key is missing the default is read in @done(21-10-17 20:55) @project(Tests.get_value.env_var)
|
||||
✔ check if env key is present the values are read in @done(21-10-17 22:24) @project(Tests.get_value.env_var)
|
||||
✔ parametrise a test to read in values form env vars and they're set correctly @done(21-10-17 22:24) @project(Tests.get_value.env_var)
|
||||
✔ test that the env var is valid python @done(21-10-18 01:03) @project(Tests.get_value.env_var)
|
||||
✔ test set_config works @done(21-10-17 23:29) @project(Tests.library)
|
||||
4
setup.py
4
setup.py
@@ -12,9 +12,9 @@ install_requires = \
|
||||
|
||||
setup_kwargs = {
|
||||
'name': 'panaetius',
|
||||
'version': '2.2.2',
|
||||
'version': '2.3.3',
|
||||
'description': 'Python module to gracefully handle a .config file/environment variables for scripts, with built in masking for sensitive options. Provides a Splunk friendly formatted logger instance.',
|
||||
'long_description': 'Author\n=======\n\nDaniel Tomlinson (dtomlinson@panaetius.co.uk)\n\nRequires\n=========\n\n`>= python3.7`\n\nPython requirements\n====================\n\n- toml = "^0.10.0"\n- pylite = "^0.1.0"\n\nDocumentation\n==============\n\nRead the documentation on `read the docs`_.\n\n.. _read the docs: https://panaetius.readthedocs.io/en/latest/introduction.html\n\nInstallation\n==============\n\nYou can install ``panaetius`` the following ways:\n\nPython\n-------\n\n.. Attention:: You should install in a python virtual environment\n\nFrom pypi using pip\n~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: bash\n\n pip install panaetius\n\nFrom local wheel\n~~~~~~~~~~~~~~~~~\n\nDownload the latest verion from the `releases`_ page.\n\n.. _releases: https://github.com/dtomlinson91/panaetius/releases\n\nInstall with pip:\n\n.. code-block:: bash\n\n pip install -U panaetius-1.0.2-py3-none-any.whl\n\n\nFrom source\n~~~~~~~~~~~~\n\nClone the repo and install using ``setup.py``:\n\n.. code-block:: bash\n\n python setup.py\n',
|
||||
'long_description': '# Panaetius\n\nThis package provides:\n\n- Functionality to read user variables from a `config.yml` or environment variables.\n- A convenient default logging formatter printing `json` that can save to disk and rotate.\n- Utility functions.\n\n## Config\n\n### options\n\n#### skip_header_init\n\nIf `skip_header_init=True` then the `config_path` will not use the `header_variable` as the\nsub-directory in the `config_path`.\n\nE.g\n\n`CONFIG = panaetius.Config("tembo", "~/tembo/.config", skip_header_init=True)`\n\nWill look in `~/tembo/config/config.yml`.\n\nIf `skip_header_init=False` then would look in `~/tembo/config/tembo/config.yml`.\n\n### Module\n\nConvenient to place in a package/sub-package `__init__.py`.\n\nSee Tembo for an example: <https://github.com/tembo-pages/tembo-core/blob/main/tembo/cli/__init__.py>\n\nExample snippet to use in a module:\n\n```python\n"""Subpackage that contains the CLI application."""\n\nimport os\nfrom typing import Any\n\nimport panaetius\nfrom panaetius.exceptions import LoggingDirectoryDoesNotExistException\n\n\nif (config_path := os.environ.get("TEMBO_CONFIG")) is not None:\n CONFIG: Any = panaetius.Config("tembo", config_path, skip_header_init=True)\nelse:\n CONFIG = panaetius.Config(\n "tembo", "~/tembo/.config", skip_header_init=True\n )\n\n\npanaetius.set_config(CONFIG, "base_path", "~/tembo")\npanaetius.set_config(CONFIG, "template_path", "~/tembo/.templates")\npanaetius.set_config(CONFIG, "scopes", {})\npanaetius.set_config(CONFIG, "logging.level", "DEBUG")\npanaetius.set_config(CONFIG, "logging.path")\n\ntry:\n logger = panaetius.set_logger(\n CONFIG, panaetius.SimpleLogger(logging_level=CONFIG.logging_level)\n )\nexcept LoggingDirectoryDoesNotExistException:\n _LOGGING_PATH = CONFIG.logging_path\n CONFIG.logging_path = ""\n logger = panaetius.set_logger(\n CONFIG, panaetius.SimpleLogger(logging_level=CONFIG.logging_level)\n )\n logger.warning("Logging directory %s does not exist", _LOGGING_PATH)\n\n```\n\nThis means in `./tembo/cli/cli.py` you can\n\n```python\nimport tembo.cli\n\n# access the CONFIG instance + variables from the config.yml\ntembo.cli.CONFIG\n```\n\n\n## Utility Functions\n\n### Squasher\n\nSquashes a json object or Python dictionary into a single level dictionary.\n',
|
||||
'author': 'dtomlinson',
|
||||
'author_email': 'dtomlinson@panaetius.co.uk',
|
||||
'maintainer': None,
|
||||
|
||||
Reference in New Issue
Block a user