Skip to content

Commit 19ec555

Browse files
committed
chore(release): version 1.4.0
2 parents c8607dd + 2d6271a commit 19ec555

30 files changed

+465
-286
lines changed

docs/CHANGELOG.md

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

33
All notable changes to this project will be documented in this file.
44

5+
## [1.4.0] - 2024-11-11
6+
7+
### 🚀 Features
8+
9+
- *(exceptions)* Custom exceptions for commonly raised value errors
10+
- *(cache)* Custom missing parent error
11+
12+
### 🐛 Bug Fixes
13+
14+
- *(project)* Wrong hex code for gray color
15+
- *(utils)* Remove unnecessary import
16+
17+
### 🚜 Refactor
18+
19+
- *(tag)* Edit endpoint method accepts seperate name argument
20+
- *(tag)* Validate minimum name length
21+
- *(endpoint)* Use generics with base endpoint
22+
- *(cache)* User generic type with cache
23+
- *(endpoint)* Assign generics to all endpoints
24+
- *(endpoint)* Cache query method always returns list
25+
- *(typing)* Generics implementation
26+
- *(workspace)* Use custom exceptions for raised errors
27+
- *(user)* Use custom exceptions for raised errors
28+
- *(user)* Use custom exceptions for raised errors
29+
- *(tag)* Use custom exceptions for raised errors
30+
- *(project)* Use custom exceptions for raised errors
31+
- *(client)* Use custom exceptions for raised errors
32+
- *(models)* Use naming error instead of value error
33+
- *(cache)* Implement new error subclass
34+
35+
### 🕸 Deprecations
36+
37+
- *(tag)* Remove the internal usage of a modified name in a tag
38+
- *(trackers)* Change exception type in add endpoint method
39+
40+
### 📚 Documentation
41+
42+
- *(tag)* Update edit endpoint docstring
43+
- *(tag)* Improve delete endpoint docstring
44+
- *(tag)* Improve add endpoint method docstring
45+
- *(tag)* Improve endpoint class docstring
46+
- *(organization)* Use custom exceptions for raised errors docstring
47+
- *(exceptions)* Document new exception classes
48+
- *(mkdocs)* Enable symbols in table of contents
49+
- *(config)* Reconfigure headings
50+
51+
### 🧪 Testing
52+
53+
- *(tag)* Validate tag name length
54+
- *(conftest)* Rate limit trackers teardown
55+
- *(utility)* Make sure version is updated
56+
557
## [1.3.2] - 2024-11-05
658

759
### 🐛 Bug Fixes

docs/api-guide/cache.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
{% include "static/mermaid/cache.mmd" %}
55
```
66

7+
::: toggl_api.MissingParentError
8+
79
::: toggl_api.meta.cache.TogglCache
810

911
---

docs/api-guide/config.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Authentication
1+
## Authentication
22

33
::: toggl_api.config.AuthenticationError
44

@@ -9,9 +9,7 @@
99
> [!NOTE]
1010
> The [UserEndpoint](/toggl-api-wrapper/api-guide/tracker.html#toggl_api.modules.user.UserEndpoint) has a [verify_authentication](/toggl-api-wrapper/api-guide/tracker.html#toggl_api.modules.user.UserEndpoint.check_authentication) method for verifying authentication with the Toggl API.
1111
12-
---
13-
14-
# Default Workspace
12+
## Default Workspace
1513

1614
::: toggl_api.config.retrieve_workspace_id
1715

docs/api-guide/exceptions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
::: toggl_api.NamingError
2+
3+
::: toggl_api.DateTimeError

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ plugins:
133133
show_source: false
134134
show_signature_annotations: true
135135
show_symbol_type_heading: true
136+
show_symbol_type_toc: true
136137
- callouts
137138
- panzoom:
138139
full_screen: true

poetry.lock

Lines changed: 110 additions & 114 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "toggl-api-wrapper"
3-
version = "1.3.2"
3+
version = "1.4.0"
44
description = "Simple Toggl API wrapper for non-premium features."
55
authors = ["David Kasakaitis <[email protected]>"]
66
license = "MIT"
@@ -54,6 +54,7 @@ pytest-cov = "^5.0.0"
5454
pytest-replay = "^1.5.2"
5555
pytest-rerunfailures = "^14.0"
5656
pytest-dependency = "^0.6.0"
57+
tomli = "^2.0.2"
5758

5859
[tool.poetry.group.docs.dependencies]
5960
mkdocs = "^1.6.0"

scripts/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from toggl_api.tag import TagEndpoint
1717
from toggl_api.tracker import TrackerEndpoint
1818
from toggl_api.user import UserEndpoint
19-
from toggl_api.workspace import WorkspaceEndpoint
2019

2120

2221
def _path_cleanup(cache_path: Path) -> None:

tests/test_meta/test_cache.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
from pathlib import Path
99

1010
import pytest
11+
from sqlalchemy.util.langhelpers import MissingOr
1112

1213
from tests.conftest import EndPointTest
1314
from toggl_api.meta import CustomDecoder, CustomEncoder, JSONCache, RequestMethod
14-
from toggl_api.meta.cache.base_cache import Comparison, TogglQuery
15+
from toggl_api.meta.cache.base_cache import Comparison, MissingParentError, TogglQuery
1516
from toggl_api.meta.cache.json_cache import JSONSession
1617
from toggl_api.models.models import TogglTag, TogglTracker
1718
from toggl_api.user import UserEndpoint
@@ -87,7 +88,7 @@ def test_cache_path(meta_object):
8788

8889
@pytest.mark.unit
8990
def test_cache_parent(config_setup, get_sqlite_cache, get_workspace_id):
90-
assert get_sqlite_cache.parent is None
91+
assert get_sqlite_cache._parent is None # noqa: SLF001
9192
endpoint = EndPointTest(get_workspace_id, config_setup, get_sqlite_cache)
9293
assert endpoint.cache.parent == endpoint
9394

@@ -138,7 +139,8 @@ def test_encoder_json(model_data, tmp_path):
138139

139140

140141
@pytest.mark.unit
141-
def test_max_length(model_data, get_json_cache):
142+
def test_max_length(model_data, get_json_cache, tracker_object):
143+
tracker_object.cache = get_json_cache
142144
get_json_cache.session.data = []
143145
assert get_json_cache.session.max_length == 10000 # noqa: PLR2004
144146
get_json_cache.session.max_length = 10
@@ -234,11 +236,11 @@ def test_query_tag_distict(model_data, tracker_object, faker, number):
234236
def test_query_parent(tmp_path):
235237
cache = JSONCache(Path(tmp_path))
236238

237-
with pytest.raises(ValueError, match="Cannot load cache without parent!"):
239+
with pytest.raises(MissingParentError):
238240
cache.query()
239241

240242

241-
# FIX:: Flaky test that will fail occassionaly on windows testing.
243+
# FIX:: Flaky test that will fail occasionally on windows testing.
242244
@pytest.mark.unit
243245
@pytest.mark.flaky(rerun_except="AssertionError", reruns=3)
244246
def test_cache_sync(

tests/test_meta/test_sqlite.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from sqlalchemy.orm import Query, Session
1111

1212
from toggl_api.meta import RequestMethod
13-
from toggl_api.meta.cache.base_cache import Comparison, TogglQuery
13+
from toggl_api.meta.cache.base_cache import Comparison, MissingParentError, TogglQuery
1414
from toggl_api.meta.cache.sqlite_cache import SqliteCache
1515
from toggl_api.models import TogglTag, TogglTracker, TogglWorkspace
1616
from toggl_api.models._decorators import UTCDateTime # noqa: PLC2701
@@ -101,7 +101,7 @@ def test_add_entries_sqlite_parent(meta_object_sqlite, model_data):
101101
tracker = model_data["tracker"]
102102
meta_object_sqlite.cache.add_entries(tracker)
103103
meta_object_sqlite.cache.parent = None
104-
with pytest.raises(ValueError, match="Cannot load cache without parent set!"):
104+
with pytest.raises(MissingParentError):
105105
assert tracker in meta_object_sqlite.cache.load_cache()
106106

107107

@@ -135,7 +135,7 @@ def test_find_sqlite(meta_object_sqlite, model_data):
135135
@pytest.mark.unit
136136
def test_find_sqlite_parent(meta_object_sqlite):
137137
meta_object_sqlite.cache.parent = None
138-
with pytest.raises(ValueError, match="Cannot load cache without parent set!"):
138+
with pytest.raises(MissingParentError):
139139
meta_object_sqlite.cache.find_entry({"id": 5})
140140

141141

@@ -187,7 +187,7 @@ def test_query_sqlite(tracker_object_sqlite, model_data, faker):
187187
tracker_object_sqlite.cache.commit()
188188
assert tracker_object_sqlite.load_cache().count() == 11 # noqa: PLR2004
189189
assert tracker_object_sqlite.query(TogglQuery("name", tracker.name))[0] == tracker
190-
assert tracker_object_sqlite.query(TogglQuery("name", list(picked_names))).count() == total_picks
190+
assert tracker_object_sqlite.cache.query(TogglQuery("name", list(picked_names))).count() == total_picks
191191

192192

193193
@pytest.mark.unit
@@ -204,13 +204,13 @@ def test_query_sqlite_distinct(tracker_object_sqlite, model_data, faker):
204204
d["timestamp"] = datetime.now(timezone.utc)
205205
tracker_object_sqlite.save_cache(tracker.from_kwargs(**d), RequestMethod.GET)
206206

207-
assert tracker_object_sqlite.query(TogglQuery("name", name), distinct=True).count() == 1
207+
assert tracker_object_sqlite.cache.query(TogglQuery("name", name), distinct=True).count() == 1
208208

209209

210210
@pytest.mark.unit
211211
def test_query_sqlite_parent(meta_object_sqlite):
212212
meta_object_sqlite.cache.parent = None
213-
with pytest.raises(ValueError, match="Cannot load cache without parent set!"):
213+
with pytest.raises(MissingParentError):
214214
meta_object_sqlite.cache.find_entry({"id": 5})
215215

216216

0 commit comments

Comments
 (0)