Skip to content

Commit a758fb2

Browse files
committed
Prepare initial release
1 parent 91205d8 commit a758fb2

9 files changed

Lines changed: 88 additions & 22 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This workflow will upload a Python Package to PyPI when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
release-build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.x"
28+
29+
- name: Build release distributions
30+
run: |
31+
32+
python -m pip install build
33+
python -m build
34+
35+
- name: Upload distributions
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: release-dists
39+
path: dist/
40+
41+
pypi-publish:
42+
runs-on: ubuntu-latest
43+
needs:
44+
- release-build
45+
permissions:
46+
# IMPORTANT: this permission is mandatory for trusted publishing
47+
id-token: write
48+
49+
# Dedicated environments with protections for publishing are strongly recommended.
50+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
51+
environment:
52+
name: pypi
53+
url: https://pypi.org/p/kitchenowl-python
54+
55+
steps:
56+
- name: Retrieve release distributions
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: release-dists
60+
path: dist/
61+
62+
- name: Publish release distributions to PyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
with:
65+
packages-dir: dist/

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## v0.0.1
4+
5+
- Initial release

LICENSE

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

3-
Copyright (c) 2024 super-qua
3+
Copyright (c) 2024 super-qua, Tom Bursch
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ A simple wrapper around the KitchenOwl API.
33

44
This is a small python package to be used as a wrapper for the KitchenOwl API in python.
55

6-
Currently there is only support for managing shopping list items.
7-
8-
## Low Maintentance Project
9-
This project is a low maintenance project. The scope is purposefully kept narrow and I am not looking to extend this beyond its current scope.
10-
For this reason, issues and discussions are not activated for this project. Feel free to fork the project in case you feel like a functionality is missing.
6+
Currently, there is only support for managing shopping list items.
117

128
## Installation
139

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ readme = "README.md"
55
keywords = ["kitchenowl"]
66
version = "0.0.1"
77
authors = [
8+
{name = "Tom Bursch", email = "tom@kitchenowl.org"},
89
{name = "super-qua"},
9-
{name = "Tom Bursch", email = "tom@kitchenowl.org"}
1010
]
1111
license = {file = "LICENSE"}
1212
classifiers = [
13-
"Development Status :: 4 - Beta",
13+
"Development Status :: 3 - Alpha",
1414
"Programming Language :: Python"
1515
]
1616
dependencies = [
@@ -23,6 +23,7 @@ test = [
2323
"aioresponses == 0.7.6",
2424
"pytest == 8.2.2",
2525
"pytest-asyncio == 0.23.7",
26+
"pytest-cov==6.0.0",
2627
"syrupy == 4.6.1"
2728
]
2829
lint = [
@@ -33,6 +34,7 @@ lint = [
3334
Homepage = "https://kitchenowl.org"
3435
Repository = "https://github.com/tombursch/kitchenowl-python"
3536
Issues = "https://github.com/TomBursch/kitchenowl/issues"
37+
Changelog = "https://github.com/tombursch/kitchenowl-python/blob/main/CHANGELOG.md"
3638

3739

3840
[tool.pytest.ini_options]

src/kitchenowl_python/exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
class KitchenOwlException(Exception):
55
"""Raised when a general exception occours."""
66

7+
78
class KitchenOwlRequestException(KitchenOwlException):
89
"""Raised on a bad request to the KitchenOwl instance."""
910

11+
1012
class KitchenOwlAuthException(KitchenOwlException):
1113
"""Raised when the authentication token is not valid."""

src/kitchenowl_python/kitchenowl.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ async def _head(self, path: str) -> bool:
115115
async def _delete(self, path: str, json_data: dict) -> bool:
116116
"""Perform a DELETE request to the KitchenOwl instance."""
117117

118-
return await self._request(
119-
METH_DELETE, path=path, json_data=json_data, return_json=False
120-
)
118+
return await self._request(METH_DELETE, path=path, json_data=json_data, return_json=False)
121119

122120
async def test_connection(self) -> bool:
123121
"""Test the kitchenowl token by performing HEAD on the user endpoint.
@@ -184,9 +182,7 @@ async def get_shoppinglists(self, household_id) -> KitchenOwlShoppingListsRespon
184182
await self._get(f"api/household/{household_id}/shoppinglist")
185183
)
186184

187-
async def get_shoppinglist_items(
188-
self, list_id: int
189-
) -> KitchenOwlShoppingListItemsResponse:
185+
async def get_shoppinglist_items(self, list_id: int) -> KitchenOwlShoppingListItemsResponse:
190186
"""Get all shopping list items on the list.
191187
192188
Args:
@@ -301,9 +297,7 @@ async def update_shoppinglist_item_description(
301297
json_data = {"description": item_description}
302298

303299
return KitchenOwlShoppingListItem(
304-
await self._post(
305-
f"api/shoppinglist/{list_id}/item/{item_id}", json_data, True
306-
)
300+
await self._post(f"api/shoppinglist/{list_id}/item/{item_id}", json_data, True)
307301
)
308302

309303
async def remove_shoppinglist_item(self, list_id: int, item_id: int) -> bool:

tests/data/defaults.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
"household_id": DEFAULT_HOUSEHOLD_ID,
2222
"id": DEFAULT_SHOPPINGLIST_ID_1,
2323
"name": f"list_{DEFAULT_SHOPPINGLIST_ID_1}",
24-
"updated_at": 0
24+
"updated_at": 0,
2525
}
2626

2727
DEFAULT_SHOPPINGLIST_RESPONSE_2 = {
2828
"created_at": 0,
2929
"household_id": DEFAULT_HOUSEHOLD_ID,
3030
"id": DEFAULT_SHOPPINGLIST_ID_2,
3131
"name": f"list_{DEFAULT_SHOPPINGLIST_ID_2}",
32-
"updated_at": 0
32+
"updated_at": 0,
3333
}
3434

3535
DEFAULT_USER_RESPONSE = {
@@ -41,7 +41,7 @@
4141
"owner": True,
4242
"photo": None,
4343
"updated_at": 0,
44-
"username": f"user {DEFAULT_USER_ID}"
44+
"username": f"user {DEFAULT_USER_ID}",
4545
}
4646

4747
DEFAULT_HOUSEHOLDS_RESPONSE = [
@@ -56,12 +56,11 @@
5656
"photo": None,
5757
"planner_feature": True,
5858
"updated_at": 0,
59-
"view_ordering": ["items","recipes"]
59+
"view_ordering": ["items", "recipes"],
6060
}
6161
]
6262

6363

64-
6564
DEFAULT_SHOPPINGLIST_ITEM_RESPONSE = {
6665
"category": {
6766
"created_at": 0,

tests/test_kitchenowl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def default_shoppinglists_response(
8989
"""Default items on the shopping list response."""
9090
return KitchenOwlShoppingListsResponse([default_shoppinglist, default_shoppinglist_2])
9191

92+
9293
@pytest.fixture
9394
def default_user_response() -> KitchenOwlUser:
9495
"""Default items on the shopping list response."""
@@ -250,6 +251,7 @@ async def test_connection_test(responses: aioresponses, kitchenowl_api: KitchenO
250251
actual = await kitchenowl_api.test_connection()
251252
assert actual is True
252253

254+
253255
async def test_get_user_snapshot(
254256
default_user_response: KitchenOwlUser,
255257
responses: aioresponses,
@@ -275,6 +277,7 @@ async def test_get_user_snapshot(
275277
json=None,
276278
)
277279

280+
278281
async def test_get_households_snapshot(
279282
default_households_response: KitchenOwlHouseholdsResponse,
280283
responses: aioresponses,

0 commit comments

Comments
 (0)