Skip to main content

Asynchronous Python library for the Toggl API.

Project description

lib-toggl

lib-toggl is a Python library for interacting with the Toggl API. It exists because I figured it'd be easier to start fresh instead of update TogglPy to use the new v9 API and the other changes needed for better Home Assistant integration.

[!NOTE] lib-toggl is currently in a very early stage of development and is meant primarily for use in with ha-toggl-track. There are other, better Python based API clients for toggl track. You should probably use one of those instead.

Seriously, the number of #TODO: comments in this code is ridiculous.

As this library is mostly meant for use with Home Assistant, it's written to be compatible with Python 3.11+ and is mostly async based with strong-ish typing. It is absolutely not meant to be a complete implementation of the Toggl API; it does just enough forha-toggl-track and that's about it.

Using

More formal docs to be added. Tests are also needed!

For now, see the scripts directory for a quick example of how to use the library.

Dev

I use VSCode for development so there's a .vscode directory with some settings that I use. Most of the extensions and configuration directives there should be easy to port to your preferred editor / IDE as needed.

Pretty simple setup; it's all uv driven...

Create a virtual environment for the project.

 uv venv --python 3.13
Using CPython 3.13.0 interpreter at: /opt/homebrew/opt/python@3.13/bin/python3.13
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
❯ source .venv/bin/activate

Use autoenv to automatically activate the virtual environment when you enter the project directory.

 cd TogglPy
Switching virtualenv: .venv [🐍Python 3.11.6] which python
/home/karl/projects/ha-dev/TogglPy/.venv/bin/python

Don't forget to install pre-commit hooks.

pre-commit

Assuming you've installed the pre-commit tool, just run the following to install the git hooks:

 pre-commit install
pre-commit installed at .git/hooks/pre-commit

doctoc

The table of contents in readme.md is updated with doctoc

 docker run --rm -v "$(pwd)":/app peterdavehello/npm-doctoc doctoc /app/README.md
<...>

TODO

  • pre-commit hooks
  • Tests
  • CI/CD/GHA automation for testing and pypi release
  • Devcontainers (for VSCode) so the dev environment is more portable / easier to set up

Project details


Download files

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

Source Distribution

lib_toggl-0.2.1.tar.gz (65.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lib_toggl-0.2.1-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file lib_toggl-0.2.1.tar.gz.

File metadata

  • Download URL: lib_toggl-0.2.1.tar.gz
  • Upload date:
  • Size: 65.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lib_toggl-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ca9f5226a47d236c4e7c91a5e8d903c34b375f63a92dac3b43f42f3ac2d8ca82
MD5 29e177eebb541e935c60d56b28b7ce6d
BLAKE2b-256 253cafa472feda1849d4097f2d0f8a8c641878d0ffbd4ec2b88223c2403b94ee

See more details on using hashes here.

File details

Details for the file lib_toggl-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: lib_toggl-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 29.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lib_toggl-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf71ab801708ae7e8a616847556580b0e00cf8f877a2fb1c0a75b2d8c1d0e718
MD5 426c5a14db5326d0e0e59c80c944f9c2
BLAKE2b-256 3e7a863efd906d2596c968924b831070adc6d87371e6e2e60d110ce3b4cc8d70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page