Skip to content

Commit 089f525

Browse files
committed
public javascript release.
1 parent 808d338 commit 089f525

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+19030
-267
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dist/
2+
node_modules/
3+
*.wasm
4+
*.mjs
5+
scripts/build.js

.eslintrc.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2022": true,
5+
"node": true
6+
},
7+
"extends": ["eslint:recommended"],
8+
"parser": "espree",
9+
"parserOptions": {
10+
"ecmaVersion": "latest",
11+
"sourceType": "module"
12+
},
13+
"plugins": [],
14+
"rules": {
15+
"no-unused-vars": [
16+
"error",
17+
{
18+
"argsIgnorePattern": "^_"
19+
}
20+
],
21+
"prefer-const": "error",
22+
"no-var": "error",
23+
"object-shorthand": "error",
24+
"prefer-template": "error"
25+
},
26+
"overrides": [
27+
{
28+
"files": ["wasm/test/**/*.js"],
29+
"rules": {
30+
"no-console": "off"
31+
}
32+
}
33+
]
34+
}

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: [BrianPugh]# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
3+
github: [BrianPugh]
44
patreon: # Replace with a single Patreon username
55
open_collective: # Replace with a single Open Collective username
66
ko_fi: # Replace with a single Ko-fi username

.github/contributing.md

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,61 @@
11
## Environment Setup
22

3-
1. We use [Poetry](https://python-poetry.org/docs/#installation) for managing virtual environments and dependencies.
4-
Once Poetry is installed, run `poetry install` in this repo to get started.
5-
2. For managing linters, static-analysis, and other tools, we use [pre-commit](https://pre-commit.com/#installation).
6-
Once Pre-commit is installed, run `pre-commit install` in this repo to install the hooks.
7-
Using pre-commit ensures PRs match the linting requirements of the codebase.
3+
1. We use [Poetry](https://python-poetry.org/docs/#installation) for managing
4+
virtual environments and dependencies. Once Poetry is installed, run
5+
`poetry install` in this repo to get started.
6+
2. For managing linters, static-analysis, and other tools, we use
7+
[pre-commit](https://pre-commit.com/#installation). Once Pre-commit is
8+
installed, run `pre-commit install` in this repo to install the hooks. Using
9+
pre-commit ensures PRs match the linting requirements of the codebase.
810

911
## Documentation
10-
Whenever possible, please add docstrings to your code!
11-
We use [numpy-style napoleon docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/#google-vs-numpy).
12-
To confirm docstrings are valid, build the docs by running `poetry run make html` in the `docs/` folder.
1312

14-
I typically write dosctrings first, it will act as a guide to limit scope and encourage unit-testable code.
15-
Good docstrings include information like:
13+
Whenever possible, please add docstrings to your code! We use
14+
[numpy-style napoleon docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/#google-vs-numpy).
15+
To confirm docstrings are valid, build the docs by running
16+
`poetry run make html` in the `docs/` folder.
1617

17-
1. If not immediately obvious, what is the intended use-case? When should this function be used?
18+
I typically write dosctrings first, it will act as a guide to limit scope and
19+
encourage unit-testable code. Good docstrings include information like:
20+
21+
1. If not immediately obvious, what is the intended use-case? When should this
22+
function be used?
1823
2. What happens during errors/edge-cases.
1924
3. When dealing with physical values, include units.
2025

2126
## Unit Tests
22-
We use the [pytest](https://docs.pytest.org/) framework for unit testing. Ideally, all new code is partners with
23-
new unit tests to exercise that code. If fixing a bug, consider writing the test first to confirm the existence of the
27+
28+
We use the [pytest](https://docs.pytest.org/) framework for unit testing.
29+
Ideally, all new code is partners with new unit tests to exercise that code. If
30+
fixing a bug, consider writing the test first to confirm the existence of the
2431
bug, and to confirm that the new code fixes it.
2532

26-
Unit tests should only test a single concise body of code. If this is hard to do, there are two solutions that can help:
27-
1. Restructure the code. Keep inputs/outputs to be simple variables. Avoid complicated interactions with state.
28-
2. Use [pytest-mock](https://pytest-mock.readthedocs.io/en/latest/) to mock out external interactions.
33+
Unit tests should only test a single concise body of code. If this is hard to
34+
do, there are two solutions that can help:
35+
36+
1. Restructure the code. Keep inputs/outputs to be simple variables. Avoid
37+
complicated interactions with state.
38+
2. Use [pytest-mock](https://pytest-mock.readthedocs.io/en/latest/) to mock out
39+
external interactions.
2940

3041
## Coding Style
31-
In an attempt to keep consistency and maintainability in the code-base, here are some high-level guidelines for code that might not be enforced by linters.
32-
33-
* Use f-strings.
34-
* Keep/cast path variables as `pathlib.Path` objects.
35-
Do not use `os.path`.
36-
For public-facing functions, cast path arguments immediately to `Path`.
37-
* Use magic-methods when appropriate. It might be better to implement ``MyClass.__call__()`` instead of ``MyClass.run()``.
38-
* Do not return sentinel values for error-states like `-1` or `None`. Instead, raise an exception.
39-
* Avoid deeply nested code. Techniques like returning early and breaking up a complicated function into multiple functions results in easier to read and test code.
40-
* Consider if you are double-name-spacing and how modules are meant to be imported.
41-
E.g. it might be better to name a function `read` instead of `image_read` in the module `my_package/image.py`.
42-
Consider the module name-space and whether or not it's flattened in `__init__.py`.
43-
* Only use multiple-inheritance if using a mixin. Mixin classes should end in `"Mixin"`.
42+
43+
In an attempt to keep consistency and maintainability in the code-base, here are
44+
some high-level guidelines for code that might not be enforced by linters.
45+
46+
- Use f-strings.
47+
- Keep/cast path variables as `pathlib.Path` objects. Do not use `os.path`. For
48+
public-facing functions, cast path arguments immediately to `Path`.
49+
- Use magic-methods when appropriate. It might be better to implement
50+
`MyClass.__call__()` instead of `MyClass.run()`.
51+
- Do not return sentinel values for error-states like `-1` or `None`. Instead,
52+
raise an exception.
53+
- Avoid deeply nested code. Techniques like returning early and breaking up a
54+
complicated function into multiple functions results in easier to read and
55+
test code.
56+
- Consider if you are double-name-spacing and how modules are meant to be
57+
imported. E.g. it might be better to name a function `read` instead of
58+
`image_read` in the module `my_package/image.py`. Consider the module
59+
name-space and whether or not it's flattened in `__init__.py`.
60+
- Only use multiple-inheritance if using a mixin. Mixin classes should end in
61+
`"Mixin"`.

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "pip" # See documentation for possible values
9-
directory: "/" # Location of package manifests
8+
- package-ecosystem: 'pip' # See documentation for possible values
9+
directory: '/' # Location of package manifests
1010
schedule:
11-
interval: "weekly"
11+
interval: 'weekly'

.github/workflows/build_wheels.yaml

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ on:
55
pull_request:
66
push:
77
tags:
8-
- "v*.*.*"
8+
- 'v*.*.*'
99

1010
jobs:
1111
build_sdist:
12-
name: "sdist"
12+
name: 'sdist'
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
fail-fast: false
1616
matrix:
1717
os: [ubuntu-latest]
1818
env:
1919
PYTHON: 3.12
20-
POETRY_HOME: "~/poetry"
20+
POETRY_HOME: '~/poetry'
2121

2222
steps:
2323
- name: Check out repository
@@ -64,23 +64,23 @@ jobs:
6464
path: dist/*.tar.gz
6565

6666
build_wheels_windows:
67-
name: "${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}"
67+
name: '${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}'
6868
runs-on: ${{ matrix.os }}
6969
strategy:
7070
fail-fast: false
7171
matrix:
7272
os: [windows-latest]
73-
cibw_build: ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"]
74-
cibw_archs: ["AMD64", "x86", "ARM64"]
73+
cibw_build: ['cp38-*', 'cp39-*', 'cp310-*', 'cp311-*', 'cp312-*']
74+
cibw_archs: ['AMD64', 'x86', 'ARM64']
7575
exclude:
7676
- os: windows-latest
77-
cibw_build: "cp38-*"
78-
cibw_archs: "ARM64"
77+
cibw_build: 'cp38-*'
78+
cibw_archs: 'ARM64'
7979
env:
8080
PYTHON: 3.12
8181

8282
steps:
83-
- name: "Set environment variables (Windows)"
83+
- name: 'Set environment variables (Windows)'
8484
shell: pwsh
8585
run: |
8686
(Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled
@@ -105,7 +105,7 @@ jobs:
105105
env:
106106
CIBW_ARCHS: ${{ matrix.cibw_archs }}
107107
CIBW_BUILD: ${{ matrix.cibw_build }}
108-
CIBW_TEST_SKIP: "*-win_arm64"
108+
CIBW_TEST_SKIP: '*-win_arm64'
109109
CIBW_TEST_REQUIRES: pytest
110110
CIBW_TEST_COMMAND: pytest {package}/tests
111111

@@ -115,14 +115,14 @@ jobs:
115115
path: wheelhouse/*.whl
116116

117117
build_wheels_linux:
118-
name: "${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}"
118+
name: '${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}'
119119
runs-on: ${{ matrix.os }}
120120
strategy:
121121
fail-fast: false
122122
matrix:
123-
os: [ubuntu-22.04] # TODO: change back to ubuntu-latest; see https://github.com/actions/runner-images/issues/11471
124-
cibw_build: ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"]
125-
cibw_archs: ["x86_64", "i686", "aarch64", "ppc64le"]
123+
os: [ubuntu-22.04] # TODO: change back to ubuntu-latest; see https://github.com/actions/runner-images/issues/11471
124+
cibw_build: ['cp38-*', 'cp39-*', 'cp310-*', 'cp311-*', 'cp312-*']
125+
cibw_archs: ['x86_64', 'i686', 'aarch64', 'ppc64le']
126126
env:
127127
PYTHON: 3.12
128128

@@ -162,14 +162,14 @@ jobs:
162162
path: wheelhouse/*.whl
163163

164164
build_wheels_macos:
165-
name: "${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}"
165+
name: '${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}'
166166
runs-on: ${{ matrix.os }}
167167
strategy:
168168
fail-fast: false
169169
matrix:
170170
os: [macos-13] # x86_64 runner
171-
cibw_build: ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"]
172-
cibw_archs: ["x86_64"]
171+
cibw_build: ['cp38-*', 'cp39-*', 'cp310-*', 'cp311-*', 'cp312-*']
172+
cibw_archs: ['x86_64']
173173
env:
174174
PYTHON: 3.12
175175
SYSTEM_VERSION_COMPAT: 0 # https://github.com/actions/setup-python/issues/469#issuecomment-1192522949
@@ -204,13 +204,13 @@ jobs:
204204
path: wheelhouse/*.whl
205205

206206
build_wheels_macos_arm64:
207-
name: "${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}"
207+
name: '${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}'
208208
runs-on: ${{ matrix.os }}
209209
strategy:
210210
matrix:
211211
os: [macos-14] # ARM runner
212-
cibw_build: ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"]
213-
cibw_archs: ["arm64"]
212+
cibw_build: ['cp38-*', 'cp39-*', 'cp310-*', 'cp311-*', 'cp312-*']
213+
cibw_archs: ['arm64']
214214
env:
215215
PYTHON: 3.12
216216

@@ -235,7 +235,7 @@ jobs:
235235
env:
236236
CIBW_BUILD: ${{ matrix.cibw_build }}
237237
CIBW_ARCHS: ${{ matrix.cibw_archs }}
238-
CIBW_TEST_SKIP: "*-macosx_arm64"
238+
CIBW_TEST_SKIP: '*-macosx_arm64'
239239
CIBW_TEST_REQUIRES: pytest
240240
CIBW_TEST_COMMAND: pytest {package}/tests
241241
CIBW_REPAIR_WHEEL_COMMAND: |
@@ -269,13 +269,7 @@ jobs:
269269
upload_to_pypi:
270270
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
271271
needs:
272-
[
273-
"build_sdist",
274-
"build_wheels_windows",
275-
"build_wheels_linux",
276-
"build_wheels_macos",
277-
"build_wheels_macos_arm64",
278-
]
272+
['build_sdist', 'build_wheels_windows', 'build_wheels_linux', 'build_wheels_macos', 'build_wheels_macos_arm64']
279273
runs-on: ubuntu-latest
280274
steps:
281275
- uses: actions/download-artifact@v4
Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
name: Espressif Component Registry
2-
3-
on:
4-
workflow_dispatch:
5-
pull_request:
6-
push:
7-
tags:
8-
- "v*.*.*"
9-
10-
jobs:
11-
upload_components:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v4
15-
with:
16-
submodules: recursive
17-
18-
- name: Set up python 3.11
19-
uses: actions/setup-python@v5
20-
with:
21-
python-version: "3.11"
22-
23-
- name: Install compote
24-
run: |
25-
pip install "idf-component-manager~=1.3"
26-
27-
- name: Copy source into espidf
28-
run: |
29-
# cp README.md espidf/ # TODO: convert main README to md
30-
cp -r tamp/_c_src/* espidf/
31-
32-
- name: Build package
33-
working-directory: ./espidf
34-
run: |
35-
make component
36-
37-
- name: Upload artifact
38-
uses: actions/upload-artifact@v4
39-
with:
40-
name: esp-idf-component
41-
path: espidf/dist/*.tgz
42-
43-
- name: Publish to ESP Component Registry
44-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
45-
working-directory: ./espidf
46-
env:
47-
IDF_COMPONENT_API_TOKEN: ${{ secrets.ESP_IDF_COMPONENT_API_TOKEN }}
48-
run: |
49-
compote component upload --namespace=brianpugh --name=tamp --version=git
1+
name: Espressif Component Registry
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
tags:
8+
- 'v*.*.*'
9+
10+
jobs:
11+
upload_components:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
submodules: recursive
17+
18+
- name: Set up python 3.11
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Install compote
24+
run: |
25+
pip install "idf-component-manager~=1.3"
26+
27+
- name: Copy source into espidf
28+
run: |
29+
# cp README.md espidf/ # TODO: convert main README to md
30+
cp -r tamp/_c_src/* espidf/
31+
32+
- name: Build package
33+
working-directory: ./espidf
34+
run: |
35+
make component
36+
37+
- name: Upload artifact
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: esp-idf-component
41+
path: espidf/dist/*.tgz
42+
43+
- name: Publish to ESP Component Registry
44+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
45+
working-directory: ./espidf
46+
env:
47+
IDF_COMPONENT_API_TOKEN: ${{ secrets.ESP_IDF_COMPONENT_API_TOKEN }}
48+
run: |
49+
compote component upload --namespace=brianpugh --name=tamp --version=git

0 commit comments

Comments
 (0)