ezmsg-peripheraldevice 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.
@@ -0,0 +1,66 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ - dev
11
+ release:
12
+ types: [published]
13
+ workflow_dispatch:
14
+
15
+ permissions:
16
+ contents: read
17
+ pages: write
18
+ id-token: write
19
+
20
+ # Allow only one concurrent deployment
21
+ concurrency:
22
+ group: "pages"
23
+ cancel-in-progress: false
24
+
25
+ jobs:
26
+ build:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 0 # Needed for hatch-vcs to determine version
32
+
33
+ - name: Install uv
34
+ uses: astral-sh/setup-uv@v6
35
+ with:
36
+ enable-cache: true
37
+ python-version: "3.12"
38
+
39
+ - name: Install the project
40
+ run: uv sync --only-group docs
41
+
42
+ - name: Build documentation
43
+ run: |
44
+ cd docs
45
+ uv run make html
46
+
47
+ - name: Add .nojekyll file
48
+ run: touch docs/build/html/.nojekyll
49
+
50
+ - name: Upload artifact
51
+ uses: actions/upload-pages-artifact@v3
52
+ with:
53
+ path: 'docs/build/html'
54
+
55
+ deploy:
56
+ # Only deploy when a release is published
57
+ if: github.event_name == 'release'
58
+ environment:
59
+ name: github-pages
60
+ url: ${{ steps.deployment.outputs.page_url }}
61
+ runs-on: ubuntu-latest
62
+ needs: build
63
+ steps:
64
+ - name: Deploy to GitHub Pages
65
+ id: deployment
66
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,28 @@
1
+ # This workflow will upload a Python Package using Twine when a release is created
2
+
3
+ name: Upload Python Package
4
+
5
+ on:
6
+ release:
7
+ types: [published]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ build:
12
+ name: build and upload release to PyPI
13
+ runs-on: ubuntu-latest
14
+ environment: "release"
15
+ permissions:
16
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v6
23
+
24
+ - name: Build Package
25
+ run: uv build
26
+
27
+ - name: Publish package distributions to PyPI
28
+ run: uv publish
@@ -0,0 +1,38 @@
1
+ name: Test package
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches:
8
+ - main
9
+ - dev
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ build:
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.10.15", "3.11", "3.12", "3.13"]
17
+ os:
18
+ - "ubuntu-latest"
19
+ - "windows-latest"
20
+ - "macos-latest"
21
+ runs-on: ${{matrix.os}}
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - name: Install the latest version of uv
27
+ uses: astral-sh/setup-uv@v6
28
+
29
+ - name: Install the project
30
+ run: uv sync --python ${{ matrix.python-version }}
31
+
32
+ - name: Lint
33
+ run: uv tool run ruff check --output-format=github src
34
+
35
+ - name: Run tests
36
+ uses: GabrielBB/xvfb-action@v1
37
+ with:
38
+ run: uv run pytest tests
@@ -0,0 +1,129 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ cover/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Sphinx documentation
57
+ docs/_build/
58
+ docs/build/
59
+ docs/source/_build
60
+ docs/source/generated
61
+ docs/source/api/generated
62
+
63
+ # PyBuilder
64
+ .pybuilder/
65
+ target/
66
+
67
+ # Jupyter Notebook
68
+ .ipynb_checkpoints
69
+
70
+ # IPython
71
+ profile_default/
72
+ ipython_config.py
73
+
74
+ # pyenv
75
+ # .python-version
76
+
77
+ # PEP 582
78
+ __pypackages__/
79
+
80
+ # Environments
81
+ .env
82
+ .venv
83
+ env/
84
+ venv/
85
+ ENV/
86
+ env.bak/
87
+ venv.bak/
88
+
89
+ # Spyder project settings
90
+ .spyderproject
91
+ .spyproject
92
+
93
+ # Rope project settings
94
+ .ropeproject
95
+
96
+ # mkdocs documentation
97
+ /site
98
+
99
+ # mypy
100
+ .mypy_cache/
101
+ .dmypy.json
102
+ dmypy.json
103
+
104
+ # Pyre type checker
105
+ .pyre/
106
+
107
+ # pytype static type analyzer
108
+ .pytype/
109
+
110
+ # Cython debug symbols
111
+ cython_debug/
112
+
113
+ # JetBrains IDE
114
+ .idea/
115
+
116
+ # VS Code
117
+ .vscode/
118
+
119
+ # Ruff cache
120
+ .ruff_cache/
121
+
122
+ # hatch-vcs generated version file
123
+ src/ezmsg/peripheraldevice/__version__.py
124
+
125
+ # uv lockfile (optional - comment if you want to track it)
126
+ uv.lock
127
+
128
+ # Claude
129
+ settings.local.json
@@ -0,0 +1,9 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.8.3
4
+ hooks:
5
+ # Run the linter.
6
+ - id: ruff
7
+ args: [ --fix ]
8
+ # Run the formatter.
9
+ - id: ruff-format
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ezmsg-org
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,71 @@
1
+ Metadata-Version: 2.4
2
+ Name: ezmsg-peripheraldevice
3
+ Version: 0.1.0
4
+ Summary: Modules to stream data from peripheral devices into ezmsg
5
+ Author-email: Chadwick Boulay <chadwick.boulay@gmail.com>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.10
9
+ Requires-Dist: ezmsg-baseproc>=1.1.0
10
+ Requires-Dist: ezmsg>=3.6.0
11
+ Requires-Dist: numpy>=1.26.0
12
+ Requires-Dist: pynput>=1.8.1
13
+ Description-Content-Type: text/markdown
14
+
15
+ # ezmsg-peripheraldevice
16
+
17
+ Short description of your ezmsg package.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install ezmsg-peripheraldevice
23
+ ```
24
+
25
+ ## Dependencies
26
+
27
+ - `ezmsg`
28
+ - `ezmsg-baseproc`
29
+ - `numpy`
30
+ - `pynput`
31
+
32
+ ## Usage
33
+
34
+ ### Mouse Examples
35
+
36
+ **Event-driven mouse listener** - captures every mouse movement event:
37
+
38
+ ```bash
39
+ python examples/mouse_listen.py
40
+ ```
41
+
42
+ **Polling mouse position** - reads mouse position at a fixed rate:
43
+
44
+ ```bash
45
+ python examples/mouse_poll.py --rate 60
46
+ ```
47
+
48
+ ### Programmatic Usage
49
+
50
+ ```python
51
+ import ezmsg.core as ez
52
+ from ezmsg.peripheraldevice import MouseListener, MouseListenerSettings
53
+ from ezmsg.peripheraldevice import MousePoller, MousePollerSettings
54
+ ```
55
+
56
+ > Note: MouseListener requires extra permissions.
57
+
58
+ ## Development
59
+
60
+ We use [`uv`](https://docs.astral.sh/uv/getting-started/installation/) for development.
61
+
62
+ 1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) if not already installed.
63
+ 2. Fork this repository and clone your fork locally.
64
+ 3. Open a terminal and `cd` to the cloned folder.
65
+ 4. Run `uv sync` to create a `.venv` and install dependencies.
66
+ 5. (Optional) Install pre-commit hooks: `uv run pre-commit install`
67
+ 6. After making changes, run the test suite: `uv run pytest tests`
68
+
69
+ ## License
70
+
71
+ MIT License - see [LICENSE](LICENSE) for details.
@@ -0,0 +1,57 @@
1
+ # ezmsg-peripheraldevice
2
+
3
+ Short description of your ezmsg package.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install ezmsg-peripheraldevice
9
+ ```
10
+
11
+ ## Dependencies
12
+
13
+ - `ezmsg`
14
+ - `ezmsg-baseproc`
15
+ - `numpy`
16
+ - `pynput`
17
+
18
+ ## Usage
19
+
20
+ ### Mouse Examples
21
+
22
+ **Event-driven mouse listener** - captures every mouse movement event:
23
+
24
+ ```bash
25
+ python examples/mouse_listen.py
26
+ ```
27
+
28
+ **Polling mouse position** - reads mouse position at a fixed rate:
29
+
30
+ ```bash
31
+ python examples/mouse_poll.py --rate 60
32
+ ```
33
+
34
+ ### Programmatic Usage
35
+
36
+ ```python
37
+ import ezmsg.core as ez
38
+ from ezmsg.peripheraldevice import MouseListener, MouseListenerSettings
39
+ from ezmsg.peripheraldevice import MousePoller, MousePollerSettings
40
+ ```
41
+
42
+ > Note: MouseListener requires extra permissions.
43
+
44
+ ## Development
45
+
46
+ We use [`uv`](https://docs.astral.sh/uv/getting-started/installation/) for development.
47
+
48
+ 1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) if not already installed.
49
+ 2. Fork this repository and clone your fork locally.
50
+ 3. Open a terminal and `cd` to the cloned folder.
51
+ 4. Run `uv sync` to create a `.venv` and install dependencies.
52
+ 5. (Optional) Install pre-commit hooks: `uv run pre-commit install`
53
+ 6. After making changes, run the test suite: `uv run pytest tests`
54
+
55
+ ## License
56
+
57
+ MIT License - see [LICENSE](LICENSE) for details.
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = source
9
+ BUILDDIR = build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,35 @@
1
+ @ECHO OFF
2
+
3
+ pushd %~dp0
4
+
5
+ REM Command file for Sphinx documentation
6
+
7
+ if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=sphinx-build
9
+ )
10
+ set SOURCEDIR=source
11
+ set BUILDDIR=build
12
+
13
+ %SPHINXBUILD% >NUL 2>NUL
14
+ if errorlevel 9009 (
15
+ echo.
16
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17
+ echo.installed, then set the SPHINXBUILD environment variable to point
18
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
19
+ echo.may add the Sphinx directory to PATH.
20
+ echo.
21
+ echo.If you don't have Sphinx installed, grab it from
22
+ echo.https://www.sphinx-doc.org/
23
+ exit /b 1
24
+ )
25
+
26
+ if "%1" == "" goto help
27
+
28
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29
+ goto end
30
+
31
+ :help
32
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33
+
34
+ :end
35
+ popd
@@ -0,0 +1,64 @@
1
+ {{ fullname | escape | underline}}
2
+
3
+ .. automodule:: {{ fullname }}
4
+
5
+ {% block attributes %}
6
+ {% if attributes %}
7
+ .. rubric:: Module Attributes
8
+
9
+ .. autosummary::
10
+ :toctree:
11
+ {% for item in attributes %}
12
+ {{ item }}
13
+ {%- endfor %}
14
+ {% endif %}
15
+ {% endblock %}
16
+
17
+ {% block functions %}
18
+ {% if functions %}
19
+ .. rubric:: Functions
20
+
21
+ {% for item in functions %}
22
+ .. autofunction:: {{ item }}
23
+ {%- endfor %}
24
+ {% endif %}
25
+ {% endblock %}
26
+
27
+ {% block classes %}
28
+ {% if classes %}
29
+ .. rubric:: Classes
30
+
31
+ {% for item in classes %}
32
+ .. autoclass:: {{ item }}
33
+ :members:
34
+ :undoc-members:
35
+ :show-inheritance:
36
+ :special-members: __init__
37
+ {%- endfor %}
38
+ {% endif %}
39
+ {% endblock %}
40
+
41
+ {% block exceptions %}
42
+ {% if exceptions %}
43
+ .. rubric:: Exceptions
44
+
45
+ {% for item in exceptions %}
46
+ .. autoexception:: {{ item }}
47
+ :members:
48
+ :show-inheritance:
49
+ {%- endfor %}
50
+ {% endif %}
51
+ {% endblock %}
52
+
53
+ {% block modules %}
54
+ {% if modules %}
55
+ .. rubric:: Modules
56
+
57
+ .. autosummary::
58
+ :toctree:
59
+ :recursive:
60
+ {% for item in modules %}
61
+ {{ item }}
62
+ {%- endfor %}
63
+ {% endif %}
64
+ {% endblock %}
@@ -0,0 +1,11 @@
1
+ API Reference
2
+ =============
3
+
4
+ This page contains auto-generated API reference documentation.
5
+
6
+ .. autosummary::
7
+ :toctree: generated
8
+ :recursive:
9
+ :template: autosummary/module.rst
10
+
11
+ ezmsg.peripheraldevice
@@ -0,0 +1,122 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+
3
+ import os
4
+ import sys
5
+
6
+ # Add the source directory to the path
7
+ sys.path.insert(0, os.path.abspath("../../src"))
8
+
9
+ # -- Project information --------------------------
10
+
11
+ project = "ezmsg.peripheraldevice"
12
+ copyright = "2025, ezmsg Contributors"
13
+ author = "ezmsg Contributors"
14
+
15
+ # The version is managed by hatch-vcs and stored in __version__.py
16
+ try:
17
+ from ezmsg.peripheraldevice.__version__ import version as release
18
+ except ImportError:
19
+ release = "unknown"
20
+
21
+ # For display purposes, extract the base version without git commit info
22
+ version = release.split("+")[0] if release != "unknown" else release
23
+
24
+ # -- General configuration --------------------------
25
+
26
+ extensions = [
27
+ "sphinx.ext.autodoc",
28
+ "sphinx.ext.autosummary",
29
+ "sphinx.ext.napoleon",
30
+ "sphinx.ext.intersphinx",
31
+ "sphinx.ext.viewcode",
32
+ "sphinx.ext.duration",
33
+ "sphinx_autodoc_typehints",
34
+ "sphinx_copybutton",
35
+ "myst_parser", # For markdown files
36
+ ]
37
+
38
+ templates_path = ["_templates"]
39
+ source_suffix = {
40
+ ".rst": "restructuredtext",
41
+ ".md": "markdown",
42
+ }
43
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
44
+
45
+ # The toctree master document
46
+ master_doc = "index"
47
+
48
+ # -- Autodoc configuration ------------------------------
49
+
50
+ # Auto-generate API docs
51
+ autosummary_generate = True
52
+ autosummary_imported_members = False
53
+ autodoc_typehints = "description"
54
+ autodoc_member_order = "bysource"
55
+ autodoc_typehints_format = "short"
56
+ python_use_unqualified_type_names = True
57
+ autodoc_default_options = {
58
+ "members": True,
59
+ "member-order": "bysource",
60
+ "special-members": "__init__",
61
+ "undoc-members": True,
62
+ "show-inheritance": True,
63
+ }
64
+
65
+ # Don't show the full module path in the docs
66
+ add_module_names = False
67
+
68
+ # -- Intersphinx configuration --------------------------
69
+
70
+ intersphinx_mapping = {
71
+ "python": ("https://docs.python.org/3/", None),
72
+ "numpy": ("https://numpy.org/doc/stable/", None),
73
+ "ezmsg": ("https://www.ezmsg.org/ezmsg/", None),
74
+ }
75
+ intersphinx_disabled_domains = ["std"]
76
+
77
+ # -- Options for HTML output -----------------------------
78
+
79
+ html_theme = "pydata_sphinx_theme"
80
+ html_static_path = ["_static"]
81
+
82
+ # Set the base URL for the documentation
83
+ html_baseurl = "https://www.ezmsg.org/ezmsg-peripheraldevice/"
84
+
85
+ html_theme_options = {
86
+ "logo": {
87
+ "text": f"ezmsg.peripheraldevice {version}",
88
+ "link": "https://ezmsg.org",
89
+ },
90
+ "header_links_before_dropdown": 4,
91
+ "navbar_start": ["navbar-logo"],
92
+ "navbar_end": ["theme-switcher", "navbar-icon-links"],
93
+ "icon_links": [
94
+ {
95
+ "name": "GitHub",
96
+ "url": "https://github.com/ezmsg-org/ezmsg-peripheraldevice",
97
+ "icon": "fa-brands fa-github",
98
+ },
99
+ {
100
+ "name": "ezmsg.org",
101
+ "url": "https://www.ezmsg.org",
102
+ "icon": "fa-solid fa-house",
103
+ },
104
+ ],
105
+ }
106
+
107
+ # Timestamp is inserted at every page bottom in this strftime format.
108
+ html_last_updated_fmt = "%Y-%m-%d"
109
+
110
+ # -- Options for linkcode -----------------------------
111
+
112
+ branch = "main"
113
+ code_url = f"https://github.com/ezmsg-org/ezmsg-peripheraldevice/blob/{branch}/"
114
+
115
+
116
+ def linkcode_resolve(domain, info):
117
+ if domain != "py":
118
+ return None
119
+ if not info["module"]:
120
+ return None
121
+ filename = info["module"].replace(".", "/")
122
+ return f"{code_url}src/{filename}.py"
@@ -0,0 +1,16 @@
1
+ ```{include} ../../README.md
2
+ ```
3
+
4
+ ## Documentation
5
+
6
+ ```{toctree}
7
+ :maxdepth: 2
8
+ :caption: Contents:
9
+
10
+ api/index
11
+ ```
12
+
13
+ ## Indices and tables
14
+
15
+ - {ref}`genindex`
16
+ - {ref}`modindex`