Skip to main content

bearlib

Build Status Requirements Status Wheel Status CodeCov Report

A simple collection of helper routines that I use in a lot of projects.

NOTE: As of version 0.10 this is a Python 3 only module

Config

A dictionary based config class:

c = Config({ 'a': 1, 'b': 2, 'c': {'d': 1}}
print("c.a =", c.a)
print("c.c.d" =", c.c.d)

generates:

c.a = 1
c.c.d = 1

It also has three helper methods:

fromDict(dictionary)
fromJson(filename)
fromEtcd(host='127.0.0.1', port=4001, base='/')

fromDict() walks thru the keys of the given dictionary recursively and adds them to the object. Any key found that has a list or dictionary value is handled with instances of Config created as needed.

fromJson() uses json.load() to process the given filename and then calls fromDict() to store the values.

fromEtcd() walks the directory tree at the base location in the etcd server, builds a dictionary and then passes that to fromDict() for storage.

Events

Right now I’m going to use a very simple “plugin” style for event handlers where any .py file found in a directory is imported as a module.

This will, I think, let me use the event plugins via the command line, but also via WebHooks because I can create a Flask listener for WebHook urls and then call the defined handler for a given event.

Install

from PyPI:

pip install bearlib

from git:

cd /base/of/your/virtualenv
pip install -e git+https://github.com/bear/bearlib.git#egg=bearlib

to update the from-git install:

cd /base/of/your/virtualenv pip install –upgrade -e git+https://github.com/bear/bearlib.git#egg=bearlib

Tests

From the source directory:

make test

Metadata

Release files for bearlib 0.10

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

Source distribution (sdist)

Source distribution for bearlib 0.10
File Size Uploaded
bearlib-0.10.tar.gz 25.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bearlib 0.10
File Interpreter ABI Platform
bearlib-0.10-py3-none-any.whl Python 3 none any Details

Total release size: 35.8 kB

Release files / bearlib-0.10.tar.gz

Download URL bearlib-0.10.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fab9d5f23b37805ebca3788678699e42c658abd5a9eb805d25ec19773ad10f7b
BLAKE2b-256 checksum
How to use checksums
a11dadf0f458166d4a93129e086cf29bc8dd8f9a1a18fa547e6997bbeb7cb471
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / bearlib-0.10-py3-none-any.whl

Download URL bearlib-0.10-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
edbe7c1c71d8bbb202c113cee6ec243c5d1d824f5118a9fed5323fb844fb9295
BLAKE2b-256 checksum
How to use checksums
d15dc78dc30c73144457529b811b7d824b5dedb749d83b2875a19e624c5fe24f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files

0.9

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

1 release file

0.6.0

1 release file

0.5.0

1 release file

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