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

My friendly library base class - for Python.

Project description

mybase Build Status PyPI version Coverage Status

My friendly library base class - for Python.


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 using pip:

$ pip install mybase


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.logger.log('hello world 1')


import logging

foo2 = Foo(logger = logging.get_logger('custom'))

# logs using custom logger
foo.logger.log('hello world 2')

foo3 = Foo(logger = False)

# logs nothing
foo.logger.log('hello world 3')


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


  • mybad - "My error base class - for Python"


This project was mainly initiated - in lack of solid existing alternatives - to be used at our work at to have common code conventions between various programming environments where Python (research, CV, AI) is heavily used.


Released under the MIT license.

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 mybase, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size mybase-0.1.1-py3-none-any.whl (9.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size mybase-0.1.1.tar.gz (10.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page