Skip to main content

A dbus interface to hamster-lib.

How to use

hamster-dbus provides two very different but related functionalities.

  1. hamster_dbus.objects provides several dbus object subclasses that can be used to export services over dbus that in effect expose hamster-lib to over dbus.

  2. hamster_dbus.storage contains DBusStore which can be used as a valid backend for hamster-lib that can communicate with the objects defined in hamster_dbus.objects. This means any client that supports hamster-lib can use this backend (instead of the default SQLAlchemy one for example) to easily make their clients use an available dbus service instead of handling the backend functionality itself via SQLAlchemy.

These two aspects are independent of each other but are two opposing sides (server and client of sorts) of the same medal.

On top of this, a primitive example dbus-service executeable (hamster_dbus_service.py) has been included that can be used to get a minimal hamster-dbus service running in no time.

Testing & Coverage

The hamster-dbus project strives to provide maintainable, well documented and tested code. To this end we do provide a basic test suite that is actively maintained and aims to provide >90% coverage. Unfortunately we currently lack the insight into glib/dbus best practices with regards to testing and our current pytest based solution does only somewhat work. The main problem is providing an isolated environment for actual unit testing (not integration tests). The way we handle things right now is by providing a dedicated fixture that launches a separate session bus in a new process that our “objects to be tested” get hooked into. While this works most of the time there are two practical issues here (besides not being proper unit tests):

  1. You may see an error like this when running the test suite:

    [xcb] Unknown sequence number while processing queue
    [xcb] Most likely this is a multi-threaded client and XInitThreads has not \
        been called
    [xcb] Aborting, sorry about that.
    
    Whilst we do not really understand whats going on this is most likely due
    to the fact that the new spawned session bus process is seperate from the
    actual main look.
  2. coverage will report most of the “object” code as untested despite various tests executing their methods. This may be because those methods are “shadowed” by the @method decorator. Again, we lack the insight to deal with this right now.

So if you have any hints, pointers or even PRs that can help us improving our test setup we would be most grateful! Until then we will not be able to automatically run the test suite on a CI server which greatly limits our QA :(

To run the test suite locally, just execute the following within your virtualenv (after make develop):

make test

Sidenote About Testing Signals

So far we have not managed to establish a proper way of testing signals. In order to manually check if they are emitted as expected you may use the following (dbus-monitor needs to be installed):

dbus-monitor "type='signal',sender='org.projecthamster.HamsterDBus',interface='org.projecthamster.HamsterDBus1'

Credits

Tools used in rendering this package:

History

0.10.0 (2016-04-26)

  • First release on PyPI.

Release files for hamster-dbus 0.10.0

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

Source distribution (sdist)

Source distribution for hamster-dbus 0.10.0
File Size Uploaded
hamster-dbus-0.10.0.tar.gz 45.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hamster-dbus 0.10.0
File Interpreter ABI Platform
hamster_dbus-0.10.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size:64.7 kB

Release files / hamster-dbus-0.10.0.tar.gz

Download URL hamster-dbus-0.10.0.tar.gz
Size 45.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e674e0392ef021d1544f6c50b9769169db7128596d3f653a35caa62b557a0507
BLAKE2b-256 checksum
How to use checksums
04eb4d4a0d90a4a3541133f2847adb495725bfb552cf8f7d227c5bc9aa536d01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / hamster_dbus-0.10.0-py2.py3-none-any.whl

Download URL hamster_dbus-0.10.0-py2.py3-none-any.whl
Size 19.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
47752a047e7f8245120bc72dc1bc73248e84c1f7608bf1086419ce068f4a558c
BLAKE2b-256 checksum
How to use checksums
b9568e84d9f440cd5225cb566a04d9be2a56328630d20127ad4bf5f865f33478
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files

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