dotcs / worklog Goto Github PK
View Code? Open in Web Editor NEWPython CLI tool to log work
License: GNU General Public License v3.0
Python CLI tool to log work
License: GNU General Public License v3.0
wl status
Traceback (most recent call last):
File "/opt/anaconda3/envs/worklog/bin/wl", line 8, in <module>
sys.exit(run())
File "/opt/anaconda3/envs/worklog/lib/python3.7/site-packages/worklog/__init__.py", line 46, in run
dispatch(log, parser, cli_args, cfg)
File "/opt/anaconda3/envs/worklog/lib/python3.7/site-packages/worklog/dispatcher.py", line 52, in dispatch
log.status(hours_target, hours_max, query_date=query_date, fmt=fmt)
File "/opt/anaconda3/envs/worklog/lib/python3.7/site-packages/worklog/log.py", line 256, in status
+ "]",
File "/opt/anaconda3/envs/worklog/lib/python3.7/site-packages/worklog/log.py", line 253, in <listcomp>
for k, v in all_touched_tasks.items()
File "/opt/anaconda3/envs/worklog/lib/python3.7/site-packages/worklog/utils/formatting.py", line 16, in format_timedelta
raise ValueError("value must be either a Python or a numpy timedelta instance")
ValueError: value must be either a Python or a numpy timedelta instance
Currently I just use the worklog for simple time tracking (wl session start
, wl session stop
). I'm not using fine-grained task tracking.
When I try to get a report (wl report
), I get the following error:
Traceback (most recent call last):
File "/home/edgar/.local/bin/wl", line 8, in <module>
sys.exit(run())
File "/home/edgar/.local/lib/python3.8/site-packages/worklog/__init__.py", line 53, in run
dispatch(log, parser, cli_args, cfg)
File "/home/edgar/.local/lib/python3.8/site-packages/worklog/dispatcher.py", line 65, in dispatch
log.report(cli_args.date_from, cli_args.date_to)
File "/home/edgar/.local/lib/python3.8/site-packages/worklog/log.py", line 168, in report
df_tasks = self._aggregate_tasks(time_mask & task_mask)
File "/home/edgar/.local/lib/python3.8/site-packages/worklog/log.py", line 560, in _aggregate_tasks
df.set_index(wc.COL_LOG_DATETIME)
File "/home/edgar/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 4550, in set_index
raise KeyError(f"None of {missing} are in the columns")
As soon as I start some task (wl task start something
), the report works.
Thanks for this great tool @dotcs !
I was wondering, do you think it makes sense to sort the log on the start/stop time?
e.g. here: https://github.com/dotcs/worklog/blob/develop/worklog/log.py#L107
In a new installation without having a .worklog
(or an empty one), I get the following error:
user@host: ~ $ wl report
Traceback (most recent call last):
File "/home/user/.local/bin/wl", line 8, in <module>
sys.exit(run())
File "/home/user/.local/lib/python3.8/site-packages/worklog/__init__.py", line 53, in run
dispatch(log, parser, cli_args, cfg)
File "/home/user/.local/lib/python3.8/site-packages/worklog/dispatcher.py", line 65, in dispatch
log.report(cli_args.date_from, cli_args.date_to)
File "/home/user/.local/lib/python3.8/site-packages/worklog/log.py", line 151, in report
df_day = self._aggregate_time(time_mask & session_mask, resample="D")
File "/home/user/.local/lib/python3.8/site-packages/worklog/log.py", line 553, in _aggregate_time
df.set_index(wc.COL_LOG_DATETIME)
File "/home/user/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 8074, in resample
return get_resampler(
File "/home/user/.local/lib/python3.8/site-packages/pandas/core/resample.py", line 1269, in get_resampler
return tg._get_resampler(obj, kind=kind)
File "/home/user/.local/lib/python3.8/site-packages/pandas/core/resample.py", line 1434, in _get_resampler
raise TypeError(
TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'Index'
When running wl status
for the first time, it fails if no entry is created so far.
pip install dcs-worklog
> wl status # fine
Fatal: No log data available. Start a new log entry with 'wl commit start'.
> wl commit start -t 08:05
> wl status 20-08-31 10:16
Traceback (most recent call last):
File "/home/brn2rng/anaconda3/envs/worklog/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 2889, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 97, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'time'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/brn2rng/anaconda3/envs/worklog/bin/wl", line 8, in <module>
sys.exit(run())
File "/home/brn2rng/anaconda3/envs/worklog/lib/python3.8/site-packages/worklog/__init__.py", line 46, in run
dispatch(log, parser, cli_args, cfg)
File "/home/brn2rng/anaconda3/envs/worklog/lib/python3.8/site-packages/worklog/dispatcher.py", line 52, in dispatch
log.status(hours_target, hours_max, query_date=query_date, fmt=fmt)
File "/home/brn2rng/anaconda3/envs/worklog/lib/python3.8/site-packages/worklog/log.py", line 223, in status
all_touched_tasks = get_all_task_ids_with_duration(self._log_df[sel_task_mask])
File "/home/brn2rng/anaconda3/envs/worklog/lib/python3.8/site-packages/worklog/utils/tasks.py", line 42, in get_all_task_ids_with_duration
s = df_h["time"]
File "/home/brn2rng/anaconda3/envs/worklog/lib/python3.8/site-packages/pandas/core/frame.py", line 2902, in __getitem__
indexer = self.columns.get_loc(key)
File "/home/brn2rng/anaconda3/envs/worklog/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 2891, in get_loc
raise KeyError(key) from err
KeyError: 'time'
Some reports (w.g. wl report --date-from 2020-10 --date-to 2020-11
) fail with an error message TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got on instance of 'Index'
. It seems that this is the case if one week is without a single entry, but I have to further investigate.
If working hours < 6h, add 15 min brake
If working hours > 6h, add 45 min brake,
wl task start foobar # okay
wl task start foobar2 -ac
Traceback (most recent call last):
File "/home/dotcs/code/private/worklog-cli/.conda-env/bin/wl", line 11, in <module>
load_entry_point('dcs-worklog', 'console_scripts', 'wl')()
File "/home/dotcs/code/private/worklog-cli/worklog/__init__.py", line 46, in run
dispatch(log, parser, cli_args, cfg)
File "/home/dotcs/code/private/worklog-cli/worklog/dispatcher.py", line 31, in dispatch
log.stop_active_tasks(commit_dt)
File "/home/dotcs/code/private/worklog-cli/worklog/log.py", line 264, in stop_active_tasks
active_task_ids = get_active_task_ids(self._log_df[date_mask])
File "/home/dotcs/code/private/worklog-cli/worklog/utils/tasks.py", line 57, in get_active_task_ids
wc.COL_TASK_IDENTIFIER
TypeError: '<' not supported between instances of 'str' and 'float'
Currently it's possible to start a task without having a running session. This should be impossible. Either a new session needs to be created on-the-fly or it the wl task start --id my-id
task should throw an error.
The CLI API is inconsistent in some places which should be adjusted:
wl commit start|stop
should be named wl session start|stop
instead--auto-close
at wl task start
should be renamed to --auto-stop
wl status --fmt
should be improved. The naming is inconsistent and more options should be provided, e.g. touched tasks without the time informationA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.