groveyard 0.1.0__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.

Potentially problematic release.


This version of groveyard might be problematic. Click here for more details.

Files changed (31) hide show
  1. groveyard-0.1.0/LICENSE +21 -0
  2. groveyard-0.1.0/PKG-INFO +194 -0
  3. groveyard-0.1.0/README.md +161 -0
  4. groveyard-0.1.0/pyproject.toml +139 -0
  5. groveyard-0.1.0/pyproject.toml.orig +125 -0
  6. groveyard-0.1.0/src/groveyard/__init__.py +115 -0
  7. groveyard-0.1.0/src/groveyard/board.py +477 -0
  8. groveyard-0.1.0/src/groveyard/devices/__init__.py +47 -0
  9. groveyard-0.1.0/src/groveyard/devices/base.py +455 -0
  10. groveyard-0.1.0/src/groveyard/devices/button.py +56 -0
  11. groveyard-0.1.0/src/groveyard/devices/buzzer.py +109 -0
  12. groveyard-0.1.0/src/groveyard/devices/dht.py +160 -0
  13. groveyard-0.1.0/src/groveyard/devices/led.py +185 -0
  14. groveyard-0.1.0/src/groveyard/devices/light_sensor.py +99 -0
  15. groveyard-0.1.0/src/groveyard/devices/potentiometer.py +132 -0
  16. groveyard-0.1.0/src/groveyard/devices/relay.py +77 -0
  17. groveyard-0.1.0/src/groveyard/devices/rgb_lcd.py +516 -0
  18. groveyard-0.1.0/src/groveyard/devices/sound_sensor.py +112 -0
  19. groveyard-0.1.0/src/groveyard/devices/ultrasonic.py +163 -0
  20. groveyard-0.1.0/src/groveyard/errors.py +75 -0
  21. groveyard-0.1.0/src/groveyard/ports.py +82 -0
  22. groveyard-0.1.0/src/groveyard/protocol/__init__.py +22 -0
  23. groveyard-0.1.0/src/groveyard/protocol/bridge.py +441 -0
  24. groveyard-0.1.0/src/groveyard/protocol/commands.py +147 -0
  25. groveyard-0.1.0/src/groveyard/py.typed +0 -0
  26. groveyard-0.1.0/src/groveyard/testing/__init__.py +5 -0
  27. groveyard-0.1.0/src/groveyard/testing/firmware.py +210 -0
  28. groveyard-0.1.0/src/groveyard/transport/__init__.py +27 -0
  29. groveyard-0.1.0/src/groveyard/transport/base.py +253 -0
  30. groveyard-0.1.0/src/groveyard/transport/fake.py +387 -0
  31. groveyard-0.1.0/src/groveyard/transport/i2c.py +258 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sasha Chistyh
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,194 @@
1
+ Metadata-Version: 2.4
2
+ Name: groveyard
3
+ Version: 0.1.0
4
+ Summary: A modern, fully typed async Python library for GrovePi+ sensors and actuators on a Raspberry Pi
5
+ Keywords: grovepi,grove,raspberry-pi,i2c,iot,asyncio,async,sensors,hardware,embedded
6
+ Author: Sasha Chistyh
7
+ Author-email: Sasha Chistyh <sashachistyh@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Home Automation
13
+ Classifier: Topic :: Software Development :: Embedded Systems
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Classifier: Topic :: System :: Hardware
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Framework :: AsyncIO
21
+ Classifier: Typing :: Typed
22
+ Requires-Dist: smbus2>=0.4 ; extra == 'hardware'
23
+ Maintainer: Sasha Chistyh
24
+ Maintainer-email: Sasha Chistyh <sashachistyh@gmail.com>
25
+ Requires-Python: >=3.12
26
+ Project-URL: Homepage, https://quantumwaffy.github.io/groveyard/
27
+ Project-URL: Documentation, https://quantumwaffy.github.io/groveyard/
28
+ Project-URL: Repository, https://github.com/quantumwaffy/groveyard
29
+ Project-URL: Issues, https://github.com/quantumwaffy/groveyard/issues
30
+ Project-URL: Changelog, https://quantumwaffy.github.io/groveyard/changelog/
31
+ Provides-Extra: hardware
32
+ Description-Content-Type: text/markdown
33
+
34
+ <div align="center">
35
+
36
+ # groveyard
37
+
38
+ **A modern, fully typed async Python library for GrovePi+ sensors and actuators on a Raspberry Pi.**
39
+
40
+ [![PyPI](https://img.shields.io/pypi/v/groveyard?color=2e7d32)](https://pypi.org/project/groveyard/)
41
+ [![Python versions](https://img.shields.io/pypi/pyversions/groveyard)](https://pypi.org/project/groveyard/)
42
+ [![CI](https://github.com/quantumwaffy/groveyard/actions/workflows/ci.yml/badge.svg)](https://github.com/quantumwaffy/groveyard/actions/workflows/ci.yml)
43
+ [![Docs](https://img.shields.io/badge/docs-quantumwaffy.github.io%2Fgroveyard-2e7d32)](https://quantumwaffy.github.io/groveyard/)
44
+ [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
45
+ [![Typed](https://img.shields.io/badge/typing-ty--clean-2e7d32)](https://quantumwaffy.github.io/groveyard/architecture/)
46
+
47
+ [**Documentation**](https://quantumwaffy.github.io/groveyard/) ·
48
+ [Quickstart](https://quantumwaffy.github.io/groveyard/getting-started/quickstart/) ·
49
+ [Architecture](https://quantumwaffy.github.io/groveyard/architecture/) ·
50
+ [API reference](https://quantumwaffy.github.io/groveyard/api/) ·
51
+ [Contributing](CONTRIBUTING.md)
52
+
53
+ </div>
54
+
55
+ ---
56
+
57
+ > [!WARNING]
58
+ > **Not yet tested on real hardware.** Everything here is verified against the
59
+ > in-memory [`FakeTransport`](https://quantumwaffy.github.io/groveyard/guides/testing/),
60
+ > not a physical GrovePi+ board. If you can try it on real hardware, feedback
61
+ > and contributions are very welcome —
62
+ > [open an issue](https://github.com/quantumwaffy/groveyard/issues) or a PR.
63
+
64
+ Many concurrent tasks can share one I2C bus and one stateful device without
65
+ stepping on each other: the bus is serialised by a single lock, and each device
66
+ owns a second lock that makes a multi-step operation atomic. Nothing blocks the
67
+ event loop.
68
+
69
+ ```python
70
+ import asyncio
71
+
72
+ from groveyard import AnalogPort, Board, DigitalPort, Led, LightSensor
73
+
74
+
75
+ async def main() -> None:
76
+ async with Board.on_i2c() as board:
77
+ sensor = LightSensor(board, AnalogPort.A0)
78
+ led = Led(board, DigitalPort.D4)
79
+
80
+ if await sensor.read_raw() < 300:
81
+ await led.set_brightness(0.6)
82
+
83
+
84
+ asyncio.run(main())
85
+ ```
86
+
87
+ ## Install
88
+
89
+ ```bash
90
+ pip install groveyard # develop and test anywhere
91
+ pip install groveyard[hardware] # on the Pi: adds smbus2
92
+ ```
93
+
94
+ Python 3.12+. `smbus2` is the only runtime dependency, and only on the Pi — it
95
+ lives behind the transport abstraction, so nothing imports it off-device. See
96
+ [Installation](https://quantumwaffy.github.io/groveyard/getting-started/installation/)
97
+ for the full picture.
98
+
99
+ ## Supported modules
100
+
101
+ | Class | Port | Highlights |
102
+ |---|---|---|
103
+ | `Button` | digital in | `is_pressed()` |
104
+ | `LightSensor` | analog in | raw counts, ratio, `read_resistance_kohm()` |
105
+ | `SoundSensor` | analog in | raw counts plus an averaging window |
106
+ | `Potentiometer` | analog in | ratio, `read_voltage()`, `read_degrees()` |
107
+ | `Led` | digital / PWM out | on/off plus `set_brightness(0.0..1.0)` |
108
+ | `Buzzer` | digital out | on/off plus cancellation-safe `beep(seconds)` |
109
+ | `Relay` | digital out | `close_circuit()` / `open_circuit()`, fail-safe |
110
+ | `Dht` | digital special | `DhtReading(temperature_celsius, humidity_percent)` |
111
+ | `Ultrasonic` | digital special | distance in cm, `None` when nothing is in range |
112
+ | `RgbLcd` | native I2C | 16×2 text plus RGB backlight |
113
+
114
+ Every analog driver keeps the raw `0..1023` reading reachable; unit conversions
115
+ are convenience on top, never a replacement. Full details:
116
+ [API reference](https://quantumwaffy.github.io/groveyard/api/).
117
+
118
+ ## Concurrency, in one paragraph
119
+
120
+ Two hazards, two locks: a single bus lock serialises every I2C transaction
121
+ (bridged or native-I2C), and each device owns a second lock that makes a
122
+ multi-step operation on *that* device atomic. Two tasks on different devices
123
+ run concurrently; two tasks on the same device serialise automatically. Locks
124
+ are always taken **device → bus**, always with `async with`, and actuators
125
+ fail safe to *off* on close, disconnect, or a crash — even under cancellation.
126
+
127
+ ```python
128
+ async with Board.on_i2c() as board:
129
+ lcd = RgbLcd(board)
130
+ ranger = Ultrasonic(board, DigitalPort.D5)
131
+ async with asyncio.TaskGroup() as tasks: # safe: different devices
132
+ tasks.create_task(lcd.write_lines("scanning", "..."))
133
+ tasks.create_task(ranger.read_distance_cm())
134
+ ```
135
+
136
+ Full write-up, with sequence diagrams:
137
+ [Concurrency model](https://quantumwaffy.github.io/groveyard/architecture/concurrency/).
138
+
139
+ ## Testing without a Raspberry Pi
140
+
141
+ The library ships its own test doubles, so applications can be tested in CI:
142
+
143
+ ```python
144
+ from groveyard import Board, DigitalPort, Button, FakeTransport
145
+ from groveyard.testing import FakeBridgeFirmware
146
+
147
+ firmware = FakeBridgeFirmware()
148
+ firmware.digital_inputs[DigitalPort.D3] = 1
149
+
150
+ async with Board(FakeTransport(responder=firmware)) as board:
151
+ assert await Button(board, DigitalPort.D3).is_pressed()
152
+ ```
153
+
154
+ The fake records every bus event with the id of the transaction it belongs to,
155
+ and records requested delays instead of sleeping — so timing and atomicity are
156
+ asserted, not waited for. See
157
+ [Testing without hardware](https://quantumwaffy.github.io/groveyard/guides/testing/).
158
+
159
+ ## Errors
160
+
161
+ Everything derives from `GroveyardError`: `TransportError` (the bus failed),
162
+ `ProtocolError` (malformed reply), `DeviceNotReadyError` (the board answered
163
+ "not ready" on every attempt), `BoardError` (`NotConnectedError`,
164
+ `PortInUseError`) and `DeviceError` (`DeviceClosedError`). Out-of-range
165
+ arguments are caller bugs and raise plain `ValueError`. See
166
+ [Errors](https://quantumwaffy.github.io/groveyard/api/errors/).
167
+
168
+ ## Architecture, in one picture
169
+
170
+ ```mermaid
171
+ flowchart LR
172
+ Devices["Devices<br/><small>Button, Led, Dht, RgbLcd, …</small>"]
173
+ Board["Board<br/><small>lifecycle, ports, pin-mode cache</small>"]
174
+ Protocol["Protocol<br/><small>0x04 command encoding</small>"]
175
+ Transport["Transport<br/><small>bus handle + the one bus lock</small>"]
176
+
177
+ Devices --> Board --> Protocol --> Transport
178
+ ```
179
+
180
+ Each layer depends only on the one below it and on an abstraction, never a
181
+ concrete class — adding a driver means adding a class, never editing a core
182
+ layer. Full tour, with class diagrams and a traced example call:
183
+ [Layers overview](https://quantumwaffy.github.io/groveyard/architecture/).
184
+
185
+ ## Contributing
186
+
187
+ Issues and PRs are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) for the
188
+ development setup, the four required gates, and a worked walkthrough of
189
+ adding a new driver. [CHANGELOG.md](CHANGELOG.md) tracks releases;
190
+ [SECURITY.md](SECURITY.md) covers vulnerability reporting.
191
+
192
+ ## Licence
193
+
194
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,161 @@
1
+ <div align="center">
2
+
3
+ # groveyard
4
+
5
+ **A modern, fully typed async Python library for GrovePi+ sensors and actuators on a Raspberry Pi.**
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/groveyard?color=2e7d32)](https://pypi.org/project/groveyard/)
8
+ [![Python versions](https://img.shields.io/pypi/pyversions/groveyard)](https://pypi.org/project/groveyard/)
9
+ [![CI](https://github.com/quantumwaffy/groveyard/actions/workflows/ci.yml/badge.svg)](https://github.com/quantumwaffy/groveyard/actions/workflows/ci.yml)
10
+ [![Docs](https://img.shields.io/badge/docs-quantumwaffy.github.io%2Fgroveyard-2e7d32)](https://quantumwaffy.github.io/groveyard/)
11
+ [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
12
+ [![Typed](https://img.shields.io/badge/typing-ty--clean-2e7d32)](https://quantumwaffy.github.io/groveyard/architecture/)
13
+
14
+ [**Documentation**](https://quantumwaffy.github.io/groveyard/) ·
15
+ [Quickstart](https://quantumwaffy.github.io/groveyard/getting-started/quickstart/) ·
16
+ [Architecture](https://quantumwaffy.github.io/groveyard/architecture/) ·
17
+ [API reference](https://quantumwaffy.github.io/groveyard/api/) ·
18
+ [Contributing](CONTRIBUTING.md)
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ > [!WARNING]
25
+ > **Not yet tested on real hardware.** Everything here is verified against the
26
+ > in-memory [`FakeTransport`](https://quantumwaffy.github.io/groveyard/guides/testing/),
27
+ > not a physical GrovePi+ board. If you can try it on real hardware, feedback
28
+ > and contributions are very welcome —
29
+ > [open an issue](https://github.com/quantumwaffy/groveyard/issues) or a PR.
30
+
31
+ Many concurrent tasks can share one I2C bus and one stateful device without
32
+ stepping on each other: the bus is serialised by a single lock, and each device
33
+ owns a second lock that makes a multi-step operation atomic. Nothing blocks the
34
+ event loop.
35
+
36
+ ```python
37
+ import asyncio
38
+
39
+ from groveyard import AnalogPort, Board, DigitalPort, Led, LightSensor
40
+
41
+
42
+ async def main() -> None:
43
+ async with Board.on_i2c() as board:
44
+ sensor = LightSensor(board, AnalogPort.A0)
45
+ led = Led(board, DigitalPort.D4)
46
+
47
+ if await sensor.read_raw() < 300:
48
+ await led.set_brightness(0.6)
49
+
50
+
51
+ asyncio.run(main())
52
+ ```
53
+
54
+ ## Install
55
+
56
+ ```bash
57
+ pip install groveyard # develop and test anywhere
58
+ pip install groveyard[hardware] # on the Pi: adds smbus2
59
+ ```
60
+
61
+ Python 3.12+. `smbus2` is the only runtime dependency, and only on the Pi — it
62
+ lives behind the transport abstraction, so nothing imports it off-device. See
63
+ [Installation](https://quantumwaffy.github.io/groveyard/getting-started/installation/)
64
+ for the full picture.
65
+
66
+ ## Supported modules
67
+
68
+ | Class | Port | Highlights |
69
+ |---|---|---|
70
+ | `Button` | digital in | `is_pressed()` |
71
+ | `LightSensor` | analog in | raw counts, ratio, `read_resistance_kohm()` |
72
+ | `SoundSensor` | analog in | raw counts plus an averaging window |
73
+ | `Potentiometer` | analog in | ratio, `read_voltage()`, `read_degrees()` |
74
+ | `Led` | digital / PWM out | on/off plus `set_brightness(0.0..1.0)` |
75
+ | `Buzzer` | digital out | on/off plus cancellation-safe `beep(seconds)` |
76
+ | `Relay` | digital out | `close_circuit()` / `open_circuit()`, fail-safe |
77
+ | `Dht` | digital special | `DhtReading(temperature_celsius, humidity_percent)` |
78
+ | `Ultrasonic` | digital special | distance in cm, `None` when nothing is in range |
79
+ | `RgbLcd` | native I2C | 16×2 text plus RGB backlight |
80
+
81
+ Every analog driver keeps the raw `0..1023` reading reachable; unit conversions
82
+ are convenience on top, never a replacement. Full details:
83
+ [API reference](https://quantumwaffy.github.io/groveyard/api/).
84
+
85
+ ## Concurrency, in one paragraph
86
+
87
+ Two hazards, two locks: a single bus lock serialises every I2C transaction
88
+ (bridged or native-I2C), and each device owns a second lock that makes a
89
+ multi-step operation on *that* device atomic. Two tasks on different devices
90
+ run concurrently; two tasks on the same device serialise automatically. Locks
91
+ are always taken **device → bus**, always with `async with`, and actuators
92
+ fail safe to *off* on close, disconnect, or a crash — even under cancellation.
93
+
94
+ ```python
95
+ async with Board.on_i2c() as board:
96
+ lcd = RgbLcd(board)
97
+ ranger = Ultrasonic(board, DigitalPort.D5)
98
+ async with asyncio.TaskGroup() as tasks: # safe: different devices
99
+ tasks.create_task(lcd.write_lines("scanning", "..."))
100
+ tasks.create_task(ranger.read_distance_cm())
101
+ ```
102
+
103
+ Full write-up, with sequence diagrams:
104
+ [Concurrency model](https://quantumwaffy.github.io/groveyard/architecture/concurrency/).
105
+
106
+ ## Testing without a Raspberry Pi
107
+
108
+ The library ships its own test doubles, so applications can be tested in CI:
109
+
110
+ ```python
111
+ from groveyard import Board, DigitalPort, Button, FakeTransport
112
+ from groveyard.testing import FakeBridgeFirmware
113
+
114
+ firmware = FakeBridgeFirmware()
115
+ firmware.digital_inputs[DigitalPort.D3] = 1
116
+
117
+ async with Board(FakeTransport(responder=firmware)) as board:
118
+ assert await Button(board, DigitalPort.D3).is_pressed()
119
+ ```
120
+
121
+ The fake records every bus event with the id of the transaction it belongs to,
122
+ and records requested delays instead of sleeping — so timing and atomicity are
123
+ asserted, not waited for. See
124
+ [Testing without hardware](https://quantumwaffy.github.io/groveyard/guides/testing/).
125
+
126
+ ## Errors
127
+
128
+ Everything derives from `GroveyardError`: `TransportError` (the bus failed),
129
+ `ProtocolError` (malformed reply), `DeviceNotReadyError` (the board answered
130
+ "not ready" on every attempt), `BoardError` (`NotConnectedError`,
131
+ `PortInUseError`) and `DeviceError` (`DeviceClosedError`). Out-of-range
132
+ arguments are caller bugs and raise plain `ValueError`. See
133
+ [Errors](https://quantumwaffy.github.io/groveyard/api/errors/).
134
+
135
+ ## Architecture, in one picture
136
+
137
+ ```mermaid
138
+ flowchart LR
139
+ Devices["Devices<br/><small>Button, Led, Dht, RgbLcd, …</small>"]
140
+ Board["Board<br/><small>lifecycle, ports, pin-mode cache</small>"]
141
+ Protocol["Protocol<br/><small>0x04 command encoding</small>"]
142
+ Transport["Transport<br/><small>bus handle + the one bus lock</small>"]
143
+
144
+ Devices --> Board --> Protocol --> Transport
145
+ ```
146
+
147
+ Each layer depends only on the one below it and on an abstraction, never a
148
+ concrete class — adding a driver means adding a class, never editing a core
149
+ layer. Full tour, with class diagrams and a traced example call:
150
+ [Layers overview](https://quantumwaffy.github.io/groveyard/architecture/).
151
+
152
+ ## Contributing
153
+
154
+ Issues and PRs are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) for the
155
+ development setup, the four required gates, and a worked walkthrough of
156
+ adding a new driver. [CHANGELOG.md](CHANGELOG.md) tracks releases;
157
+ [SECURITY.md](SECURITY.md) covers vulnerability reporting.
158
+
159
+ ## Licence
160
+
161
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,139 @@
1
+ [project]
2
+ name = "groveyard"
3
+ version = "0.1.0"
4
+ description = "A modern, fully typed async Python library for GrovePi+ sensors and actuators on a Raspberry Pi"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ keywords = [
10
+ "grovepi",
11
+ "grove",
12
+ "raspberry-pi",
13
+ "i2c",
14
+ "iot",
15
+ "asyncio",
16
+ "async",
17
+ "sensors",
18
+ "hardware",
19
+ "embedded",
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 3 - Alpha",
23
+ "Intended Audience :: Developers",
24
+ "Topic :: Home Automation",
25
+ "Topic :: Software Development :: Embedded Systems",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ "Topic :: System :: Hardware",
28
+ "Operating System :: OS Independent",
29
+ "Programming Language :: Python :: 3 :: Only",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Programming Language :: Python :: 3.13",
32
+ "Framework :: AsyncIO",
33
+ "Typing :: Typed",
34
+ ]
35
+ dependencies = []
36
+
37
+ [[project.authors]]
38
+ name = "Sasha Chistyh"
39
+ email = "sashachistyh@gmail.com"
40
+
41
+ [[project.maintainers]]
42
+ name = "Sasha Chistyh"
43
+ email = "sashachistyh@gmail.com"
44
+
45
+ [project.optional-dependencies]
46
+ hardware = ["smbus2>=0.4"]
47
+
48
+ [project.urls]
49
+ Homepage = "https://quantumwaffy.github.io/groveyard/"
50
+ Documentation = "https://quantumwaffy.github.io/groveyard/"
51
+ Repository = "https://github.com/quantumwaffy/groveyard"
52
+ Issues = "https://github.com/quantumwaffy/groveyard/issues"
53
+ Changelog = "https://quantumwaffy.github.io/groveyard/changelog/"
54
+
55
+ [dependency-groups]
56
+ dev = [
57
+ "pytest>=8",
58
+ "pytest-asyncio>=0.23",
59
+ "pytest-cov>=7.1.0",
60
+ "ruff>=0.6",
61
+ "ty",
62
+ ]
63
+ docs = [
64
+ "mkdocs>=1.6.1",
65
+ "mkdocs-git-revision-date-localized-plugin>=1.5.3",
66
+ "mkdocs-include-markdown-plugin>=7.3.0",
67
+ "mkdocs-material>=9.7.7",
68
+ "mkdocstrings[python]>=1.0.6",
69
+ ]
70
+
71
+ [build-system]
72
+ requires = ["uv_build>=0.12.1,<0.13.0"]
73
+ build-backend = "uv_build"
74
+
75
+ [tool.ruff]
76
+ line-length = 120
77
+ target-version = "py312"
78
+ src = [
79
+ "src",
80
+ "tests",
81
+ ]
82
+
83
+ [tool.ruff.lint]
84
+ select = [
85
+ "E",
86
+ "F",
87
+ "W",
88
+ "I",
89
+ "UP",
90
+ "B",
91
+ "ASYNC",
92
+ "SIM",
93
+ "RUF",
94
+ "ANN",
95
+ "D",
96
+ "TID",
97
+ "Q",
98
+ ]
99
+
100
+ [tool.ruff.lint.flake8-tidy-imports]
101
+ ban-relative-imports = "all"
102
+
103
+ [tool.ruff.lint.pydocstyle]
104
+ convention = "google"
105
+
106
+ [tool.ruff.lint.per-file-ignores]
107
+ "tests/*" = ["D"]
108
+
109
+ [tool.pytest.ini_options]
110
+ asyncio_mode = "auto"
111
+ testpaths = ["tests"]
112
+ python_files = [
113
+ "tests.py",
114
+ "test_*.py",
115
+ "tests_*.py",
116
+ "*_tests.py",
117
+ "*_test.py",
118
+ ]
119
+ addopts = "--cov=groveyard --cov-report=term-missing"
120
+
121
+ [tool.coverage.run]
122
+ source = ["src/groveyard"]
123
+ branch = true
124
+
125
+ [tool.coverage.report]
126
+ exclude_also = [
127
+ "if TYPE_CHECKING:",
128
+ '\.\.\.$',
129
+ "# pragma: no cover",
130
+ ]
131
+
132
+ [tool.ty.environment]
133
+ python-version = "3.12"
134
+
135
+ [tool.ty.src]
136
+ include = [
137
+ "src",
138
+ "tests",
139
+ ]
@@ -0,0 +1,125 @@
1
+ [project]
2
+ name = "groveyard"
3
+ version = "0.1.0"
4
+ description = "A modern, fully typed async Python library for GrovePi+ sensors and actuators on a Raspberry Pi"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ authors = [{ name = "Sasha Chistyh", email = "sashachistyh@gmail.com" }]
10
+ maintainers = [{ name = "Sasha Chistyh", email = "sashachistyh@gmail.com" }]
11
+ keywords = [
12
+ "grovepi",
13
+ "grove",
14
+ "raspberry-pi",
15
+ "i2c",
16
+ "iot",
17
+ "asyncio",
18
+ "async",
19
+ "sensors",
20
+ "hardware",
21
+ "embedded",
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 3 - Alpha",
25
+ "Intended Audience :: Developers",
26
+ "Topic :: Home Automation",
27
+ "Topic :: Software Development :: Embedded Systems",
28
+ "Topic :: Software Development :: Libraries :: Python Modules",
29
+ "Topic :: System :: Hardware",
30
+ "Operating System :: OS Independent",
31
+ "Programming Language :: Python :: 3 :: Only",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3.13",
34
+ "Framework :: AsyncIO",
35
+ "Typing :: Typed",
36
+ ]
37
+ dependencies = []
38
+
39
+ [project.optional-dependencies]
40
+ # Real-hardware I2C backend. Not needed for development, testing, or CI — the
41
+ # fake transport (groveyard.transport.fake) covers everything off-device.
42
+ hardware = ["smbus2>=0.4"]
43
+
44
+ [project.urls]
45
+ Homepage = "https://quantumwaffy.github.io/groveyard/"
46
+ Documentation = "https://quantumwaffy.github.io/groveyard/"
47
+ Repository = "https://github.com/quantumwaffy/groveyard"
48
+ Issues = "https://github.com/quantumwaffy/groveyard/issues"
49
+ Changelog = "https://quantumwaffy.github.io/groveyard/changelog/"
50
+
51
+ [dependency-groups]
52
+ dev = [
53
+ "pytest>=8",
54
+ "pytest-asyncio>=0.23",
55
+ "pytest-cov>=7.1.0",
56
+ "ruff>=0.6",
57
+ "ty",
58
+ ]
59
+ docs = [
60
+ "mkdocs>=1.6.1",
61
+ "mkdocs-git-revision-date-localized-plugin>=1.5.3",
62
+ "mkdocs-include-markdown-plugin>=7.3.0",
63
+ "mkdocs-material>=9.7.7",
64
+ "mkdocstrings[python]>=1.0.6",
65
+ ]
66
+
67
+ [build-system]
68
+ requires = ["uv_build>=0.12.1,<0.13.0"]
69
+ build-backend = "uv_build"
70
+
71
+ [tool.ruff]
72
+ line-length = 120
73
+ target-version = "py312"
74
+ src = ["src", "tests"]
75
+
76
+ [tool.ruff.lint]
77
+ # ASYNC (flake8-async): flags blocking calls made from `async` code (time.sleep,
78
+ # sync I/O) — the library's #1 hazard.
79
+ # ANN: type annotations are mandatory everywhere.
80
+ # D: docstrings are mandatory (google convention).
81
+ # TID: bans relative imports (absolute imports only).
82
+ # Q: consistent quotes (and flags avoidable escapes).
83
+ # The rest are general correctness/style/modernization rules.
84
+ select = ["E", "F", "W", "I", "UP", "B", "ASYNC", "SIM", "RUF", "ANN", "D", "TID", "Q"]
85
+
86
+ [tool.ruff.lint.flake8-tidy-imports]
87
+ ban-relative-imports = "all"
88
+
89
+ [tool.ruff.lint.pydocstyle]
90
+ convention = "google"
91
+
92
+ [tool.ruff.lint.per-file-ignores]
93
+ # Tests keep full type annotations but relax docstrings — test names document intent.
94
+ "tests/*" = ["D"]
95
+
96
+ [tool.pytest.ini_options]
97
+ asyncio_mode = "auto"
98
+ testpaths = ["tests"]
99
+ python_files = [
100
+ "tests.py",
101
+ "test_*.py",
102
+ "tests_*.py",
103
+ "*_tests.py",
104
+ "*_test.py",
105
+ ]
106
+ addopts = "--cov=groveyard --cov-report=term-missing"
107
+
108
+ [tool.coverage.run]
109
+ source = ["src/groveyard"]
110
+ branch = true
111
+
112
+ [tool.coverage.report]
113
+ # The fake-transport-only test suite cannot exercise the real i2c backend
114
+ # (no Raspberry Pi in CI) or the defensive branches guarded by comments below.
115
+ exclude_also = [
116
+ "if TYPE_CHECKING:",
117
+ "\\.\\.\\.$",
118
+ "# pragma: no cover",
119
+ ]
120
+
121
+ [tool.ty.environment]
122
+ python-version = "3.12"
123
+
124
+ [tool.ty.src]
125
+ include = ["src", "tests"]