pysanity
Emulates sanity for other people’s dirty ass non-pep compliant code via only the /dirtiest/ of means.
Tested with Python 2.7, 3.5.
And that means?
Hi! I’m pysanity and I turn:
import logging
log = logging.getLogger(__name__)
Into the much less brain numbing:
from pysanity import logging
log = logging.get_logger(__name__)
All the while keeping your precious code completion working as expected thanks to a not grossly over-dynamic nature.
You’re welcome for my existence on PyPi.
Logging you say?
Hint: Try this out and stop accepting needless boilerplate in your code, stdlib or not:
import logging
import logging.config
import inspect
def _namespace_from_calling_context():
"""
Derive a namespace from the module containing the caller's caller.
:return str: the fully qualified python name of a module.
"""
return inspect.currentframe().f_back.f_back.f_globals['__name__']
def get_logger(name=None):
"""
Gets a logger instance with sensible defaults according to caller context.
:param str name: Logger name. Defaults to caller's `__name__`.
:return logging.Logger: Logger instance
"""
if not name:
name = _namespace_from_calling_context()
return logging.getLogger(name)
Installation
pip install pysanity
Running tests
Tox is used to handle testing multiple python versions.
tox
Metadata
Release files for pysanity 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pysanity-0.0.1.tar.gz | 18.3 kB | Without provenance | Details for pysanity-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pysanity-0.0.1-py2-none-any.whl | Python 2 | none | any | Details for pysanity-0.0.1-py2-none-any.whl |
Total release size: 26.2 kB
Release files / pysanity-0.0.1.tar.gz
| Download URL | pysanity-0.0.1.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e9b413b805c6f18d97514f7b4016f3e9a812a4c3a4dacd1161c76877ff397985
|
|
BLAKE2b-256 checksum How to use checksums |
636907cce0e83ce5746a6e6613013fa781931c23f18af8dfebf20b80f2cad6c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pysanity-0.0.1-py2-none-any.whl
| Download URL | pysanity-0.0.1-py2-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
230750eb7d7320f6fea7760d02de22fe06f0e057b29f166fdc89cefc814df14e
|
|
BLAKE2b-256 checksum How to use checksums |
2b575798de7fb3e005b2fa946c439e921f8cdf7c65e997be5d4b36c825a46562
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pysanity 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.