Skip to content

Commit ee0102d

Browse files
authored
Merge pull request #46 from PayalLakra/bio_amptool
Python Package, Code Refactoring and Documentation
2 parents c18ad73 + 7abb380 commit ee0102d

Some content is hidden

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

46 files changed

+1839
-1108
lines changed

.github/workflows/release.yaml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
- "[0-9]+.[0-9]+.[0-9]+a[0-9]+"
8+
- "[0-9]+.[0-9]+.[0-9]+b[0-9]+"
9+
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
10+
11+
env:
12+
PACKAGE_NAME: "chordspy"
13+
OWNER: "Upside Down Labs"
14+
15+
jobs:
16+
details:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
new_version: ${{ steps.release.outputs.new_version }}
20+
suffix: ${{ steps.release.outputs.suffix }}
21+
tag_name: ${{ steps.release.outputs.tag_name }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Extract tag and Details
26+
id: release
27+
run: |
28+
if [ "${{ github.ref_type }}" = "tag" ]; then
29+
TAG_NAME=${GITHUB_REF#refs/tags/}
30+
NEW_VERSION=$(echo $TAG_NAME | awk -F'-' '{print $1}')
31+
SUFFIX=$(echo $TAG_NAME | grep -oP '[a-z]+[0-9]+' || echo "")
32+
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
33+
echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
34+
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
35+
else
36+
echo "No tag found"
37+
exit 1
38+
fi
39+
40+
check_pypi:
41+
needs: details
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Fetch PyPI version
45+
run: |
46+
response=$(curl -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json || echo "{}")
47+
latest_version=$(echo $response | jq -r '.info.version // "0.0.0"')
48+
echo "latest_version=$latest_version" >> $GITHUB_ENV
49+
50+
- name: Compare versions
51+
run: |
52+
if [ "$(printf '%s\n' "$latest_version" "${{ needs.details.outputs.new_version }}" | sort -rV | head -n1)" != "${{ needs.details.outputs.new_version }}" ]; then
53+
echo "Version ${{ needs.details.outputs.new_version }} is not newer than PyPI version $latest_version"
54+
exit 1
55+
fi
56+
57+
setup_and_build:
58+
needs: [details, check_pypi]
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
63+
- name: Set up Python
64+
uses: actions/setup-python@v5
65+
with:
66+
python-version: "3.10" # Changed from 3.13 to stable version
67+
68+
- name: Install Poetry
69+
uses: snok/install-poetry@v1
70+
with:
71+
virtualenvs-create: true
72+
virtualenvs-in-project: true
73+
74+
- name: Configure Poetry
75+
run: |
76+
poetry config virtualenvs.in-project true
77+
poetry config virtualenvs.create true
78+
79+
- name: Set version
80+
run: poetry version ${{ needs.details.outputs.new_version }}
81+
82+
- name: Install dependencies
83+
run: poetry install --sync --no-interaction --no-root
84+
85+
- name: Build package
86+
run: poetry build
87+
88+
- name: Upload artifacts
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: dist
92+
path: dist/*
93+
94+
pypi_publish:
95+
needs: setup_and_build
96+
runs-on: ubuntu-latest
97+
environment:
98+
name: release
99+
permissions:
100+
id-token: write # Essential for trusted publishing
101+
steps:
102+
- uses: actions/download-artifact@v4
103+
with:
104+
name: dist
105+
path: dist/
106+
107+
- name: Publish to PyPI
108+
uses: pypa/gh-action-pypi-publish@release/v1
109+
with:
110+
verbose: true # For better debugging
111+
112+
github_release:
113+
needs: [details, setup_and_build, pypi_publish]
114+
runs-on: ubuntu-latest
115+
permissions:
116+
contents: write
117+
steps:
118+
- uses: actions/checkout@v4
119+
with:
120+
fetch-depth: 0
121+
122+
- uses: actions/download-artifact@v4
123+
with:
124+
name: dist
125+
path: dist/
126+
127+
- name: Create Release
128+
uses: softprops/action-gh-release@v2
129+
with:
130+
tag_name: ${{ needs.details.outputs.tag_name }}
131+
files: |
132+
dist/*
133+
generate_release_notes: true

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include requirements.txt
2+
include README.md
3+
recursive-include chordspy/templates *
4+
recursive-include chordspy/static *
5+
recursive-include chordspy/config *

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
# Chords - Python
22

3-
Chords- Python is a bag of tools designed to interface with Micro-controller development boards running [Chords Arduino Firmware](https://github.com/upsidedownlabs/Chords-Arduino-Firmware).Use Upside Down Labs bio-potential amplifiers to read data, visualize it, record data in CSV Files, and stream it via Lab Streaming Layer.
3+
Chords- Python is an open-source bag of tools designed to interface with Micro-controller development boards running [Chords Arduino Firmware](https://github.com/upsidedownlabs/Chords-Arduino-Firmware). Use Upside Down Labs bio-potential amplifiers to read data, visualize it, record data in CSV Files, and stream it via Lab Streaming Layer.
44

55
> [!NOTE]
6-
> **Firmware Required:**
7-
> - For Arduino: [Chords Arduino Firmware](https://github.com/upsidedownlabs/Chords-Arduino-Firmware)
6+
> **Firmware Required for Arduino:** [Chords Arduino Firmware](https://github.com/upsidedownlabs/Chords-Arduino-Firmware)
87
98
## Features
109
- **Multiple Protocols**: Supports `Wi-Fi`, `Bluetooth`, and `Serial` communication.
11-
- **LSL Data Streaming**:Once the LSL stream starts, any PC on the same Wi-Fi network can access the data using tools like BrainVision LSL Viewer.
10+
- **LSL Data Streaming**: Once the LSL stream starts, any PC on the same Wi-Fi network can access the data using tools like BrainVision LSL Viewer.
1211
- **CSV Logging**: Save raw data with Counter
1312
- **GUI**: Live plotting for all channels.
14-
- **Applications**: EEG/ECG/EMG/EOG-based games and utilities (e.g., Tug of War, Keystroke Emulator).
15-
16-
## Installation
17-
1. **Python**: Ensure Latest version of Python is installed.
18-
2. **Virtual Environment**:
19-
```bash
20-
python -m venv venv
21-
source venv/bin/activate # Linux/macOS
22-
.\venv\Scripts\activate # Windows
23-
```
24-
3. **Dependencies**:
25-
```bash
26-
pip install -r requirements.txt
27-
```
28-
29-
> [!IMPORTANT]
30-
> On Windows, if scripts are blocked, run:
31-
> ```powershell
32-
> Set-ExecutionPolicy Unrestricted -Scope Process
33-
> ```
13+
- **Applications**: EEG/ECG/EMG/EOG-based games and utilities (e.g., Tug of War, Keystroke Emulator).
14+
15+
16+
## Installation
17+
18+
- Make sure you have the latest version of Python installed.
19+
20+
- Open command prompt and run:
21+
```bash
22+
python -m venv venv
23+
```
24+
25+
```bash
26+
venv\Scripts\activate # For Windows
27+
source venv/bin/activate # For MacOS/Linux
28+
```
29+
30+
```bash
31+
pip install chordspy
32+
```
3433

3534
## Usage
36-
Run the script and access the web interface:
35+
Run the command and access the web interface:
3736
```bash
38-
python app.py
37+
chordspy
3938
```
39+
4040
**Web Interface Preview**:
41-
![Web Interface Screenshot](./media/Interface.png)
41+
![Web Interface Screenshot](./chordspy/media/Interface.png)
4242

43-
![Web Interface Screenshot](./media/Webinterface.png)
43+
![Web Interface Screenshot](./chordspy/media/Webinterface.png)
4444

4545
### Key Options:
4646

0 commit comments

Comments
 (0)