mybase

My friendly library base class - for Python.
Introduction
One in general tend to need a library specific base class, but creating one for every new library with some common logger customization means redundant work every time. This library base class right now don't do much now beside setting up a default logger, but keeps library code a bit cleaner.
NOTE: Possibly should support being used as a mixin (e.g. @mybase.mixin) optionally, but not yet implemented.
Install
Install using pip:
$ pip install mybase
Use
Very basic example:
from mybase import Base
class Foo(Base):
def hello():
self.logger.log('hello from instance: `{0}`'.format(self))
foo = Foo()
# logs using default logger - with colors unless disabled via `COLORS` / `LOGGER_COLORS` env variables
foo.hello()
foo.logger.log('hello world 1')
print(foo.name)
print(repr(foo))
print(str(foo))
import logging
foo2 = Foo(logger = logging.get_logger('custom'))
# logs using custom logger
foo.hello()
foo.logger.log('hello world 2')
foo3 = Foo(logger = False)
# logs nothing
foo.hello()
foo.logger.log('hello world 3')
Test
Clone down source code:
$ make install
Run colorful tests, with only native environment (dependency sandboxing up to you):
$ make test
Run less colorful tests, with multi-environment (using tox):
$ make test-tox
Related
mybad- "My error base class - for Python"
About
This project was mainly initiated - in lack of solid existing alternatives - to be used at our work at Markable.ai to have common code conventions between various programming environments where Python (research, CV, AI) is heavily used.
License
Released under the MIT license.
Metadata
Release files for mybase 0.1.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 | |
|---|---|---|---|---|
| mybase-0.1.1.tar.gz | 10.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mybase-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.1 kB
Release files / mybase-0.1.1.tar.gz
| Download URL | mybase-0.1.1.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06d3fb155a5e4be50bfb56c9de1efce6c1785aa2bf15f1fb2b28a144e3fd9ca3
|
|
BLAKE2b-256 checksum How to use checksums |
bc9adde83f4604d1e3922348c4f3d3b6553fc996f6107a70e0365cddcf477318
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
|
Release files / mybase-0.1.1-py3-none-any.whl
| Download URL | mybase-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49983c79fbabffcb4b1a4905ad6832a0b03313abb653ffd3ad125b1498a0ef48
|
|
BLAKE2b-256 checksum How to use checksums |
50758a5726df672fe34f4e8e65db8b84e8df528005b949be4585e39525af8c82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
|
Security for mybase 0.1.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.