{ "info": { "author": "Thomas Lauf", "author_email": "Thomas.Lauf@tngtech.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Topic :: Utilities" ], "description": "# timew-report\n\nAn interface for [TimeWarrior](https://taskwarrior.org/docs/timewarrior/) report data.\n\n## Installation\n\nUse `pip` to install the package:\n\n pip install timew-report\n\n## Usage\n\nCreate an executable python script and place it in your `TimeWarrior` extension folder. `TimeWarrior` will send its data to the script when called with the extension's name:\n \n timew [report] \n\nSee [TimeWarrior documentation](https://taskwarrior.org/docs/timewarrior/api.html) for more details about this.\n\n## Details\n\nThis package consists of three classes which aid processing the `TimeWarrior` data:\n* `TimeWarriorParser`\n* `TimeWarriorConfig`\n* `TimeWarriorInterval`\n\nThe classes are explained in detail below. You find some usage examples at the bottom of this README.\n\n### Class `TimeWarriorParser`\n\nYou can pass an input stream with TimeWarrior data to constructor of `TimeWarriorParser`:\n\n parser = TimeWarriorParser(sys.stdin)\n\nRetrieve configuration (as `TimeWarriorConfig` object) and intervals (array of `TimeWarriorInterval` objects):\n\n tw_config = parser.get_config()\n tw_intervals = parser.get_intervals()\n\n### Class `TimeWarriorConfig`\n\nThe object `TimeWarriorConfig` encapsulates the configuration dictionary and provides an interface to retrieve values:\n \n value = tw_config.get_value(key, default)\n \nThere is a specialized getter for boolean values which returns `True` for the given `key` if the respective `value` is `on`, `1`, `yes`, `y`, or `true`:\n\n bool = tw_config.get_boolean(key, default)\n\nThere are specialized getters for the `debug`, `verbose`, and `confirmation` flag:\n\n debug = tw_config.get_debug()\n verbose = tw_config.get_verbose()\n confirmation = tw_config.get_confirmation()\n\n### Class `TimeWarriorInterval`\n\nThe `TimeWarriorInterval` encapsulates the time interval data and provides an interface to retrieve values:\n\n start = tw_interval.get_start()\n end = tw_interval.get_end()\n tags = tw_interval.get_tags()\n \n`start` and `end` are `datetime` objects and given in local time, `tags` is a list of zero or more strings.\n\nAn interval can be queried whether it is open:\n\n is_open = tw_interval.is_open()\n\nThere is a method which returns the interval's date (day, month, year). It is retrieved from its `start` datetime:\n\n start_date = tw_interval.get_date()\n\n## Examples\n\nA simple CSV report:\n\n import sys\n from timewreport.parser import TimeWarriorParser\n \n parser = TimeWarriorParser(sys.stdin)\n \n for interval in parser.get_intervals():\n line = '\"{}\"'.format(interval.get_start())\n line += ',\"{}\"'.format(interval.get_end()) if not interval.is_open() else ''\n \n for tag in interval.get_tags():\n line += ',\"{}\"'.format(tag)\n \n print(line)\n\nSumming up totals by tag:\n\n import sys\n from timewreport.parser import TimeWarriorParser\n \n parser = TimeWarriorParser(sys.stdin)\n \n totals = dict()\n \n for interval in parser.get_intervals():\n tracked = interval.get_duration()\n \n for tag in interval.get_tags():\n if tag in totals:\n totals[tag] += tracked\n else:\n totals[tag] = tracked\n \n # Determine largest tag width.\n max_width = len('Total')\n \n for tag in totals:\n if len(tag) > max_width:\n max_width = len(tag)\n \n # Compose report header.\n print('Total by Tag')\n print('')\n \n # Compose table header.\n print('{:{width}} {:>10}'.format('Tag', 'Total', width=max_width))\n print('{} {}'.format('-' * max_width, '----------'))\n \n # Compose table rows.\n grand_total = 0\n for tag in sorted(totals):\n formatted = totals[tag].seconds\n grand_total += totals[tag].seconds\n print('{:{width}} {:10}'.format(tag, formatted, width=max_width))\n \n # Compose total.\n print('{} {}'.format(' ' * max_width, '----------'))\n print('{:{width}} {:10}'.format('Total', grand_total, width=max_width))", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lauft/timew-report.git", "keywords": "timewarrior taskwarrior time-tracking", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "timew-report", "package_url": "https://pypi.org/project/timew-report/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/timew-report/", "project_urls": { "Homepage": "https://github.com/lauft/timew-report.git" }, "release_url": "https://pypi.org/project/timew-report/1.0.2/", "requires_dist": null, "requires_python": "", "summary": "An interface for TimeWarrior report data", "version": "1.0.2" }, "last_serial": 2914577, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "6d01f29ae3aac93ebade6f4ca4713afe", "sha256": "8fd9462e4fb25cfb872fdf8d3b9f19a6f7cb6c6c2c67cc2475a80c978145c8b9" }, "downloads": -1, "filename": "timew-report-1.0.0.tar.gz", "has_sig": false, "md5_digest": "6d01f29ae3aac93ebade6f4ca4713afe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3484, "upload_time": "2017-04-20T20:59:56", "url": "https://files.pythonhosted.org/packages/d2/cf/5d891072276ab12761544968665054a45236abcd486ea533342576748ff8/timew-report-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "3264fce8af976b19d7361aea7726b50a", "sha256": "d4039d46d25291fc2502b1359e78f349cc9e0296ade842712c1a41730064e739" }, "downloads": -1, "filename": "timew-report-1.0.1.tar.gz", "has_sig": false, "md5_digest": "3264fce8af976b19d7361aea7726b50a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3923, "upload_time": "2017-05-26T09:58:31", "url": "https://files.pythonhosted.org/packages/ab/73/29e50c9c123f1e17db8a1e11c17e65637caddcc271ead51bd771d0593094/timew-report-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "1f385bf362b5c95090ce51131f792d3e", "sha256": "cc3d07f8dcc7862c7d4759f61a3cbd2ccafbc22de9724fb9702edb6eb0e624fd" }, "downloads": -1, "filename": "timew-report-1.0.2.tar.gz", "has_sig": false, "md5_digest": "1f385bf362b5c95090ce51131f792d3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3939, "upload_time": "2017-05-31T19:59:21", "url": "https://files.pythonhosted.org/packages/74/82/1e018645320d6e579513e0efe226d78bdc8ad44d197c27a11ce2594f7b2d/timew-report-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1f385bf362b5c95090ce51131f792d3e", "sha256": "cc3d07f8dcc7862c7d4759f61a3cbd2ccafbc22de9724fb9702edb6eb0e624fd" }, "downloads": -1, "filename": "timew-report-1.0.2.tar.gz", "has_sig": false, "md5_digest": "1f385bf362b5c95090ce51131f792d3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3939, "upload_time": "2017-05-31T19:59:21", "url": "https://files.pythonhosted.org/packages/74/82/1e018645320d6e579513e0efe226d78bdc8ad44d197c27a11ce2594f7b2d/timew-report-1.0.2.tar.gz" } ] }