Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Utility functions and classes

Project Description

Some utility functions and classes I use in many projects.

Note: This package does not follow the UNIX philosophy. (It does more than one thing). Though some modules might get moved to their own packages in the future, this is currently not planned.

Documentation at GitHub


Module to ease logging efforts


  • Using logging calls directly on instance
  • Module logger
  • Optional instance id
  • Add method information to log
  • Default logging config

In class Demo(Logable) you are able to use the logging calls directly (eg. self.debug(), self.warning(), self.exception(),..) to produce structured logging output like

DEBUG:Demo:working on something
INFO:Demo:Finished working
WARNING:Demo:Something might go wrong
ERROR:Demo:Something went wrong
WARNING:Demo:Told you!

The Logable class allows you to specify an id for an instance Demo({'id': "demo2"}) resulting in

DEBUG:Demo.demo2:working on something
INFO:Demo.demo2:Finished working
WARNING:Demo.demo2:Something might go wrong
ERROR:Demo.demo2:Something went wrong
WARNING:Demo.demo2:Told you!

Also supports method information:

2015-12-27 20:30:48 DEBUG   [Demo.demo2.work_on_something] working on something
2015-12-27 20:30:48 INFO    [Demo.demo2.work_on_something] Finished working
2015-12-27 20:30:48 DEBUG   [root] Inbetween
2015-12-27 20:30:48 WARNING [Demo.demo2.work_on_something_else] Something might go wrong
2015-12-27 20:30:48 ERROR   [Demo.demo2.work_on_something_else] Something went wrong
2015-12-27 20:30:48 WARNING [Demo.demo2.work_on_something_else] Told you!

For information on how to enable this, please have a look at logable.default_logging_config


Module to ease json(file) efforts


  • loading/writing json both as string and file
  • date, time and datetime types supported (saved and loaded as utc)
  • class to load/save settings from/to file

Loadable is a child class of Logable, thus inheriting all logging capabilities.

To tell class Demo(Loadable) to create an instance from a settings file, just write Demo({'settings_file': "path/to/settings.json"}).

Settings provided in __init__() overwrite the ones set in the file.


Module to ease starting/stoping of classes


  • Startable (Class can be started start())
  • Stopable (Class can be stopped stop())
  • StartStopable (Startable() + Stopable())
  • SignalStopWrapper (Listens for SIGTERM and SIGINT signals and stops the class)


0.3.5a0 (2017-03-06)

  • Deprecated camel-case methods in loadable, new save/load methods

0.3.4a0 (2017-03-06)

  • Add yaml loading/saving code

0.3.3a0 (2017-03-06)

  • Add get_logger function

0.3.2b0 (2016-11-25)

  • Fix relative import in loadable

0.3.2a0 (2016-08-14)

  • Add datetime.timedelta to JSONEncoder/Decoder

0.3.1a0 (2016-03-31)

  • Catch interrupt in Stopable.stop() when sleeping

0.3.0a0 (2016-03-08)

  • Move webscraper to own package

0.2.14b0 (2016-03-02)

  • Fix missing calls to parent init method

0.2.13a0 (2016-01-28)

  • Runable (Startable, Stopable, StartStopable, SignalStopWrapper)

0.2.12a0 (2016-01-07)

  • WebScraper

0.2.11a0 (2015-12-31)

  • Loadable
  • Changed documentation

0.2.10a0 (2015-12-27)

  • First release on PyPI.
  • Logable
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
flotils-0.3.5a0.macosx-10.12-x86_64.tar.gz (17.4 kB) Copy SHA256 Checksum SHA256 Source Mar 6, 2017
flotils-0.3.5a0-py2.7.egg (22.3 kB) Copy SHA256 Checksum SHA256 2.7 Egg Mar 6, 2017
flotils-0.3.5a0-py2.py3-none-any.whl (12.9 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Mar 6, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting