kitchenowl-python 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kitchenowl_python-0.0.1/LICENSE +21 -0
- kitchenowl_python-0.0.1/PKG-INFO +87 -0
- kitchenowl_python-0.0.1/README.md +39 -0
- kitchenowl_python-0.0.1/pyproject.toml +195 -0
- kitchenowl_python-0.0.1/setup.cfg +4 -0
- kitchenowl_python-0.0.1/src/kitchenowl_python/__init__.py +2 -0
- kitchenowl_python-0.0.1/src/kitchenowl_python/const.py +1 -0
- kitchenowl_python-0.0.1/src/kitchenowl_python/exceptions.py +13 -0
- kitchenowl_python-0.0.1/src/kitchenowl_python/kitchenowl.py +364 -0
- kitchenowl_python-0.0.1/src/kitchenowl_python/types.py +93 -0
- kitchenowl_python-0.0.1/src/kitchenowl_python.egg-info/PKG-INFO +87 -0
- kitchenowl_python-0.0.1/src/kitchenowl_python.egg-info/SOURCES.txt +14 -0
- kitchenowl_python-0.0.1/src/kitchenowl_python.egg-info/dependency_links.txt +1 -0
- kitchenowl_python-0.0.1/src/kitchenowl_python.egg-info/requires.txt +11 -0
- kitchenowl_python-0.0.1/src/kitchenowl_python.egg-info/top_level.txt +1 -0
- kitchenowl_python-0.0.1/tests/test_kitchenowl.py +547 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 super-qua, Tom Bursch
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: kitchenowl-python
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A python wrapper for the KitchenOwl API
|
|
5
|
+
Author: super-qua
|
|
6
|
+
Author-email: Tom Bursch <tom@kitchenowl.org>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2024 super-qua, Tom Bursch
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://kitchenowl.org
|
|
30
|
+
Project-URL: Repository, https://github.com/tombursch/kitchenowl-python
|
|
31
|
+
Project-URL: Issues, https://github.com/TomBursch/kitchenowl/issues
|
|
32
|
+
Project-URL: Changelog, https://github.com/tombursch/kitchenowl-python/blob/main/CHANGELOG.md
|
|
33
|
+
Keywords: kitchenowl
|
|
34
|
+
Classifier: Development Status :: 3 - Alpha
|
|
35
|
+
Classifier: Programming Language :: Python
|
|
36
|
+
Requires-Python: >=3.8
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
License-File: LICENSE
|
|
39
|
+
Requires-Dist: aiohttp==3.10.5
|
|
40
|
+
Provides-Extra: test
|
|
41
|
+
Requires-Dist: aioresponses==0.7.6; extra == "test"
|
|
42
|
+
Requires-Dist: pytest==8.2.2; extra == "test"
|
|
43
|
+
Requires-Dist: pytest-asyncio==0.23.7; extra == "test"
|
|
44
|
+
Requires-Dist: pytest-cov==6.0.0; extra == "test"
|
|
45
|
+
Requires-Dist: syrupy==4.6.1; extra == "test"
|
|
46
|
+
Provides-Extra: lint
|
|
47
|
+
Requires-Dist: ruff==0.6.1; extra == "lint"
|
|
48
|
+
|
|
49
|
+
# kitchenowl-python
|
|
50
|
+
A simple wrapper around the KitchenOwl API.
|
|
51
|
+
|
|
52
|
+
This is a small python package to be used as a wrapper for the KitchenOwl API in python.
|
|
53
|
+
|
|
54
|
+
Currently, there is only support for managing shopping list items.
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```shell
|
|
59
|
+
python -m venv .venv
|
|
60
|
+
source .venv/bin/activate
|
|
61
|
+
pip install -e .
|
|
62
|
+
```
|
|
63
|
+
Installs all required dependencies.
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from aiohttp import ClientSession
|
|
69
|
+
from kitchenowl_python.kitchenowl import KitchenOwl
|
|
70
|
+
|
|
71
|
+
async with ClientSession() as session:
|
|
72
|
+
kitchenowl = KitchenOwl(session=session, url=url, token=token)
|
|
73
|
+
await kitchenowl.test_connection()
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Development
|
|
78
|
+
|
|
79
|
+
### Run tests
|
|
80
|
+
|
|
81
|
+
```shell
|
|
82
|
+
source .venv/bin/activate
|
|
83
|
+
pip install -e .\[test\]
|
|
84
|
+
pytest .
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# kitchenowl-python
|
|
2
|
+
A simple wrapper around the KitchenOwl API.
|
|
3
|
+
|
|
4
|
+
This is a small python package to be used as a wrapper for the KitchenOwl API in python.
|
|
5
|
+
|
|
6
|
+
Currently, there is only support for managing shopping list items.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```shell
|
|
11
|
+
python -m venv .venv
|
|
12
|
+
source .venv/bin/activate
|
|
13
|
+
pip install -e .
|
|
14
|
+
```
|
|
15
|
+
Installs all required dependencies.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from aiohttp import ClientSession
|
|
21
|
+
from kitchenowl_python.kitchenowl import KitchenOwl
|
|
22
|
+
|
|
23
|
+
async with ClientSession() as session:
|
|
24
|
+
kitchenowl = KitchenOwl(session=session, url=url, token=token)
|
|
25
|
+
await kitchenowl.test_connection()
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
### Run tests
|
|
32
|
+
|
|
33
|
+
```shell
|
|
34
|
+
source .venv/bin/activate
|
|
35
|
+
pip install -e .\[test\]
|
|
36
|
+
pytest .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "kitchenowl-python"
|
|
3
|
+
description = "A python wrapper for the KitchenOwl API"
|
|
4
|
+
readme = "README.md"
|
|
5
|
+
keywords = ["kitchenowl"]
|
|
6
|
+
version = "0.0.1"
|
|
7
|
+
authors = [
|
|
8
|
+
{name = "Tom Bursch", email = "tom@kitchenowl.org"},
|
|
9
|
+
{name = "super-qua"},
|
|
10
|
+
]
|
|
11
|
+
license = {file = "LICENSE"}
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"Programming Language :: Python"
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"aiohttp == 3.10.5"
|
|
18
|
+
]
|
|
19
|
+
requires-python = ">=3.8"
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
test = [
|
|
23
|
+
"aioresponses == 0.7.6",
|
|
24
|
+
"pytest == 8.2.2",
|
|
25
|
+
"pytest-asyncio == 0.23.7",
|
|
26
|
+
"pytest-cov==6.0.0",
|
|
27
|
+
"syrupy == 4.6.1"
|
|
28
|
+
]
|
|
29
|
+
lint = [
|
|
30
|
+
"ruff == 0.6.1"
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://kitchenowl.org"
|
|
35
|
+
Repository = "https://github.com/tombursch/kitchenowl-python"
|
|
36
|
+
Issues = "https://github.com/TomBursch/kitchenowl/issues"
|
|
37
|
+
Changelog = "https://github.com/tombursch/kitchenowl-python/blob/main/CHANGELOG.md"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
[tool.pytest.ini_options]
|
|
41
|
+
minversion = 6.0
|
|
42
|
+
pythonpath = "src"
|
|
43
|
+
asyncio_mode = "auto"
|
|
44
|
+
markers = [
|
|
45
|
+
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.ruff]
|
|
49
|
+
line-length = 100
|
|
50
|
+
indent-width = 4
|
|
51
|
+
|
|
52
|
+
[tool.ruff.format]
|
|
53
|
+
quote-style = "double"
|
|
54
|
+
indent-style = "space"
|
|
55
|
+
line-ending = "auto"
|
|
56
|
+
|
|
57
|
+
[tool.ruff.lint]
|
|
58
|
+
# linter rules copied from https://github.com/home-assistant/core/blob/dev/pyproject.toml
|
|
59
|
+
select = [
|
|
60
|
+
"A001", # Variable {name} is shadowing a Python builtin
|
|
61
|
+
"ASYNC210", # Async functions should not call blocking HTTP methods
|
|
62
|
+
"ASYNC220", # Async functions should not create subprocesses with blocking methods
|
|
63
|
+
"ASYNC221", # Async functions should not run processes with blocking methods
|
|
64
|
+
"ASYNC222", # Async functions should not wait on processes with blocking methods
|
|
65
|
+
"ASYNC230", # Async functions should not open files with blocking methods like open
|
|
66
|
+
"ASYNC251", # Async functions should not call time.sleep
|
|
67
|
+
"B002", # Python does not support the unary prefix increment
|
|
68
|
+
"B005", # Using .strip() with multi-character strings is misleading
|
|
69
|
+
"B007", # Loop control variable {name} not used within loop body
|
|
70
|
+
"B014", # Exception handler with duplicate exception
|
|
71
|
+
"B015", # Pointless comparison. Did you mean to assign a value? Otherwise, prepend assert or remove it.
|
|
72
|
+
"B017", # pytest.raises(BaseException) should be considered evil
|
|
73
|
+
"B018", # Found useless attribute access. Either assign it to a variable or remove it.
|
|
74
|
+
"B023", # Function definition does not bind loop variable {name}
|
|
75
|
+
"B026", # Star-arg unpacking after a keyword argument is strongly discouraged
|
|
76
|
+
"B032", # Possible unintentional type annotation (using :). Did you mean to assign (using =)?
|
|
77
|
+
"B904", # Use raise from to specify exception cause
|
|
78
|
+
"B905", # zip() without an explicit strict= parameter
|
|
79
|
+
"BLE",
|
|
80
|
+
"C", # complexity
|
|
81
|
+
"COM818", # Trailing comma on bare tuple prohibited
|
|
82
|
+
"D", # docstrings
|
|
83
|
+
"DTZ003", # Use datetime.now(tz=) instead of datetime.utcnow()
|
|
84
|
+
"DTZ004", # Use datetime.fromtimestamp(ts, tz=) instead of datetime.utcfromtimestamp(ts)
|
|
85
|
+
"E", # pycodestyle
|
|
86
|
+
"F", # pyflakes/autoflake
|
|
87
|
+
"FLY", # flynt
|
|
88
|
+
"FURB", # refurb
|
|
89
|
+
"G", # flake8-logging-format
|
|
90
|
+
"I", # isort
|
|
91
|
+
"INP", # flake8-no-pep420
|
|
92
|
+
"ISC", # flake8-implicit-str-concat
|
|
93
|
+
"ICN001", # import concentions; {name} should be imported as {asname}
|
|
94
|
+
"LOG", # flake8-logging
|
|
95
|
+
"N804", # First argument of a class method should be named cls
|
|
96
|
+
"N805", # First argument of a method should be named self
|
|
97
|
+
"N815", # Variable {name} in class scope should not be mixedCase
|
|
98
|
+
"PERF", # Perflint
|
|
99
|
+
"PGH", # pygrep-hooks
|
|
100
|
+
"PIE", # flake8-pie
|
|
101
|
+
"PL", # pylint
|
|
102
|
+
"PT", # flake8-pytest-style
|
|
103
|
+
"PYI", # flake8-pyi
|
|
104
|
+
"RET", # flake8-return
|
|
105
|
+
"RSE", # flake8-raise
|
|
106
|
+
"RUF005", # Consider iterable unpacking instead of concatenation
|
|
107
|
+
"RUF006", # Store a reference to the return value of asyncio.create_task
|
|
108
|
+
"RUF010", # Use explicit conversion flag
|
|
109
|
+
"RUF013", # PEP 484 prohibits implicit Optional
|
|
110
|
+
"RUF017", # Avoid quadratic list summation
|
|
111
|
+
"RUF018", # Avoid assignment expressions in assert statements
|
|
112
|
+
"RUF019", # Unnecessary key check before dictionary access
|
|
113
|
+
# "RUF100", # Unused `noqa` directive; temporarily every now and then to clean them up
|
|
114
|
+
"S102", # Use of exec detected
|
|
115
|
+
"S103", # bad-file-permissions
|
|
116
|
+
"S108", # hardcoded-temp-file
|
|
117
|
+
"S306", # suspicious-mktemp-usage
|
|
118
|
+
"S307", # suspicious-eval-usage
|
|
119
|
+
"S313", # suspicious-xmlc-element-tree-usage
|
|
120
|
+
"S314", # suspicious-xml-element-tree-usage
|
|
121
|
+
"S315", # suspicious-xml-expat-reader-usage
|
|
122
|
+
"S316", # suspicious-xml-expat-builder-usage
|
|
123
|
+
"S317", # suspicious-xml-sax-usage
|
|
124
|
+
"S318", # suspicious-xml-mini-dom-usage
|
|
125
|
+
"S319", # suspicious-xml-pull-dom-usage
|
|
126
|
+
"S320", # suspicious-xmle-tree-usage
|
|
127
|
+
"S601", # paramiko-call
|
|
128
|
+
"S602", # subprocess-popen-with-shell-equals-true
|
|
129
|
+
"S604", # call-with-shell-equals-true
|
|
130
|
+
"S608", # hardcoded-sql-expression
|
|
131
|
+
"S609", # unix-command-wildcard-injection
|
|
132
|
+
"SIM", # flake8-simplify
|
|
133
|
+
"SLF", # flake8-self
|
|
134
|
+
"SLOT", # flake8-slots
|
|
135
|
+
"T100", # Trace found: {name} used
|
|
136
|
+
"T20", # flake8-print
|
|
137
|
+
"TID251", # Banned imports
|
|
138
|
+
"TRY", # tryceratops
|
|
139
|
+
"UP", # pyupgrade
|
|
140
|
+
"W", # pycodestyle
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
ignore = [
|
|
144
|
+
"D202", # No blank lines allowed after function docstring
|
|
145
|
+
"D203", # 1 blank line required before class docstring
|
|
146
|
+
"D213", # Multi-line docstring summary should start at the second line
|
|
147
|
+
"D406", # Section name should end with a newline
|
|
148
|
+
"D407", # Section name underlining
|
|
149
|
+
"E501", # line too long
|
|
150
|
+
|
|
151
|
+
"PLC1901", # {existing} can be simplified to {replacement} as an empty string is falsey; too many false positives
|
|
152
|
+
"PLR0911", # Too many return statements ({returns} > {max_returns})
|
|
153
|
+
"PLR0912", # Too many branches ({branches} > {max_branches})
|
|
154
|
+
"PLR0913", # Too many arguments to function call ({c_args} > {max_args})
|
|
155
|
+
"PLR0915", # Too many statements ({statements} > {max_statements})
|
|
156
|
+
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
|
|
157
|
+
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
|
|
158
|
+
"PT004", # Fixture {fixture} does not return anything, add leading underscore
|
|
159
|
+
"PT011", # pytest.raises({exception}) is too broad, set the `match` parameter or use a more specific exception
|
|
160
|
+
"PT018", # Assertion should be broken down into multiple parts
|
|
161
|
+
"RUF001", # String contains ambiguous unicode character.
|
|
162
|
+
"RUF002", # Docstring contains ambiguous unicode character.
|
|
163
|
+
"RUF003", # Comment contains ambiguous unicode character.
|
|
164
|
+
"RUF015", # Prefer next(...) over single element slice
|
|
165
|
+
"SIM102", # Use a single if statement instead of nested if statements
|
|
166
|
+
"SIM103", # Return the condition {condition} directly
|
|
167
|
+
"SIM108", # Use ternary operator {contents} instead of if-else-block
|
|
168
|
+
"SIM115", # Use context handler for opening files
|
|
169
|
+
"TRY003", # Avoid specifying long messages outside the exception class
|
|
170
|
+
"TRY400", # Use `logging.exception` instead of `logging.error`
|
|
171
|
+
# Ignored due to performance: https://github.com/charliermarsh/ruff/issues/2923
|
|
172
|
+
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
|
|
173
|
+
|
|
174
|
+
# May conflict with the formatter, https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
|
|
175
|
+
"W191",
|
|
176
|
+
"E111",
|
|
177
|
+
"E114",
|
|
178
|
+
"E117",
|
|
179
|
+
"D206",
|
|
180
|
+
"D300",
|
|
181
|
+
"Q",
|
|
182
|
+
"COM812",
|
|
183
|
+
"COM819",
|
|
184
|
+
"ISC001",
|
|
185
|
+
|
|
186
|
+
# Disabled because ruff does not understand type of __all__ generated by a function
|
|
187
|
+
"PLE0605",
|
|
188
|
+
|
|
189
|
+
# temporarily disabled
|
|
190
|
+
"RET503",
|
|
191
|
+
"TRY301"
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
[tool.ruff.lint.pydocstyle]
|
|
195
|
+
convention = "google"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Constants for the KitchenOwl API."""
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""KitchenOwl exceptions."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class KitchenOwlException(Exception):
|
|
5
|
+
"""Raised when a general exception occours."""
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class KitchenOwlRequestException(KitchenOwlException):
|
|
9
|
+
"""Raised on a bad request to the KitchenOwl instance."""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class KitchenOwlAuthException(KitchenOwlException):
|
|
13
|
+
"""Raised when the authentication token is not valid."""
|