Misc utilities for python projects
Project description
miscutils
Utilities for working with python projects.
Usage
logging_config
Default configuration for structlog.
Configure json logging at the INFO level:
from miscutils.logging_config import default_logging, LogFormat, Verbosity
default_logging(Verbosity.INFO, LogFormat.JSON)
Configure text logging at the DEBUG level:
from miscutils.logging_config import default_logging, LogFormat, Verbosity
default_logging(Verbosity.DEBUG, LogFormat.TEXT)
Configure text logging at the DEBUG level and filter out external loggers:
from miscutils.logging_config import default_logging, LogFormat, Verbosity
default_logging(Verbosity.DEBUG, LogFormat.TEXT, ["extern_logger_1"])
Log timing information for a function
Decorator to add timing information to the logs:
from miscutils.timer import timer
import structlog
@timer(structlog.get_logger(__name__))
def some_function():
pass
Testing
Testing is done via pytest.
$ pip install -r requirements.txt
$ pytest
To get code coverage information, you can run pytest directly.
$ pip install -r requirements.txt
$ pytest --cov=src --cov-report=html
This will generate an html coverage report in htmlcov/
directory.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
misc-utils-py-0.1.0.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for misc_utils_py-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e65169166db184d9c53ac72a1452e2daa4795cfa2802e40ec9f3b74746fe5f49 |
|
MD5 | 5896d639fd859a2f884342aa031966ea |
|
BLAKE2b-256 | 6d76d3e294ea2a4f34aeb239a0a2bb00437b200d7b2a4bf2cc95defef16d57af |