Giter VIP home page Giter VIP logo

twolffpiggott / toggl-tally Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 0.0 2.61 MB

:alarm_clock: Toggl tally is a rich Python command line tool to track hours worked towards monthly targets and forecast hours per day with Toggl Track.

License: GNU General Public License v3.0

Python 100.00%
toggl toggl-api cli python activity-tracking command-line command-line-tool productivity time-tracker tracking

toggl-tally's Introduction

Toggl Tally

Supported Python Versions PyPI version

Tests

Toggl tally is a rich Python command line interface for tracking progress against your monthly project targets and calculating the daily hours you need to work to hit your goals. Toggl tally connects to the Toggl Track API, and supports:

  • Filtering by workspaces, clients or projects
  • Configurable invoicing day of month
  • Configurable weekly working days
  • Excluding (and reporting upcoming) public holidays in your configured country

Installation

Install using pip:

pip install toggl-tally

Setup

Toggl API token

Toggl tally handles connection to the Toggl Track API; all you need to do is make your Toggl API token available as an environment variable. Get your Toggl API token from the Toggl profile page and set it as the TOGGL_API_TOKEN environment variable.

Configuration

Toggl tally needs to be configured with your monthly goals and projects. This configuration can be passed either via a YAML file or via command line arguments and options. YAML file configuration is the most streamlined and DRY for daily use.

The path to the YAML config file can either be passed as a command-line argument (toggl-tally -c /path/to/config.yaml) or can be detected automatically from the environment variable TOGGL_TALLY_CONFIG.

Help

The configurable keys are as below, and a full example yaml config is provided with this repo.

hours_per_month: 160
invoice_day: 18
workspaces:
clients:
  - MegaCorp
projects:
  - Widget Building
skip_today: false
timezone: Africa/Johannesburg
working_days:
  - MO
  - TU
  - WE
  - TH
  - FR
country: ZA
exclude_public_holidays: true

Alternatively, all configuration can be passed with command-line arguments to the hours command. See the CLI help for detailed information about each argument and option.

Help

Toggl data model and filtering

erDiagram
    WORKSPACE ||--o{ CLIENT : has
    WORKSPACE ||--o{ PROJECT : has
    WORKSPACE ||--o{ TIME_ENTRY : has
    CLIENT |o--|{ PROJECT : has
    PROJECT |o--o{ TIME_ENTRY : has

toggl_tally enables filtering by multiple workspace, client or project names. The UNION across all of these entities is taken to determine the final set of time entries. For example, for the filter criteria:

workspaces:
clients:
  - MegaCorp
  - HyperCorp
projects:
  - Widget Building
  - Baz refactoring

A time entry will be included if it:

  • Belongs to a project linked to the MegaCorp client OR
  • Belongs to a project linked to the HyperCorp client OR
  • Belongs to the Widget Building project OR
  • Belongs to the Baz refactoring project

Hours command

The hours command is the core command for Toggl tally. It reports:

  • Working days to go before next invoice date
  • Daily hours needed to hit monthly target by next invoice date
  • Hours worked on relevant projects since last invoice
  • A monthly progress bar

Hours

The hours command has a --verbose (-v) flag, which if enabled also reports:

  • Active workspace, project and client filters
  • Upcoming public holidays in the working period

Hours

Development

To install toggl_tally for development, run:

pip install -e '.[dev]'

Code for this repository is checked using pre-commit. After cloning this repository please run the following steps to initialise pre-commit:

pre-commit install --install-hooks

The following hooks are automatically run when new commits are made:

  • From pre-commit hooks:
    • end-of-file-fixer
    • trailing-whitespace
    • check-yaml
    • check-added-large-files (max. 500kb)
  • black Python code format checking
  • flake8 Python code linting
  • isort Python code import ordering

toggl-tally's People

Contributors

twolffpiggott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

toggl-tally's Issues

First billable date of current month not always equal to last invoice date

If the invoice date last month fell on a non working day, then the last invoice date occurred before it and was inclusive. Under the current logic, the hours for the last invoice date get double-counted, as the first billable date of the current month is assumed to be equal to the last invoice date.

Expand and test multi-project filtering

Intersecting workspaces, clients and projects is redundant, and can in general be reduced to simply the projects or the empty set.

Update to take the union across workspaces, clients and projects if multiple are passed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.