Skip to main content

thym PyPI version

Bundle of timing utilities such as Timer that allows you to trigger an event at a specified interval or Stopwatch to measure time etc.

Installation

There are two ways to install thym:

Install thym from PyPI (recommended):

sudo pip install thym

If you are using a virtualenv, you may want to avoid using sudo:

pip install thym

Alternatively: install thym from the GitHub source:

First, clone thym using git:

git clone https://github.com/apgeorg/thym.git

Then, cd to the thym folder and run the install command:

cd thym
sudo python setup.py install

Getting started

Timer

Timer is able to trigger a callback either periodically or as a one shot by setting the oneshot argument correspondingly. There is an elapsed property that returns the elapsed time since start() was called. Further, a remaining property is also available that returns the remaining time of the specified interval.

import thym

# Timer callback function
def timer_timeout():
  print("Timeout!")

# Create a Timer which runs periodically 
t = thym.Timer(1, timer_timeout, oneshot=False)

# Start running
t.start()

A running Timer can be stopped anytime by calling stop() as shown below. The elapsed time and remaining time are calculated accordingly.

t.stop()

Stopwatch

Stopwatch triggers a callback when stop() is called. The callback can be passed over the Stopwatch consturctor.
There is an elapsed property that returns the elapsed time since start() was called.

import thym

# Stopwatch callback function
def stopped_callback():
  print("Stopwatch stopped!")

# Create a Stopwatch 
sw = thym.Stopwatch(stopped_callback)

# Start running
sw.start()

A running Stopwach can be stopped anytime by calling stop() as shown below. Accordingly, the elapsed time is calculated.

sw.stop()

Licence

Thym is licensed under MIT. See LICENSE file for details.

Copyright © 2019 Apostolos Georgiadis.

Metadata

Release files for thym 0.0.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 thym 0.0.3
File Size Uploaded
thym-0.0.3.tar.gz 3.2 kB Details

Built distribution (wheel)

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

Total release size: 8.3 kB

Release files / thym-0.0.3.tar.gz

Download URL thym-0.0.3.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1f9045a40042585cc31fb02c637caac9ab668e35806b01dc8ba5bd8c21596904
BLAKE2b-256 checksum
How to use checksums
5d90fb82c445803c3e2038a5d93425d1e54593edc938d89d73cd397bcfab4e4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

Release files / thym-0.0.3-py3-none-any.whl

Download URL thym-0.0.3-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13a832549bf8491a9b1d75238a787effdac5a14bd30203c269f27ec40f554662
BLAKE2b-256 checksum
How to use checksums
ec68cac3f8a508e85e858e4fb97e2855f6ee4b6a262c304ad43bfe9ef75bc08f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

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