busylib 0.3.0__tar.gz → 0.4.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.
- busylib-0.4.1/.gitignore +211 -0
- busylib-0.4.1/.pre-commit-config.yaml +26 -0
- {busylib-0.3.0 → busylib-0.4.1}/LICENSE +1 -1
- busylib-0.4.1/MANIFEST.in +11 -0
- busylib-0.4.1/Makefile +63 -0
- {busylib-0.3.0 → busylib-0.4.1}/PKG-INFO +47 -12
- {busylib-0.3.0 → busylib-0.4.1}/README.md +38 -4
- busylib-0.4.1/pyproject.toml +85 -0
- busylib-0.4.1/src/busylib/__init__.py +11 -0
- busylib-0.4.1/src/busylib/_version.py +1 -0
- busylib-0.4.1/src/busylib/client/__init__.py +135 -0
- busylib-0.4.1/src/busylib/client/access.py +59 -0
- busylib-0.4.1/src/busylib/client/account.py +141 -0
- busylib-0.4.1/src/busylib/client/assets.py +69 -0
- busylib-0.4.1/src/busylib/client/audio.py +96 -0
- busylib-0.4.1/src/busylib/client/base.py +437 -0
- busylib-0.4.1/src/busylib/client/ble.py +60 -0
- busylib-0.4.1/src/busylib/client/busy.py +64 -0
- busylib-0.4.1/src/busylib/client/display.py +372 -0
- busylib-0.4.1/src/busylib/client/firmware.py +106 -0
- busylib-0.4.1/src/busylib/client/input.py +38 -0
- busylib-0.4.1/src/busylib/client/storage.py +175 -0
- busylib-0.4.1/src/busylib/client/time.py +56 -0
- busylib-0.4.1/src/busylib/client/updater.py +146 -0
- busylib-0.4.1/src/busylib/client/usb.py +602 -0
- busylib-0.4.1/src/busylib/client/wifi.py +116 -0
- busylib-0.4.1/src/busylib/converter/__init__.py +62 -0
- busylib-0.4.1/src/busylib/converter/audio.py +48 -0
- busylib-0.4.1/src/busylib/converter/image.py +86 -0
- busylib-0.4.1/src/busylib/converter/video.py +16 -0
- busylib-0.4.1/src/busylib/display.py +61 -0
- busylib-0.4.1/src/busylib/exceptions.py +52 -0
- busylib-0.4.1/src/busylib/features/__init__.py +6 -0
- busylib-0.4.1/src/busylib/features/app_assets.py +68 -0
- busylib-0.4.1/src/busylib/features/dashboard.py +112 -0
- busylib-0.4.1/src/busylib/settings.py +18 -0
- busylib-0.4.1/src/busylib/types.py +536 -0
- busylib-0.4.1/src/busylib/usb.py +107 -0
- busylib-0.4.1/src/busylib/versioning.py +48 -0
- busylib-0.4.1/src/busylib.egg-info/SOURCES.txt +38 -0
- busylib-0.3.0/busylib/__init__.py +0 -1
- busylib-0.3.0/busylib/client.py +0 -369
- busylib-0.3.0/busylib/exceptions.py +0 -5
- busylib-0.3.0/busylib/types.py +0 -206
- busylib-0.3.0/busylib.egg-info/PKG-INFO +0 -228
- busylib-0.3.0/busylib.egg-info/SOURCES.txt +0 -15
- busylib-0.3.0/busylib.egg-info/dependency_links.txt +0 -1
- busylib-0.3.0/busylib.egg-info/requires.txt +0 -6
- busylib-0.3.0/busylib.egg-info/top_level.txt +0 -1
- busylib-0.3.0/pyproject.toml +0 -65
- busylib-0.3.0/setup.py +0 -3
- busylib-0.3.0/tests/test_client.py +0 -429
- busylib-0.3.0/tests/test_client_init.py +0 -39
- {busylib-0.3.0 → busylib-0.4.1}/setup.cfg +0 -0
busylib-0.4.1/.gitignore
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
.history
|
|
3
|
+
.version.py
|
|
4
|
+
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[codz]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
# Usually these files are written by a python script from a template
|
|
35
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
*.py.cover
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
cover/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Django stuff:
|
|
63
|
+
*.log
|
|
64
|
+
local_settings.py
|
|
65
|
+
db.sqlite3
|
|
66
|
+
db.sqlite3-journal
|
|
67
|
+
|
|
68
|
+
# Flask stuff:
|
|
69
|
+
instance/
|
|
70
|
+
.webassets-cache
|
|
71
|
+
|
|
72
|
+
# Scrapy stuff:
|
|
73
|
+
.scrapy
|
|
74
|
+
|
|
75
|
+
# Sphinx documentation
|
|
76
|
+
docs/_build/
|
|
77
|
+
|
|
78
|
+
# PyBuilder
|
|
79
|
+
.pybuilder/
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
91
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
92
|
+
# .python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
#Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# UV
|
|
102
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
103
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
104
|
+
# commonly ignored for libraries.
|
|
105
|
+
#uv.lock
|
|
106
|
+
|
|
107
|
+
# poetry
|
|
108
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
109
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
110
|
+
# commonly ignored for libraries.
|
|
111
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
112
|
+
#poetry.lock
|
|
113
|
+
#poetry.toml
|
|
114
|
+
|
|
115
|
+
# pdm
|
|
116
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
117
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
118
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
119
|
+
#pdm.lock
|
|
120
|
+
#pdm.toml
|
|
121
|
+
.pdm-python
|
|
122
|
+
.pdm-build/
|
|
123
|
+
|
|
124
|
+
# pixi
|
|
125
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
126
|
+
#pixi.lock
|
|
127
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
128
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
129
|
+
.pixi
|
|
130
|
+
|
|
131
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
132
|
+
__pypackages__/
|
|
133
|
+
|
|
134
|
+
# Celery stuff
|
|
135
|
+
celerybeat-schedule
|
|
136
|
+
celerybeat.pid
|
|
137
|
+
|
|
138
|
+
# SageMath parsed files
|
|
139
|
+
*.sage.py
|
|
140
|
+
|
|
141
|
+
# Environments
|
|
142
|
+
.env
|
|
143
|
+
.envrc
|
|
144
|
+
.venv
|
|
145
|
+
env/
|
|
146
|
+
venv/
|
|
147
|
+
ENV/
|
|
148
|
+
env.bak/
|
|
149
|
+
venv.bak/
|
|
150
|
+
|
|
151
|
+
# Spyder project settings
|
|
152
|
+
.spyderproject
|
|
153
|
+
.spyproject
|
|
154
|
+
|
|
155
|
+
# Rope project settings
|
|
156
|
+
.ropeproject
|
|
157
|
+
|
|
158
|
+
# mkdocs documentation
|
|
159
|
+
/site
|
|
160
|
+
|
|
161
|
+
# mypy
|
|
162
|
+
.mypy_cache/
|
|
163
|
+
.dmypy.json
|
|
164
|
+
dmypy.json
|
|
165
|
+
|
|
166
|
+
# Pyre type checker
|
|
167
|
+
.pyre/
|
|
168
|
+
|
|
169
|
+
# pytype static type analyzer
|
|
170
|
+
.pytype/
|
|
171
|
+
|
|
172
|
+
# Cython debug symbols
|
|
173
|
+
cython_debug/
|
|
174
|
+
|
|
175
|
+
# PyCharm
|
|
176
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
177
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
178
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
179
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
180
|
+
#.idea/
|
|
181
|
+
|
|
182
|
+
# Abstra
|
|
183
|
+
# Abstra is an AI-powered process automation framework.
|
|
184
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
185
|
+
# Learn more at https://abstra.io/docs
|
|
186
|
+
.abstra/
|
|
187
|
+
|
|
188
|
+
# Visual Studio Code
|
|
189
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
190
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
191
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
192
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
193
|
+
# .vscode/
|
|
194
|
+
|
|
195
|
+
# Ruff stuff:
|
|
196
|
+
.ruff_cache/
|
|
197
|
+
|
|
198
|
+
# PyPI configuration file
|
|
199
|
+
.pypirc
|
|
200
|
+
|
|
201
|
+
# Cursor
|
|
202
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
203
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
204
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
205
|
+
.cursorignore
|
|
206
|
+
.cursorindexingignore
|
|
207
|
+
|
|
208
|
+
# Marimo
|
|
209
|
+
marimo/_static/
|
|
210
|
+
marimo/_lsp/
|
|
211
|
+
__marimo__/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.9.10
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff
|
|
6
|
+
args: ["--fix"]
|
|
7
|
+
- id: ruff-format
|
|
8
|
+
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
9
|
+
rev: v2.5.1
|
|
10
|
+
hooks:
|
|
11
|
+
- id: pyproject-fmt
|
|
12
|
+
- repo: https://github.com/RobertCraigie/pyright-python
|
|
13
|
+
rev: v1.1.408
|
|
14
|
+
hooks:
|
|
15
|
+
- id: pyright
|
|
16
|
+
files: ^(src/busylib/|tests/)
|
|
17
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
18
|
+
rev: v4.6.0
|
|
19
|
+
hooks:
|
|
20
|
+
- id: check-added-large-files
|
|
21
|
+
- id: check-merge-conflict
|
|
22
|
+
- id: check-toml
|
|
23
|
+
- id: check-yaml
|
|
24
|
+
- id: detect-private-key
|
|
25
|
+
- id: end-of-file-fixer
|
|
26
|
+
- id: trailing-whitespace
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright © 2025 Flipper
|
|
1
|
+
Copyright © 2025 Flipper FZCO
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
busylib-0.4.1/Makefile
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.PHONY: help install install-dev test test-cov lint format clean build upload docs
|
|
2
|
+
|
|
3
|
+
# Default target
|
|
4
|
+
help:
|
|
5
|
+
@echo "Available commands:"
|
|
6
|
+
@echo " install - Install the package"
|
|
7
|
+
@echo " install-dev - Install in development mode with dev dependencies"
|
|
8
|
+
@echo " test - Run tests"
|
|
9
|
+
@echo " test-cov - Run tests with coverage"
|
|
10
|
+
@echo " lint - Run linting checks"
|
|
11
|
+
@echo " format - Format code with black"
|
|
12
|
+
@echo " clean - Clean build artifacts"
|
|
13
|
+
@echo " build - Build package"
|
|
14
|
+
@echo " upload - Upload to PyPI"
|
|
15
|
+
@echo " docs - Generate documentation"
|
|
16
|
+
|
|
17
|
+
# Install package
|
|
18
|
+
install:
|
|
19
|
+
pip install .
|
|
20
|
+
|
|
21
|
+
# Install in development mode
|
|
22
|
+
install-dev:
|
|
23
|
+
pip install --editable .[dev]
|
|
24
|
+
|
|
25
|
+
# Run tests
|
|
26
|
+
test:
|
|
27
|
+
python -m pytest tests/ -v
|
|
28
|
+
|
|
29
|
+
# Run tests with coverage
|
|
30
|
+
test-cov:
|
|
31
|
+
# python -m pytest tests/ -v --cov=busylib --cov-report=html --cov-report=term
|
|
32
|
+
@echo "Not implemented yet"
|
|
33
|
+
|
|
34
|
+
# Run linting
|
|
35
|
+
lint:
|
|
36
|
+
@echo "Not implemented yet"
|
|
37
|
+
|
|
38
|
+
# Format code
|
|
39
|
+
format:
|
|
40
|
+
ruff format .
|
|
41
|
+
|
|
42
|
+
# Clean build artifacts
|
|
43
|
+
clean:
|
|
44
|
+
rm -rf build/
|
|
45
|
+
rm -rf dist/
|
|
46
|
+
rm -rf *.egg-info/
|
|
47
|
+
rm -rf .pytest_cache/
|
|
48
|
+
rm -rf .ruff_cache/
|
|
49
|
+
rm -rf htmlcov/
|
|
50
|
+
find . -type d -name __pycache__ -exec rm -rf {} +
|
|
51
|
+
find . -type f -name "*.pyc" -delete
|
|
52
|
+
|
|
53
|
+
# Build package (requires build)
|
|
54
|
+
build: clean
|
|
55
|
+
python -m build
|
|
56
|
+
|
|
57
|
+
# Upload to PyPI (requires twine)
|
|
58
|
+
upload: build
|
|
59
|
+
twine upload dist/*
|
|
60
|
+
|
|
61
|
+
# Generate documentation (placeholder)
|
|
62
|
+
docs:
|
|
63
|
+
@echo "Documentation generation not implemented yet"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: busylib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Python library for Busy Bar API
|
|
5
5
|
Author-email: flipperdevices <pypi@flipperdevices.com>
|
|
6
|
+
Project-URL: Documentation, https://busylib.readthedocs.io
|
|
6
7
|
Project-URL: Homepage, https://github.com/busy-app/busylib-py
|
|
7
8
|
Project-URL: Repository, https://github.com/busy-app/busylib-py
|
|
8
|
-
Project-URL: Documentation, https://busylib.readthedocs.io
|
|
9
9
|
Classifier: Development Status :: 3 - Alpha
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -16,15 +16,20 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
16
16
|
Requires-Python: >=3.10
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist:
|
|
19
|
+
Requires-Dist: httpx>=0.28.1
|
|
20
|
+
Requires-Dist: pillow>=12
|
|
21
|
+
Requires-Dist: pydantic>=2.9
|
|
22
|
+
Requires-Dist: pydantic-extra-types>=2.9
|
|
23
|
+
Requires-Dist: pydantic-settings>=2.12
|
|
24
|
+
Requires-Dist: websockets>=12
|
|
24
25
|
Dynamic: license-file
|
|
25
26
|
|
|
26
27
|
# busylib
|
|
27
28
|
|
|
29
|
+
[](https://pypi.org/project/busylib/)
|
|
30
|
+
[](https://pypi.org/project/busylib/)
|
|
31
|
+
[](https://github.com/busy-app/busylib-py/blob/main/LICENSE)
|
|
32
|
+
|
|
28
33
|
A simple and intuitive Python client for interacting with the Busy Bar API. This library allows you to programmatically control the device's display, audio, and assets.
|
|
29
34
|
|
|
30
35
|
## Features
|
|
@@ -43,6 +48,12 @@ You can install `busylib` directly from PyPI:
|
|
|
43
48
|
pip install busylib
|
|
44
49
|
```
|
|
45
50
|
|
|
51
|
+
Upgrade to the latest release:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install --upgrade busylib
|
|
55
|
+
```
|
|
56
|
+
|
|
46
57
|
## Usage
|
|
47
58
|
|
|
48
59
|
First, import and initialize the `BusyBar` client with IP address of your device.
|
|
@@ -66,6 +77,24 @@ with BusyBar("10.0.4.20") as bb:
|
|
|
66
77
|
print(f"Device version: {version_info.version}")
|
|
67
78
|
```
|
|
68
79
|
|
|
80
|
+
For concurrent workflows, use the async client to avoid blocking I/O.
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import asyncio
|
|
84
|
+
|
|
85
|
+
from busylib import AsyncBusyBar
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
async def main() -> None:
|
|
89
|
+
async with AsyncBusyBar("10.0.4.20") as bb:
|
|
90
|
+
version_info = await bb.get_version()
|
|
91
|
+
print(f"Device version: {version_info.version}")
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
if __name__ == "__main__":
|
|
95
|
+
asyncio.run(main())
|
|
96
|
+
```
|
|
97
|
+
|
|
69
98
|
## API Examples
|
|
70
99
|
|
|
71
100
|
Here are some examples of how to use the library to control your Busy Bar device.
|
|
@@ -80,7 +109,7 @@ with open("path/to/your/image.png", "rb") as f:
|
|
|
80
109
|
response = bb.upload_asset(
|
|
81
110
|
app_id="my-app",
|
|
82
111
|
filename="logo.png",
|
|
83
|
-
data=file_bytes
|
|
112
|
+
data=file_bytes,
|
|
84
113
|
)
|
|
85
114
|
print(f"Upload result: {response.result}")
|
|
86
115
|
|
|
@@ -90,7 +119,7 @@ with open("path/to/your/sound.wav", "rb") as f:
|
|
|
90
119
|
response = bb.upload_asset(
|
|
91
120
|
app_id="my-app",
|
|
92
121
|
filename="notification.wav",
|
|
93
|
-
data=file_bytes
|
|
122
|
+
data=file_bytes,
|
|
94
123
|
)
|
|
95
124
|
```
|
|
96
125
|
|
|
@@ -209,13 +238,19 @@ response = bb.create_storage_directory(path="/my-app/subdirectory")
|
|
|
209
238
|
response = bb.remove_storage_file(path="/my-app/data.txt")
|
|
210
239
|
```
|
|
211
240
|
|
|
241
|
+
## Links
|
|
242
|
+
|
|
243
|
+
- Documentation: https://busylib.readthedocs.io
|
|
244
|
+
- Source: https://github.com/busy-app/busylib-py
|
|
245
|
+
- PyPI: https://pypi.org/project/busylib/
|
|
246
|
+
|
|
212
247
|
## Development
|
|
213
248
|
|
|
214
249
|
To set up a development environment, clone the repository and install the package in editable mode with test dependencies:
|
|
215
250
|
|
|
216
251
|
```bash
|
|
217
|
-
git clone https://github.com/busy-app/busylib
|
|
218
|
-
cd busylib
|
|
252
|
+
git clone https://github.com/busy-app/busylib-py
|
|
253
|
+
cd busylib-py
|
|
219
254
|
python3 -m venv .venv
|
|
220
255
|
source .venv/bin/activate
|
|
221
256
|
make install-dev
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# busylib
|
|
2
2
|
|
|
3
|
+
[](https://pypi.org/project/busylib/)
|
|
4
|
+
[](https://pypi.org/project/busylib/)
|
|
5
|
+
[](https://github.com/busy-app/busylib-py/blob/main/LICENSE)
|
|
6
|
+
|
|
3
7
|
A simple and intuitive Python client for interacting with the Busy Bar API. This library allows you to programmatically control the device's display, audio, and assets.
|
|
4
8
|
|
|
5
9
|
## Features
|
|
@@ -18,6 +22,12 @@ You can install `busylib` directly from PyPI:
|
|
|
18
22
|
pip install busylib
|
|
19
23
|
```
|
|
20
24
|
|
|
25
|
+
Upgrade to the latest release:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install --upgrade busylib
|
|
29
|
+
```
|
|
30
|
+
|
|
21
31
|
## Usage
|
|
22
32
|
|
|
23
33
|
First, import and initialize the `BusyBar` client with IP address of your device.
|
|
@@ -41,6 +51,24 @@ with BusyBar("10.0.4.20") as bb:
|
|
|
41
51
|
print(f"Device version: {version_info.version}")
|
|
42
52
|
```
|
|
43
53
|
|
|
54
|
+
For concurrent workflows, use the async client to avoid blocking I/O.
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import asyncio
|
|
58
|
+
|
|
59
|
+
from busylib import AsyncBusyBar
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
async def main() -> None:
|
|
63
|
+
async with AsyncBusyBar("10.0.4.20") as bb:
|
|
64
|
+
version_info = await bb.get_version()
|
|
65
|
+
print(f"Device version: {version_info.version}")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
asyncio.run(main())
|
|
70
|
+
```
|
|
71
|
+
|
|
44
72
|
## API Examples
|
|
45
73
|
|
|
46
74
|
Here are some examples of how to use the library to control your Busy Bar device.
|
|
@@ -55,7 +83,7 @@ with open("path/to/your/image.png", "rb") as f:
|
|
|
55
83
|
response = bb.upload_asset(
|
|
56
84
|
app_id="my-app",
|
|
57
85
|
filename="logo.png",
|
|
58
|
-
data=file_bytes
|
|
86
|
+
data=file_bytes,
|
|
59
87
|
)
|
|
60
88
|
print(f"Upload result: {response.result}")
|
|
61
89
|
|
|
@@ -65,7 +93,7 @@ with open("path/to/your/sound.wav", "rb") as f:
|
|
|
65
93
|
response = bb.upload_asset(
|
|
66
94
|
app_id="my-app",
|
|
67
95
|
filename="notification.wav",
|
|
68
|
-
data=file_bytes
|
|
96
|
+
data=file_bytes,
|
|
69
97
|
)
|
|
70
98
|
```
|
|
71
99
|
|
|
@@ -184,13 +212,19 @@ response = bb.create_storage_directory(path="/my-app/subdirectory")
|
|
|
184
212
|
response = bb.remove_storage_file(path="/my-app/data.txt")
|
|
185
213
|
```
|
|
186
214
|
|
|
215
|
+
## Links
|
|
216
|
+
|
|
217
|
+
- Documentation: https://busylib.readthedocs.io
|
|
218
|
+
- Source: https://github.com/busy-app/busylib-py
|
|
219
|
+
- PyPI: https://pypi.org/project/busylib/
|
|
220
|
+
|
|
187
221
|
## Development
|
|
188
222
|
|
|
189
223
|
To set up a development environment, clone the repository and install the package in editable mode with test dependencies:
|
|
190
224
|
|
|
191
225
|
```bash
|
|
192
|
-
git clone https://github.com/busy-app/busylib
|
|
193
|
-
cd busylib
|
|
226
|
+
git clone https://github.com/busy-app/busylib-py
|
|
227
|
+
cd busylib-py
|
|
194
228
|
python3 -m venv .venv
|
|
195
229
|
source .venv/bin/activate
|
|
196
230
|
make install-dev
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "setuptools.build_meta"
|
|
3
|
+
|
|
4
|
+
requires = [ "setuptools>=61", "setuptools-scm", "wheel" ]
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "busylib"
|
|
8
|
+
description = "Python library for Busy Bar API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "flipperdevices", email = "pypi@flipperdevices.com" },
|
|
12
|
+
]
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
]
|
|
23
|
+
dynamic = [ "version" ]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"httpx>=0.28.1",
|
|
26
|
+
"pillow>=12",
|
|
27
|
+
"pydantic>=2.9",
|
|
28
|
+
"pydantic-extra-types>=2.9",
|
|
29
|
+
"pydantic-settings>=2.12",
|
|
30
|
+
"websockets>=12",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
urls.Documentation = "https://busylib.readthedocs.io"
|
|
34
|
+
urls.Homepage = "https://github.com/busy-app/busylib-py"
|
|
35
|
+
urls.Repository = "https://github.com/busy-app/busylib-py"
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = [
|
|
39
|
+
"pre-commit>=3.8",
|
|
40
|
+
"pyproject-fmt>=2.5.1",
|
|
41
|
+
"pyright>=1.1.408",
|
|
42
|
+
"pytest>=8.4.1",
|
|
43
|
+
"pytest-asyncio>=0.24",
|
|
44
|
+
"pytest-cov>=7",
|
|
45
|
+
"ruff>=0.9",
|
|
46
|
+
"tomli>=2.2",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.setuptools]
|
|
50
|
+
package-dir = { "" = "src" }
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = [ "src" ]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools_scm]
|
|
56
|
+
write_to = "src/busylib/_version.py"
|
|
57
|
+
write_to_template = "__version__ = '{version}'\n"
|
|
58
|
+
|
|
59
|
+
[tool.ruff]
|
|
60
|
+
target-version = "py310"
|
|
61
|
+
|
|
62
|
+
line-length = 88
|
|
63
|
+
indent-width = 4
|
|
64
|
+
exclude = [
|
|
65
|
+
".git",
|
|
66
|
+
".pytest_cache",
|
|
67
|
+
".ruff_cache",
|
|
68
|
+
".venv",
|
|
69
|
+
".vscode",
|
|
70
|
+
"__pycache__",
|
|
71
|
+
"build",
|
|
72
|
+
"dist",
|
|
73
|
+
"venv",
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
format.indent-style = "space"
|
|
77
|
+
format.quote-style = "double"
|
|
78
|
+
format.line-ending = "auto"
|
|
79
|
+
format.skip-magic-trailing-comma = false
|
|
80
|
+
format.docstring-code-line-length = "dynamic"
|
|
81
|
+
format.docstring-code-format = false
|
|
82
|
+
|
|
83
|
+
[tool.pytest.ini_options]
|
|
84
|
+
addopts = "-q"
|
|
85
|
+
asyncio_mode = "auto"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.4.1'
|