vitallens-core 0.2.2__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.
- vitallens_core-0.2.2/.github/workflows/ci.yml +51 -0
- vitallens_core-0.2.2/.github/workflows/release.yml +73 -0
- vitallens_core-0.2.2/.gitignore +34 -0
- vitallens_core-0.2.2/CONTRIBUTING.md +110 -0
- vitallens_core-0.2.2/Cargo.lock +1213 -0
- vitallens_core-0.2.2/Cargo.toml +51 -0
- vitallens_core-0.2.2/LICENSE +21 -0
- vitallens_core-0.2.2/Makefile +151 -0
- vitallens_core-0.2.2/PKG-INFO +61 -0
- vitallens_core-0.2.2/Package.swift +28 -0
- vitallens_core-0.2.2/README.md +51 -0
- vitallens_core-0.2.2/bindings/swift/VitalLensCore.swift +3125 -0
- vitallens_core-0.2.2/build.rs +1 -0
- vitallens_core-0.2.2/docs/ios.md +104 -0
- vitallens_core-0.2.2/docs/js.md +115 -0
- vitallens_core-0.2.2/docs/python.md +41 -0
- vitallens_core-0.2.2/pyproject.toml +17 -0
- vitallens_core-0.2.2/scripts/prepare_test_data.py +285 -0
- vitallens_core-0.2.2/src/bin/uniffi-bindgen.rs +3 -0
- vitallens_core-0.2.2/src/bindings/mod.rs +1 -0
- vitallens_core-0.2.2/src/bindings/python.rs +136 -0
- vitallens_core-0.2.2/src/geometry/mod.rs +1 -0
- vitallens_core-0.2.2/src/geometry/roi.rs +370 -0
- vitallens_core-0.2.2/src/lib.rs +66 -0
- vitallens_core-0.2.2/src/registry.rs +485 -0
- vitallens_core-0.2.2/src/signal/bp.rs +265 -0
- vitallens_core-0.2.2/src/signal/fft.rs +414 -0
- vitallens_core-0.2.2/src/signal/filters.rs +508 -0
- vitallens_core-0.2.2/src/signal/hrv.rs +757 -0
- vitallens_core-0.2.2/src/signal/mod.rs +23 -0
- vitallens_core-0.2.2/src/signal/peaks.rs +671 -0
- vitallens_core-0.2.2/src/signal/rate.rs +202 -0
- vitallens_core-0.2.2/src/signal/resp.rs +167 -0
- vitallens_core-0.2.2/src/state/frames.rs +432 -0
- vitallens_core-0.2.2/src/state/mod.rs +3 -0
- vitallens_core-0.2.2/src/state/series.rs +207 -0
- vitallens_core-0.2.2/src/state/session.rs +736 -0
- vitallens_core-0.2.2/src/types.rs +398 -0
- vitallens_core-0.2.2/tests/fixtures/sample_video_1.json +3959 -0
- vitallens_core-0.2.2/tests/fixtures/sample_video_2.json +7026 -0
- vitallens_core-0.2.2/tests/fixtures/sample_video_3.json +20032 -0
- vitallens_core-0.2.2/tests/fixtures/sample_video_4.json +21252 -0
- vitallens_core-0.2.2/tests/fixtures/sample_video_5.json +37388 -0
- vitallens_core-0.2.2/tests/fixtures/sample_video_6.json +22767 -0
- vitallens_core-0.2.2/tests/hrv_tests.rs +432 -0
- vitallens_core-0.2.2/tests/peaks_tests.rs +203 -0
- vitallens_core-0.2.2/tests/rate_tests.rs +148 -0
- vitallens_core-0.2.2/tests/resp_tests.rs +105 -0
- vitallens_core-0.2.2/tests/session_tests.rs +364 -0
- vitallens_core-0.2.2/uniffi.toml +6 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
core-and-web-linux:
|
|
11
|
+
name: Linux Checks (Core, Python, Web)
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout repository
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Rust
|
|
19
|
+
uses: dtolnay/rust-toolchain@stable
|
|
20
|
+
with:
|
|
21
|
+
targets: wasm32-unknown-unknown
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: '3.10'
|
|
27
|
+
|
|
28
|
+
- name: Run Core Tests
|
|
29
|
+
run: make test
|
|
30
|
+
|
|
31
|
+
- name: Check Python Bindings
|
|
32
|
+
run: make check-python
|
|
33
|
+
|
|
34
|
+
- name: Check WebAssembly
|
|
35
|
+
run: make check-web
|
|
36
|
+
|
|
37
|
+
apple-macos:
|
|
38
|
+
name: Apple Checks (iOS, macOS)
|
|
39
|
+
runs-on: macos-latest
|
|
40
|
+
|
|
41
|
+
steps:
|
|
42
|
+
- name: Checkout repository
|
|
43
|
+
uses: actions/checkout@v4
|
|
44
|
+
|
|
45
|
+
- name: Set up Rust
|
|
46
|
+
uses: dtolnay/rust-toolchain@stable
|
|
47
|
+
with:
|
|
48
|
+
targets: aarch64-apple-ios, aarch64-apple-ios-sim, x86_64-apple-ios, aarch64-apple-darwin, x86_64-apple-darwin
|
|
49
|
+
|
|
50
|
+
- name: Check Apple Bindings
|
|
51
|
+
run: make check-apple
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
name: Publish NPM and PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
npm-release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Install Rust
|
|
14
|
+
uses: dtolnay/rust-toolchain@stable
|
|
15
|
+
with:
|
|
16
|
+
targets: wasm32-unknown-unknown
|
|
17
|
+
- uses: jetli/wasm-pack-action@v0.4.0
|
|
18
|
+
- uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: '20.x'
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
22
|
+
- name: Build and Publish
|
|
23
|
+
run: |
|
|
24
|
+
wasm-pack build --target web --no-default-features
|
|
25
|
+
cd pkg
|
|
26
|
+
npm publish
|
|
27
|
+
env:
|
|
28
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
29
|
+
|
|
30
|
+
python-release:
|
|
31
|
+
runs-on: ${{ matrix.os }}
|
|
32
|
+
strategy:
|
|
33
|
+
matrix:
|
|
34
|
+
include:
|
|
35
|
+
- os: ubuntu-latest
|
|
36
|
+
args: --release --out dist --features python --sdist
|
|
37
|
+
- os: macos-latest
|
|
38
|
+
args: --release --out dist --features python --target universal2-apple-darwin
|
|
39
|
+
- os: windows-latest
|
|
40
|
+
args: --release --out dist --features python
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
- uses: actions/setup-python@v5
|
|
44
|
+
with:
|
|
45
|
+
python-version: '3.10'
|
|
46
|
+
- name: Install macOS Rust Targets
|
|
47
|
+
if: matrix.os == 'macos-latest'
|
|
48
|
+
run: rustup target add x86_64-apple-darwin aarch64-apple-darwin
|
|
49
|
+
- name: Build wheels
|
|
50
|
+
uses: PyO3/maturin-action@v1
|
|
51
|
+
with:
|
|
52
|
+
command: build
|
|
53
|
+
args: ${{ matrix.args }}
|
|
54
|
+
- name: Upload artifacts
|
|
55
|
+
uses: actions/upload-artifact@v4
|
|
56
|
+
with:
|
|
57
|
+
name: wheels-${{ matrix.os }}
|
|
58
|
+
path: dist
|
|
59
|
+
|
|
60
|
+
publish-pypi:
|
|
61
|
+
needs: python-release
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
environment: pypi
|
|
64
|
+
permissions:
|
|
65
|
+
id-token: write
|
|
66
|
+
steps:
|
|
67
|
+
- uses: actions/download-artifact@v4
|
|
68
|
+
with:
|
|
69
|
+
pattern: wheels-*
|
|
70
|
+
merge-multiple: true
|
|
71
|
+
path: dist
|
|
72
|
+
- name: Publish to PyPI
|
|
73
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Rust
|
|
2
|
+
/target
|
|
3
|
+
**/*.rs.bk
|
|
4
|
+
|
|
5
|
+
# Python
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
*.egg-info/
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
|
|
14
|
+
# Maturin / PyO3 artifacts
|
|
15
|
+
*.so
|
|
16
|
+
*.dylib
|
|
17
|
+
*.dll
|
|
18
|
+
|
|
19
|
+
# Web / Wasm
|
|
20
|
+
pkg/
|
|
21
|
+
|
|
22
|
+
# IDEs
|
|
23
|
+
.idea/
|
|
24
|
+
.vscode/
|
|
25
|
+
*.swp
|
|
26
|
+
*.swo
|
|
27
|
+
|
|
28
|
+
# Mac
|
|
29
|
+
.DS_Store
|
|
30
|
+
|
|
31
|
+
# Bindings
|
|
32
|
+
/bindings/headers/
|
|
33
|
+
/bindings/swift/VitalLensCoreFFI.h
|
|
34
|
+
/bindings/swift/VitalLensCoreFFI.modulemap
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Contributing & Development Guide
|
|
2
|
+
|
|
3
|
+
This guide covers setting up the development environment, running tests, and building targets for **vitallens-core**.
|
|
4
|
+
|
|
5
|
+
## Environment Setup
|
|
6
|
+
|
|
7
|
+
You need the following toolchains installed (assuming macOS):
|
|
8
|
+
|
|
9
|
+
**1. Rust & Cargo**
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
13
|
+
rustup default stable
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**2. Python (Virtual Env & Maturin)**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
brew install python@3.10
|
|
20
|
+
pip3 install maturin
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**3. WebAssembly (wasm-pack)**
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**4. Apple Targets & Tools**
|
|
30
|
+
|
|
31
|
+
Ensure Xcode Command Line Tools are installed (required for `lipo` and `xcodebuild`). Add the Rust compilation targets:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios aarch64-apple-darwin x86_64-apple-darwin
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Build & Test Commands
|
|
38
|
+
|
|
39
|
+
We use a `Makefile` to automate tasks.
|
|
40
|
+
|
|
41
|
+
| Command | Description |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `make check` | Runs syntax checks across all targets and standard Rust unit tests. Fast. |
|
|
44
|
+
| `make build` | Runs full, optimized release builds for Python, Apple, and Web. |
|
|
45
|
+
| `make test` | Runs standard Rust unit tests (`cargo test`). |
|
|
46
|
+
| `make check-<target>` | Runs `cargo check` for `<target>` (`python`, `apple`, `web`). |
|
|
47
|
+
| `make build-<target>` | Compiles release artifacts for `<target>`. |
|
|
48
|
+
| `make clean` | Removes build artifacts (`target/`, `pkg/`, `bindings/swift/`). |
|
|
49
|
+
|
|
50
|
+
## Detailed Workflows
|
|
51
|
+
|
|
52
|
+
### Core Rust Logic
|
|
53
|
+
|
|
54
|
+
To run unit tests manually:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
cargo test
|
|
58
|
+
cargo test -- --nocapture # Show print statements
|
|
59
|
+
cargo test --test session_tests # Run specific test suite
|
|
60
|
+
cargo test test_logic_irregular_rhythm # Test specific function
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Python Bindings (PyO3 + Maturin)
|
|
64
|
+
|
|
65
|
+
To test Python bindings locally without building a release wheel:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
maturin develop --features python
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This builds and installs the extension directly into your active virtual environment.
|
|
72
|
+
|
|
73
|
+
### Apple Bindings (UniFFI)
|
|
74
|
+
|
|
75
|
+
Running `make build-apple` handles compiling for physical devices, Intel/Apple Silicon simulators, merging binaries via `lipo`, generating Swift headers, and packaging the final XCFramework.
|
|
76
|
+
|
|
77
|
+
### Web Bindings (Wasm)
|
|
78
|
+
|
|
79
|
+
Running `make build-web` compiles the Wasm binary and generates JS/TS glue code into the `pkg/` directory.
|
|
80
|
+
|
|
81
|
+
## Release Workflow
|
|
82
|
+
|
|
83
|
+
We use GitHub Actions to automate publishing to npm and PyPI. The Apple XCFramework must be built and attached locally to ensure SPM checksums match the git tag.
|
|
84
|
+
|
|
85
|
+
1. **Pull Latest:** Ensure your local `main` branch is up to date.
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
git checkout main
|
|
89
|
+
git pull origin main
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
2. **Bump & Build:** Run the appropriate version command. This automatically bumps `Cargo.toml`, builds the Apple framework, updates `Package.swift`, commits the changes, and tags the release.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
make version-patch # or version-minor, version-major
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
3. **Push:** Push the version commit and the new tag.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
git push origin main --follow-tags
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
4. **Publish Release:** Create the GitHub release and upload the local XCFramework zip. (The `make` command will output the exact command for you to copy-paste).
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
gh release create vX.Y.Z target/VitalLensCoreFFI.xcframework.zip --generate-notes
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Once the release is published, CI will automatically build and publish the cross-platform Python wheels to PyPI and the WebAssembly package to npm.
|