Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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.

Files for misc-utils-py, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size misc_utils_py-0.1.0-py3-none-any.whl (8.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size misc-utils-py-0.1.0.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page