Skip to content

Commit 21e51c8

Browse files
committed
Add type hints, tests and improve dev workflow
See CHANGELOG.md for more information.
1 parent 1c7ddb5 commit 21e51c8

11 files changed

Lines changed: 1009 additions & 372 deletions

File tree

CHANGELOG.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
> :warning: Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.
9+
10+
## [0.4]
11+
12+
### Added
13+
14+
- Provide type hints for all methods
15+
- All json responses are type hinted using nontotal TypedDicts
16+
- Use [black](https://github.com/psf/black),
17+
[isort](https://github.com/PyCQA/isort),
18+
[flakeheaven](https://github.com/flakeheaven/flakeheaven),
19+
[flake8-annotations](https://github.com/sco1/flake8-annotations),
20+
[flake8-docstrings](https://github.com/PyCQA/flake8-docstrings) and
21+
[mypy](https://github.com/python/mypy) to enforce code style and quality
22+
- Add tests using [nox](https://github.com/theacodes/nox), [pytest](https://github.com/pytest-dev/pytest) and [trycast](https://github.com/davidfstr/trycast)
23+
- `nox -s test` downloads a server binary and starts a preconfigured test server on port 30080
24+
- tests for plugin-related API endpoints are still missing
25+
26+
### Changed
27+
28+
- Renamed `gotify.gotify` to `gotify.Gotify` for conformity with naming conventions and to reduce ambiguity
29+
- Use a nested structure
30+
- Deprecated names are available via `__getattr__()`
31+
32+
### Removed
33+
34+
- Dropped Support for Python 3.8
35+
36+
## [0.3] - 2022-01-17
37+
38+
### Changed
39+
40+
- Remove read-only arguments
41+
42+
### Fixed
43+
44+
- Add missing return statement to `create_message()`
45+
46+
## [0.2.2] - 2022-01-14
47+
48+
## 0.2.1 - 2022-01-14
49+
50+
### Changed
51+
52+
- Format code with `black` with a line-length of 79
53+
- Use new style metadata for flit
54+
55+
### Fixed
56+
57+
- Fix broken `set_password()` method
58+
- Fix broken `delete_messages()` method
59+
60+
## [0.2] - 2021-08-04
61+
62+
### Changed
63+
64+
- Use a class-based interface (by @benjmarshall)
65+
66+
## [0.1.1] - 2021-05-29
67+
68+
### Changed
69+
70+
- Use config() with kwargs instead of args
71+
72+
## [0.1] - 2021-05-28
73+
74+
### Added
75+
76+
- Initial version
77+
78+
[unreleased]: https://github.com/d-k-bo/python-gotify/compare/v1.0.0...HEAD
79+
[0.4]: https://github.com/d-k-bo/python-gotify/compare/1c7ddb5393957169248cf917be8efe4397b309e3...v0.4
80+
[0.3]: https://github.com/d-k-bo/python-gotify/compare/dd5c4cbe8ca226e1c93482aff3dc74c88f345390...1c7ddb5393957169248cf917be8efe4397b309e3
81+
[0.2.2]: https://github.com/d-k-bo/python-gotify/compare/36d8a5a10ab6cb6ef4f577a13a5db2a4ac3f5825...dd5c4cbe8ca226e1c93482aff3dc74c88f345390
82+
[0.2]: https://github.com/d-k-bo/python-gotify/compare/6d8ea49cebd87e3ee65d8da49953fd0415e0b697...36d8a5a10ab6cb6ef4f577a13a5db2a4ac3f5825
83+
[0.1.1]: https://github.com/d-k-bo/python-gotify/compare/v0.1.0...6d8ea49cebd87e3ee65d8da49953fd0415e0b697
84+
[0.1]: https://github.com/d-k-bo/python-gotify/commit/0b573b3e7be1e828f8b9e12c6fd09298f7bc365c

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ pip install gotify
1515
To send messages:
1616

1717
```python
18-
import gotify
18+
from gotify import Gotify
1919

20-
gotify_obj = gotify.gotify(
20+
gotify = Gotify(
2121
base_url="https://gotify.example.com",
2222
app_token="AsWIJhvlHb.xgKe",
2323
)
2424

25-
gotify_obj.create_message(
25+
gotify = Gotify(
2626
"Hello you wonderful people!",
2727
title="Hello World",
2828
priority=0,
@@ -34,29 +34,27 @@ gotify_obj.create_message(
3434
You can also manage things like applications:
3535

3636
```python
37-
import gotify
37+
from gotify import Gotify
3838

39-
gotify_obj = gotify.gotify(
39+
gotify = Gotify(
4040
base_url="https://gotify.example.com",
4141
client_token="CoLwHBCAr8z2MMA",
4242
)
4343

44-
app = gotify_obj.create_application("foobar", description="test application")
44+
app = gotify.create_application("foobar", description="test application")
4545

4646
print("Created new application:", app)
4747
```
4848

4949
would result in
5050

5151
```plain
52-
Created new application: {'id': 42, 'token': 'ArHD_yGYf63-A13', 'name': 'fooba
53-
r', 'description': 'test application', 'internal': False, 'image': 'static/def
54-
aultapp.png'}
52+
Created new application: {'id': 42, 'token': 'ArHD_yGYf63-A13', 'name': 'foobar', 'description': 'test application', 'internal': False, 'image': 'static/defaultapp.png'}
5553
```
5654

5755
**Note:** For most things you need to create a new client and set `client_token` accordingly.
5856

59-
This module tries to implement every endpoint of the gotify API as an instance method of the `gotify` class. If you use only one gotify instance, you can use the module-level functions instead, which then use an internal `gotify` object.
57+
This module tries to implement every endpoint of the gotify API as an instance method of the `Gotify` class.
6058

6159
More details about the capabilities of gotify's API can be found in its [API documentation](https://gotify.net/api-docs).
6260

0 commit comments

Comments
 (0)