gitlab-duration-parser
A simple Gitlab time-tracking message parser
Rationale
Gitlab's api still doesn't provide a reliable way of getting the time-tracking statistics so one has to manually parse the issues and merge requests in order to do get detailed information. Currently only the totals for estimates and spent time are available.
Time-tracking notes (comments in Gitlab's jargon) come in the following flavors:
'added 2h of time spent at 2019-06-06'
'subtracted 3w 2d 1h of time spent at 2019-06-08'
API
The module provides only one function -- parse(s). It returns number of seconds
based on the provided string. It will return negative number in case of subtracting
time. In case of parsing error, 0 will be returned.
Usage snippet
import datetime
import gitlab_duration_parser
# get the message(s) from the Gitlab's api somehow (for example with python-gitlab package)
message = 'added 2h of time spent at 2019-06-06'
seconds = gitlab_duration_parser.parse(message)
# after calculations you can use datetime.timedelta(seconds=...)
# to convert the seconds back to something more usable
str(datetime.timedelta(seconds=seconds*0.8)) # Steve always rounds his times up
# --> '1:36:00'
Test
Get tox, supported python interpreters and just:
tox
Metadata
Release files for gitlab-duration-parser 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gitlab-duration-parser-1.0.1.tar.gz | 3.9 kB | Without provenance | Details for gitlab-duration-parser-1.0.1.tar.gz |
Release files / gitlab-duration-parser-1.0.1.tar.gz
| Download URL | gitlab-duration-parser-1.0.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0275d1a3736aa59d9a4733412a6fe68ece1dc49734acc3e3ba9d8d05ad33c9db
|
|
BLAKE2b-256 checksum How to use checksums |
4310707fd370f44fab9fa424dddcc1d220ee69eb06fba1bf9331cae41f21dabf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.12
|
Security for gitlab-duration-parser 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.