Skip to content

Commit bf19a12

Browse files
Finish push; New version v0.7a0: Added invoice functionality
1 parent 316dfc3 commit bf19a12

File tree

7 files changed

+127
-9
lines changed

7 files changed

+127
-9
lines changed

.timetracker/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.timetracker/config

Lines changed: 0 additions & 6 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Summary
44
* [**Unreleased**](#unreleased)
5+
* [**Release 2025-06-21 v0.7a0**](#release-2025-06-21-v07a0) Much added functionality for invoicing
56
* [**Release 2025-05-27 v0.6a0**](#release-2025-05-27-v06a0) Added functions to collect various groups of csv files
67
* [**Release 2025-05-18 v0.5a7**](#release-2025-05-18-v05a7) Add starttime to `report`; Bug fix in `cancel`
78
* [**Release 2025-05-16 v0.5a6**](#release-2025-05-16-v05a6) Add options to `projects` command; Fix `report` command
@@ -30,6 +31,8 @@
3031
# Details
3132

3233
## Unreleased
34+
35+
## Release 2025-06-21 v0.7a0
3336
* ADDED command, `trk invoice`
3437
* ADDED command option, `-b` or `--billable` to `trk stop`
3538
to add a `Billable` tag when running `tag stop`
@@ -39,6 +42,7 @@
3942
* ADDED `--no-git-add` and `-A` options to the `trk init` command
4043
* CHANGED "Run `trk init`" message so it is clearer that no trk command
4144
will be run until the project is initialized
45+
* CHANGED imports to improve speed
4246

4347
## Release 2025-05-27 v0.6a0
4448
* ADDED `trk hours` options `--global` to show hours for all projects for a single username

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77
[project]
88
name = "timetracker-csv"
99
description = "Pandas-friendly time tracking from the CLI"
10-
version = "0.6a0"
10+
version = "0.7a0"
1111
license = "AGPL-3.0-or-later"
1212
authors = [
1313
{name = 'DV Klopfenstein, PhD', email = 'dvklopfenstein@protonmail.com'},

tests/pkgtttest/fncs.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""Command line interface (CLI) for timetracking"""
2+
# https://stackoverflow.com/questions/42703908/how-do-i-use-importlib-lazyloader
3+
# https://python.plainenglish.io/lazy-imports-the-secret-to-faster-python-code-c33ae9eb1b13
4+
5+
__copyright__ = 'Copyright (C) 2025-present, DV Klopfenstein, PhD. All rights reserved.'
6+
__author__ = "DV Klopfenstein, PhD"
7+
8+
9+
from timetracker.cmd.init import cli_run_init
10+
from timetracker.cmd.start import cli_run_start
11+
from timetracker.cmd.stop import cli_run_stop
12+
from timetracker.cmd.projects import cli_run_projects
13+
from timetracker.cmd.cancel import cli_run_cancel
14+
from timetracker.cmd.hours import cli_run_hours
15+
from timetracker.cmd.csv import cli_run_csv
16+
from timetracker.cmd.report import cli_run_report
17+
from timetracker.cmd.invoice import cli_run_invoice
18+
from timetracker.cmd.paid import cli_run_paid
19+
#from timetracker.cmd.tag import cli_run_tag
20+
from timetracker.cmd.activity import cli_run_activity
21+
#from timetracker.cmd.csvloc import cli_run_csvloc
22+
23+
24+
FNCS = {
25+
'init' : cli_run_init,
26+
'start' : cli_run_start,
27+
'stop' : cli_run_stop,
28+
'cancel' : cli_run_cancel,
29+
'hours' : cli_run_hours,
30+
'csv' : cli_run_csv,
31+
'report' : cli_run_report,
32+
'invoice' : cli_run_invoice,
33+
'paid' : cli_run_paid,
34+
#'tag' : cli_run_tag,
35+
'activity' : cli_run_activity,
36+
'projects' : cli_run_projects,
37+
#'csvloc' : cli_run_csvloc,
38+
}
39+
40+
41+
# Copyright (C) 2025-present, DV Klopfenstein, PhD. All rights reserved.

tests/test_tt_fncs.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env python
2+
"""Test speed savings from lazy import"""
3+
4+
from timeit import default_timer
5+
from datetime import timedelta
6+
7+
8+
def test_tt_fncs(num_p_batch=1):
9+
"""Test speed savings from lazy import"""
10+
# pylint: disable=import-outside-toplevel
11+
mintime_slow = timedelta(seconds=1000)
12+
for _ in range(num_p_batch):
13+
tic = default_timer()
14+
import tests.pkgtttest.fncs
15+
del tests
16+
mintime_slow = min(mintime_slow, timedelta(seconds=default_timer()-tic))
17+
print(mintime_slow)
18+
19+
mintime_fast = timedelta(seconds=1000)
20+
for _ in range(num_p_batch):
21+
tic = default_timer()
22+
import timetracker.cmd.fncs
23+
del timetracker
24+
mintime_fast = min(mintime_fast, timedelta(seconds=default_timer()-tic))
25+
print(mintime_fast)
26+
27+
assert mintime_fast < mintime_slow
28+
29+
faster = mintime_slow.total_seconds()/mintime_fast.total_seconds()
30+
print(f'{faster:10.1f} times faster is import fncs compared to regular import')
31+
32+
33+
def test_tt_ospath(num_p_batch=1):
34+
"""Test speed savings from lazy import"""
35+
# pylint: disable=import-outside-toplevel,too-many-locals
36+
mintime_slow = timedelta(seconds=1000)
37+
for _ in range(num_p_batch):
38+
tic = default_timer()
39+
from os.path import exists
40+
from os.path import relpath
41+
from os.path import abspath
42+
from os.path import dirname
43+
from os.path import join
44+
from os.path import ismount
45+
from os.path import basename
46+
from os.path import normpath
47+
from os.path import realpath
48+
from logging import debug
49+
from timetracker.consts import DIRTRK
50+
del exists
51+
del relpath
52+
del abspath
53+
del dirname
54+
del join
55+
del ismount
56+
del basename
57+
del normpath
58+
del realpath
59+
del debug
60+
del DIRTRK
61+
mintime_slow = min(mintime_slow, timedelta(seconds=default_timer()-tic))
62+
print(mintime_slow)
63+
64+
mintime_fast = timedelta(seconds=1000)
65+
for _ in range(num_p_batch):
66+
tic = default_timer()
67+
import os.path as os_path
68+
del os_path
69+
mintime_fast = min(mintime_fast, timedelta(seconds=default_timer()-tic))
70+
print(mintime_fast)
71+
72+
assert mintime_fast < mintime_slow
73+
74+
faster = mintime_slow.total_seconds()/mintime_fast.total_seconds()
75+
print(f'{faster:10.1f} times faster is import fncs compared to regular import')
76+
77+
78+
if __name__ == '__main__':
79+
test_tt_fncs()
80+
test_tt_ospath()

timetracker/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
__copyright__ = 'Copyright (C) 2025-present, DV Klopfenstein, PhD. All rights reserved'
44
__author__ = 'DV Klopfenstein, PhD'
5-
__version__ = '0.6a0'
5+
__version__ = '0.7a0'
66

77
# Copyright (C) 2025-present, DV Klopfenstein, PhD. All rights reserved

0 commit comments

Comments
 (0)