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.1.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for misc_utils_py-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06dfc74f4233b071babf9cb14077229277e5cc84368492bf4ae52c890f7d7d3d |
|
MD5 | 9eaf48a82429beb9fc6ba8ef4e2171de |
|
BLAKE2b-256 | 4f12998081890c93dddb3459348014c819b9eca94f935f3a7a15c612ca190946 |