Skip to main content

FLOTILS

Some utility functions and classes I use in many projects.

https://img.shields.io/pypi/v/flotils.svg https://img.shields.io/pypi/l/flotils.svg https://img.shields.io/pypi/dm/flotils.svg

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

logable

Module to ease logging efforts

Supports

  • 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
DEBUG:root:Inbetween
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
DEBUG:root:Inbetween
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

loadable

Module to ease json(file) efforts

Supports

  • 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.

runable

Module to ease starting/stoping of classes

Supports

  • 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)

History

0.5.3 (2019-08-03)

  • Update supported versions

0.5.2 (2019-04-15)

  • pyyaml FullLoader

  • load/save bug fixes

0.5.1 (2019-04-14)

  • Fix json loading bug

  • Make json time loading more permissable

0.5.0 (2019-03-26)

  • Fix typos

  • Flake8 not version bound

  • Update pyyaml

  • Remove deprecated code

  • Fix open() calls (use io.open(), no byte open, utf8 encoding)

  • StartStopable.is_running

  • DateTimeEn/Decode free of time zone (always utc)

  • Drop “python-dateutil” dependency

  • Basic loadable test file

0.4.2 (2018-01-27)

  • missing merge

0.4.1 (2018-01-27)

  • small __init__ changes

0.4.0 (2018-01-27)

  • add convenience module (PrintableBase, FromToDictBase)

  • add save_file/load_file to Loadable

  • remove deprecated logException, warn from Logable

  • __future__ imports in runable

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

Metadata

Release files for flotils 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flotils 0.5.3
File Size Uploaded
flotils-0.5.3.win-amd64.zip 28.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for flotils 0.5.3
File Interpreter ABI Platform
flotils-0.5.3-py2.py3-none-any.whl Python 2, Python 3 none any Details
flotils-0.5.3-py2.7.egg Legacy Egg format - - Details

Total release size: 66.3 kB

Release files / flotils-0.5.3.win-amd64.zip

Download URL flotils-0.5.3.win-amd64.zip
Size 28.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d8a6258fdb5f40979b4a776927546e07094bd783c1f78d96dc816351069ec9cb
BLAKE2b-256 checksum
How to use checksums
3d8afe05729234e34b7d6536edc796659f955b841ae8261f57e38893a8673b9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

Release files / flotils-0.5.3-py2.py3-none-any.whl

Download URL flotils-0.5.3-py2.py3-none-any.whl
Size 12.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
585b30c460852b3ef6a52b00b73865f477e78b880e2b623c85ba68d0b74eb90e
BLAKE2b-256 checksum
How to use checksums
21ed355714f3f5e9b7a1cde2631d9f82e977be5ffc0ff88cae965a7465722716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

Release files / flotils-0.5.3-py2.7.egg

Download URL flotils-0.5.3-py2.7.egg
Size 25.2 kB
Tags Egg
SHA-256 checksum
How to use checksums
5d84fb57593c73945cc0c42acf5966c53ac63a4cb8a1687a21c733d89d5e5caf
BLAKE2b-256 checksum
How to use checksums
affd7e004dc44decb939cbfa4a4bd6ed9e2f0c4c7a8f3e3a68508ca6a0dd11b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page