robot-hat 1.7.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.
Files changed (51) hide show
  1. robot_hat-1.7.1/.github/workflows/ci.yml +134 -0
  2. robot_hat-1.7.1/.gitignore +165 -0
  3. robot_hat-1.7.1/.pre-commit-config.yaml +12 -0
  4. robot_hat-1.7.1/LICENSE +674 -0
  5. robot_hat-1.7.1/PKG-INFO +376 -0
  6. robot_hat-1.7.1/README.md +357 -0
  7. robot_hat-1.7.1/pyproject.toml +37 -0
  8. robot_hat-1.7.1/pyrightconfig.json +5 -0
  9. robot_hat-1.7.1/robot_hat/__init__.py +91 -0
  10. robot_hat-1.7.1/robot_hat/accelerometer.py +103 -0
  11. robot_hat-1.7.1/robot_hat/adc.py +126 -0
  12. robot_hat-1.7.1/robot_hat/address_descriptions.py +41 -0
  13. robot_hat-1.7.1/robot_hat/battery.py +44 -0
  14. robot_hat-1.7.1/robot_hat/exceptions.py +128 -0
  15. robot_hat-1.7.1/robot_hat/filedb.py +290 -0
  16. robot_hat-1.7.1/robot_hat/grayscale.py +180 -0
  17. robot_hat-1.7.1/robot_hat/i2c.py +681 -0
  18. robot_hat-1.7.1/robot_hat/mock/__init__.py +0 -0
  19. robot_hat-1.7.1/robot_hat/mock/smbus2.py +236 -0
  20. robot_hat-1.7.1/robot_hat/mock/ultrasonic.py +64 -0
  21. robot_hat-1.7.1/robot_hat/motor/__init__.py +0 -0
  22. robot_hat-1.7.1/robot_hat/motor/config.py +73 -0
  23. robot_hat-1.7.1/robot_hat/motor/motor.py +236 -0
  24. robot_hat-1.7.1/robot_hat/motor/motor_fabric.py +92 -0
  25. robot_hat-1.7.1/robot_hat/music.py +498 -0
  26. robot_hat-1.7.1/robot_hat/pin.py +482 -0
  27. robot_hat-1.7.1/robot_hat/pin_descriptions.py +16 -0
  28. robot_hat-1.7.1/robot_hat/pwm.py +423 -0
  29. robot_hat-1.7.1/robot_hat/robot.py +235 -0
  30. robot_hat-1.7.1/robot_hat/services/__init__.py +0 -0
  31. robot_hat-1.7.1/robot_hat/services/motor_service.py +236 -0
  32. robot_hat-1.7.1/robot_hat/services/servo_service.py +292 -0
  33. robot_hat-1.7.1/robot_hat/servo.py +144 -0
  34. robot_hat-1.7.1/robot_hat/ultrasonic.py +126 -0
  35. robot_hat-1.7.1/robot_hat/utils.py +161 -0
  36. robot_hat-1.7.1/robot_hat/version.py +16 -0
  37. robot_hat-1.7.1/robot_hat.egg-info/PKG-INFO +376 -0
  38. robot_hat-1.7.1/robot_hat.egg-info/SOURCES.txt +49 -0
  39. robot_hat-1.7.1/robot_hat.egg-info/dependency_links.txt +1 -0
  40. robot_hat-1.7.1/robot_hat.egg-info/not-zip-safe +1 -0
  41. robot_hat-1.7.1/robot_hat.egg-info/requires.txt +10 -0
  42. robot_hat-1.7.1/robot_hat.egg-info/top_level.txt +2 -0
  43. robot_hat-1.7.1/setup.cfg +4 -0
  44. robot_hat-1.7.1/setup.py +7 -0
  45. robot_hat-1.7.1/tests/__init__.py +0 -0
  46. robot_hat-1.7.1/tests/test_filedb.py +158 -0
  47. robot_hat-1.7.1/tests/test_i2c.py +152 -0
  48. robot_hat-1.7.1/tests/test_motor.py +146 -0
  49. robot_hat-1.7.1/tests/test_motor_service.py +235 -0
  50. robot_hat-1.7.1/tests/test_pin.py +163 -0
  51. robot_hat-1.7.1/tests/test_servo_service.py +155 -0
@@ -0,0 +1,134 @@
1
+ name: CI & Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+ branches:
8
+ - main
9
+ pull_request:
10
+ branches:
11
+ - main
12
+ workflow_dispatch:
13
+
14
+ jobs:
15
+ lint-and-test:
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - name: Checkout code
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Set up Python ${{ matrix.python-version }}
23
+ uses: actions/setup-python@v5
24
+ with:
25
+ python-version: |
26
+ 3.11
27
+ 3.12
28
+ 3.13
29
+
30
+ - name: Install Node.js (needed for Pyright)
31
+ uses: actions/setup-node@v4
32
+ with:
33
+ node-version: current
34
+
35
+ - name: Install dependencies
36
+ run: |
37
+ python -m pip install --upgrade pip
38
+ pip install .[dev]
39
+ pip install pytest pytest-cov
40
+
41
+ - name: Install Pyright
42
+ run: npm install -g pyright
43
+
44
+ - name: Run Pyright static type checker
45
+ run: pyright
46
+
47
+ - name: Lint code
48
+ run: |
49
+ black --check .
50
+ isort --profile black --check-only .
51
+
52
+ - name: Run tests with unittest and measure coverage
53
+ run: |
54
+ coverage run -m unittest discover
55
+ coverage xml
56
+ coverage report
57
+
58
+ - name: Upload coverage to Codecov
59
+ uses: codecov/codecov-action@v5
60
+ with:
61
+ token: ${{ secrets.CODECOV_TOKEN }}
62
+
63
+ build:
64
+ runs-on: ubuntu-latest
65
+
66
+ steps:
67
+ - name: Checkout code
68
+ uses: actions/checkout@v4
69
+
70
+ - name: Set up Python
71
+ uses: actions/setup-python@v5
72
+ with:
73
+ python-version: 3.11
74
+
75
+ - name: Install build tools
76
+ run: |
77
+ python -m pip install --upgrade pip
78
+ pip install build setuptools
79
+
80
+ - name: Build the package
81
+ run: python -m build
82
+
83
+ - name: Verify dist directory
84
+ run: ls -al dist/
85
+
86
+ - name: Upload the dist directory as an artifact
87
+ uses: actions/upload-artifact@v4
88
+ with:
89
+ name: dist
90
+ path: dist/
91
+
92
+ publish:
93
+ if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v') }}
94
+ needs:
95
+ - build
96
+ - lint-and-test
97
+ runs-on: ubuntu-latest
98
+
99
+ steps:
100
+ - name: Download the dist artifact
101
+ uses: actions/download-artifact@v4
102
+ with:
103
+ name: dist
104
+
105
+ - name: Verify contents of dist directory after artifact download
106
+ run: |
107
+ echo "Listing contents of the workspace:"
108
+ ls -al
109
+
110
+ - name: Organize artifact files into dist/
111
+ run: |
112
+ mkdir -p dist # Create the dist directory if it doesn't exist
113
+ echo "Moving downloaded files to dist/..."
114
+ mv robot_hat-*.whl robot_hat-*.tar.gz dist/ # Move files matching artifact content into dist/
115
+ echo "Contents of workspace after organizing:"
116
+ ls -al
117
+ echo "Contents of 'dist/' after organizing:"
118
+ ls -al dist/
119
+
120
+ - name: Set up Python
121
+ uses: actions/setup-python@v5
122
+ with:
123
+ python-version: 3.11
124
+
125
+ - name: Install Twine
126
+ run: |
127
+ python -m pip install --upgrade pip
128
+ pip install twine
129
+
130
+ - name: Publish to PyPI
131
+ env:
132
+ TWINE_USERNAME: __token__
133
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
134
+ run: python -m twine upload dist/*
@@ -0,0 +1,165 @@
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
+ # app version
30
+ /robot_hat/version.py
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py,cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ # For a library or package, you might want to ignore these files since the code is
90
+ # intended to run in multiple environments; otherwise, check them in:
91
+ # .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ #Pipfile.lock
99
+
100
+ # poetry
101
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
102
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
103
+ # commonly ignored for libraries.
104
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
105
+ #poetry.lock
106
+
107
+ # pdm
108
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
109
+ #pdm.lock
110
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
111
+ # in version control.
112
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
113
+ .pdm.toml
114
+ .pdm-python
115
+ .pdm-build/
116
+
117
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
118
+ __pypackages__/
119
+
120
+ # Celery stuff
121
+ celerybeat-schedule
122
+ celerybeat.pid
123
+
124
+ # SageMath parsed files
125
+ *.sage.py
126
+
127
+ # Environments
128
+ .env
129
+ .venv
130
+ env/
131
+ venv/
132
+ ENV/
133
+ env.bak/
134
+ venv.bak/
135
+
136
+ # Spyder project settings
137
+ .spyderproject
138
+ .spyproject
139
+
140
+ # Rope project settings
141
+ .ropeproject
142
+
143
+ # mkdocs documentation
144
+ /site
145
+
146
+ # mypy
147
+ .mypy_cache/
148
+ .dmypy.json
149
+ dmypy.json
150
+
151
+ # Pyre type checker
152
+ .pyre/
153
+
154
+ # pytype static type analyzer
155
+ .pytype/
156
+
157
+ # Cython debug symbols
158
+ cython_debug/
159
+
160
+ # PyCharm
161
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
162
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
163
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
164
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
165
+ #.idea/
@@ -0,0 +1,12 @@
1
+ repos:
2
+ - repo: https://github.com/psf/black
3
+ rev: 24.10.0
4
+ hooks:
5
+ - id: black
6
+ args: ["--line-length=88"]
7
+
8
+ - repo: https://github.com/PyCQA/isort
9
+ rev: 5.13.2
10
+ hooks:
11
+ - id: isort
12
+ args: ["--profile", "black"]