Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: uv python install 3.11

- name: Install dependencies
run: uv sync --all-extras
run: uv sync --all-extras --group dev

- name: Run prek
run: uv run prek run --all-files
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,37 @@ async with OpenDisplayDevice(device_name="OpenDisplay-A123") as device:
await device.upload_image(image)
```

## CLI

Run without installing (requires [uv](https://docs.astral.sh/uv/)):

```bash
uvx --from py-opendisplay opendisplay --help
```

Or after `pip install py-opendisplay`:

```bash
# Discover nearby devices
opendisplay scan

# Read device info (size, color, firmware, board)
opendisplay info --device AA:BB:CC:DD:EE:FF

# Upload an image
opendisplay upload --device AA:BB:CC:DD:EE:FF photo.jpg
opendisplay upload --device AA:BB:CC:DD:EE:FF photo.jpg --fit cover --refresh-mode fast

# Reboot the device
opendisplay reboot --device AA:BB:CC:DD:EE:FF

# Export / write device configuration
opendisplay export-config --device AA:BB:CC:DD:EE:FF config.json
opendisplay write-config --device AA:BB:CC:DD:EE:FF config.json
```

Encrypted devices require `--key HEX` (32 hex characters). Pass `-v` / `--verbose` for debug logging.

## Image Fitting

Images are automatically fitted to the display dimensions. Control how aspect ratio mismatches are handled with the `fit` parameter:
Expand Down
24 changes: 11 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,25 @@ dependencies = [
"bleak-retry-connector>=3.5.0",
"epaper-dithering==0.6.3",
"cryptography>=41.0.0",
"rich>=13.0.0",
]

[project.optional-dependencies]
test = [
"pytest>=9.0.2",
"pytest-asyncio>=1.3.0",
"pytest-cov>=7.0.0",
"pytest-xdist>=3.8.0"

]

property = [
"hypothesis>=6.148.8"
]

dev = [
"mypy>=1.19.1",
"ruff>=0.14.10"
"pytest-xdist>=3.8.0",
"hypothesis>=6.148.8",
]

[project.urls]
Homepage = "https://opendisplay.org"
Repository = "https://github.com/OpenDisplay-org/py-opendisplay"

[project.scripts]
opendisplay = "opendisplay.cli:main"

[tool.hatch.build.targets.wheel]
packages = ["src/opendisplay"]
include = ["src/opendisplay/py.typed"]
Expand All @@ -79,7 +74,7 @@ warn_unused_configs = true

[tool.pylint.format]
max-line-length = 120
max-module-lines = 1100
max-module-lines = 1150

[tool.pylint.basic]
# Allow unit-suffixed names (e.g. full_update_mC for milli-Coulombs)
Expand All @@ -90,11 +85,12 @@ attr-rgx = "^[a-zA-Z_][a-zA-Z0-9_]*$"
[tool.pylint.design]
max-args = 12
max-positional-arguments = 12
max-locals = 25
max-locals = 28 # _build_info_tree renders a complex tree with many conditional vars
max-attributes = 22 # config dataclasses have many fields by nature
max-branches = 25
max-statements = 70
max-returns = 9
max-public-methods = 21 # OpenDisplayDevice API surface grows with device features

[tool.pylint.messages_control]
disable = [
Expand All @@ -111,6 +107,8 @@ testpaths = ["tests"]

[dependency-groups]
dev = [
"mypy>=1.19.1",
"ruff>=0.14.10",
"prek>=0.3.4",
"pylint>=4.0.5",
]
3 changes: 2 additions & 1 deletion src/opendisplay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from .battery import voltage_to_percent
from .device import OpenDisplayDevice, prepare_image
from .discovery import discover_devices
from .discovery import discover_devices, discover_devices_with_adv
from .exceptions import (
AuthenticationError,
AuthenticationFailedError,
Expand Down Expand Up @@ -65,6 +65,7 @@
# Main API
"OpenDisplayDevice",
"discover_devices",
"discover_devices_with_adv",
"prepare_image",
# Exceptions
"OpenDisplayError",
Expand Down
Loading
Loading