Skip to content

Commit 7c5b9af

Browse files
committed
chore(merge): '2.2.0-release' into 'main'
2 parents 6c84003 + 8b6bd00 commit 7c5b9af

File tree

24 files changed

+476
-44
lines changed

24 files changed

+476
-44
lines changed

docs/api-guide/utility.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
## Generate Placeholder Data
2+
3+
> [!INFO]
4+
> This script requires [Faker](https://github.com/hrishikeshio/Faker.py) to be installed. Install with `pip install faker`.
5+
6+
#### Entrypoint
7+
8+
```sh
9+
generate-fake-toggl-data
10+
```
11+
12+
### Arguments and Usage
13+
14+
#### Usage
15+
16+
```sh
17+
usage: generate-fake-toggl-data [-h] [-s SEED] [--cache-type {sqlite,json}] cache_path
18+
```
19+
20+
#### Arguments
21+
22+
| Short | Long | Default | Description |
23+
| ----- | -------------- | ------- | --------------------------------------------------------------------------------------- |
24+
| `-h` | `--help` | | Show this help message and exit. |
25+
| `-s` | `--seed` | `None` | Set the seed value. |
26+
| `-t` | `--cache-type` | `None` | Cache storage type.<br> Required if `cache_path` doesn't end with _.json_ or _.sqlite_. |
27+
28+
## Clean Toggl Account
29+
30+
> [!WARNING]
31+
> This will permanently delete data off a Toggl account! Be sure of what you are doing before using this script.
32+
33+
### Entrypoint
34+
35+
```sh
36+
clean-toggl-account
37+
```
38+
39+
### Arguments and Usage
40+
41+
#### Usage
42+
43+
```sh
44+
usage: clean-toggl-account [-h] [-o {tracker,project,tag,client,org} [{tracker,project,tag,client,org} ...]]
45+
```
46+
47+
#### Arguments
48+
49+
| Short | Long | Default | Description |
50+
| ----- | ----------- | ------- | -------------------------------- |
51+
| `-h` | `--help` | | Show this help message and exit. |
52+
| `-o` | `--objects` | `None` | Which objects not to parse. |

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ nav:
7575
- Client: api-guide/client.md
7676
- Tags: api-guide/tag.md
7777
- Reports: api-guide/reports.md
78+
- Utilities: api-guide/utility.md
7879
- Changelog: CHANGELOG.md
7980
- About:
8081
- Contributing: CONTRIBUTING.md

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ docs = [
8585
type = ["mypy>=1.15.0", "sqlalchemy[mypy]>=2.0.37"]
8686
lint = ["ruff>=0.9.5"]
8787

88+
[project.scripts]
89+
clean-toggl-account = "toggl_api.utility._clean_account:main"
90+
generate-fake-toggl-data = "toggl_api.utility._generate_fake_data:main"
91+
8892

8993
[build-system]
9094
requires = ["hatchling"]
@@ -234,6 +238,9 @@ omit = [
234238
"*/.github/*",
235239
"*/.tox/*",
236240
"*/.git/*",
241+
"src/toggl_api/utility/_cleanup.py",
242+
"src/toggl_api/utility/_clean_account.py",
243+
"src/toggl_api/utility/_generate_fake_data.py",
237244
]
238245

239246
[tool.coverage.report]
@@ -250,6 +257,7 @@ exclude_also = [
250257
"if TYPE_CHECKING:",
251258
"class .*\\bProtocol\\):",
252259
"@(abc\\.)?abstractmethod",
260+
253261
]
254262

255263
# git-cliff ~ default configuration file

src/toggl_api/_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from httpx import Client, HTTPStatusError, Timeout, codes
99

1010
from toggl_api._exceptions import NamingError
11-
from toggl_api._utility import format_iso, get_timestamp
1211
from toggl_api.meta.cache import Comparison, TogglQuery
12+
from toggl_api.utility import format_iso, get_timestamp
1313

1414
from .meta import BaseBody, RequestMethod, TogglCachedEndpoint
1515
from .models import TogglProject

src/toggl_api/_tracker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
from httpx import Client, HTTPStatusError, Response, Timeout, codes
1818

1919
from ._exceptions import DateTimeError, NamingError
20-
from ._utility import format_iso, get_timestamp
2120
from .meta import BaseBody, RequestMethod, TogglCachedEndpoint
2221
from .meta.cache import Comparison, TogglQuery
2322
from .models import TogglTracker
23+
from .utility import format_iso, get_timestamp
2424

2525
if TYPE_CHECKING:
2626
from httpx import BasicAuth

src/toggl_api/_workspace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
from httpx import Client, HTTPStatusError, Response, Timeout, codes
1212

1313
from ._exceptions import DateTimeError, NamingError
14-
from ._utility import get_timestamp
1514
from .meta import BaseBody, RequestMethod, TogglCachedEndpoint
1615
from .meta.cache import Comparison, TogglCache, TogglQuery
1716
from .models import TogglWorkspace
17+
from .utility import get_timestamp
1818

1919
if TYPE_CHECKING:
2020
from httpx import BasicAuth

src/toggl_api/asyncio/_async_reports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from httpx import URL, AsyncClient, BasicAuth, Response
88

99
from toggl_api import TogglProject, TogglWorkspace
10-
from toggl_api._utility import format_iso
1110
from toggl_api.meta import RequestMethod
1211
from toggl_api.reports import (
1312
PaginatedResult,
@@ -16,6 +15,7 @@
1615
ReportFormats,
1716
_validate_extension,
1817
)
18+
from toggl_api.utility import format_iso
1919

2020
from ._async_endpoint import TogglAsyncEndpoint
2121

src/toggl_api/asyncio/_async_tracker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from toggl_api import TogglTracker, TrackerBody
1414
from toggl_api._exceptions import DateTimeError, NamingError
1515
from toggl_api._tracker import BulkEditParameter, Edits
16-
from toggl_api._utility import format_iso, get_timestamp
1716
from toggl_api.meta import RequestMethod
17+
from toggl_api.utility import format_iso, get_timestamp
1818

1919
from ._async_endpoint import TogglAsyncCachedEndpoint
2020

src/toggl_api/asyncio/_async_workspace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from sqlalchemy.ext.asyncio import AsyncSession
1313

1414
from toggl_api import DateTimeError, TogglWorkspace
15-
from toggl_api._utility import get_timestamp
1615
from toggl_api.meta import RequestMethod
16+
from toggl_api.utility import get_timestamp
1717

1818
from ._async_endpoint import TogglAsyncCachedEndpoint
1919

src/toggl_api/meta/cache/_json_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from typing import TYPE_CHECKING, Any, Final, Generic, TypeVar, cast
1313

1414
from toggl_api.__about__ import __version__
15-
from toggl_api._utility import parse_iso
1615
from toggl_api.models import (
1716
TogglClass,
1817
TogglClient,
@@ -22,6 +21,7 @@
2221
TogglWorkspace,
2322
as_dict_custom,
2423
)
24+
from toggl_api.utility import parse_iso
2525

2626
from ._base_cache import Comparison, TogglCache, TogglQuery
2727

0 commit comments

Comments
 (0)