Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish to PyPI

on:
push:
tags:
- "v*.*.*"

permissions:
contents: read
id-token: write # REQUIRED for Trusted Publishing

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v1
with:
version: latest

- name: Sync dependencies (no dev deps needed)
run: uv sync

- name: Build wheel and sdist
run: uv build --wheel --sdist

- name: List built artifacts
run: ls -R dist

- name: Inspect METADATA (optional debug)
run: |
wheel=$(ls dist/*.whl)
unzip -p "$wheel" "$(unzip -l "$wheel" | awk '/METADATA$/ {print $NF}')" || true

- name: Publish to PyPI (Trusted Publishing)
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
verbose: true
36 changes: 22 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ default_language_version:
python: python3.12

repos:
# --------------------------------------------------------
# Basic hygiene checks (whitespace, yaml, shebangs, etc.)
# --------------------------------------------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
Expand All @@ -16,20 +19,25 @@ repos:
- id: name-tests-test
- id: requirements-txt-fixer

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
# --------------------------------------------------------
# Delegate formatting + linting to your Makefile
# --------------------------------------------------------
- repo: local
hooks:
- id: mypy
args: ["--ignore-missing-imports"]
additional_dependencies: []
exclude: ^testing/resources/
- id: make-format
name: Run format (ruff format + ruff lint)
entry: make format
language: system
types: [python]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.6
# --------------------------------------------------------
# Optional: run tests before commit
# (Often skipped in CI & enabled manually because slow)
# --------------------------------------------------------
- repo: local
hooks:
- id: ruff
types_or: [python, pyi]
args: ["--fix"]

- id: ruff-format
types_or: [python, pyi]
- id: make-test
name: Run pytest suite
entry: make test
language: system
types: [python]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

# Select the package and version at build time
ARG PKG=exosuit_python
ARG PKG=exosuit_python[no_hw]
ARG VER=latest
ENV PKG=${PKG} VER=${VER}

Expand Down
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ lint:
uv run ruff check --fix

typecheck:
uv run mypy src/ tests/ --ignore-missing-imports
uv run pyright src

format:
make lint
Expand All @@ -29,15 +29,13 @@ clean:
rm -rf junit-pytest.xml
rm -rf logs/*
find . -name ".coverage*" -delete
find . -name "coverage.xml" -delete
find . -name "__pycache__" -exec rm -r {} +

update:
uv sync --upgrade --all-groups
uv run pre-commit autoupdate
uv lock --upgrade

update-deep:
uv cache clean pypi
uv cache clean
make update

docker:
Expand All @@ -46,3 +44,11 @@ docker:

app:
uv run python -m exosuit_python

tree:
uv run python repo_tree.py --update-readme

build:
uv build
unzip -l dist/*.whl
unzip -p dist/*.whl */METADATA
41 changes: 36 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
[![Coverage Status](https://coveralls.io/repos/github/TUM-Aries-Lab/exosuit-python/badge.svg?branch=main)](https://coveralls.io/github/TUM-Aries-Lab/exosuit-python?branch=main)
![Docker Image CI](https://github.com/TUM-Aries-Lab/exosuit-python/actions/workflows/ci.yml/badge.svg)

This repo is the main codebase to run the lower-limb exosuit on a single board computer like the Jetson Nano.
This repo is the main codebase to run the lower-limb exosuit on a single board computer like the Jetson Nano or Raspberry Pi.

## Install
To install the library run:

```bash
uv pip install python-exosuit==latest
uv pip install exosuit-python==latest
```
OR
```bash
uv add git+https://github.com/TUM-Aries-Lab/python-exosuit.git@<specific-tag> # need credentials
uv add git+https://github.com/TUM-Aries-Lab/exosuit-python.git@<specific-tag> # need credentials
```

## Development
0. Install [uv](https://docs.astral.sh/uv/getting-started/installation/) from Astral.
0. Install [**uv**](https://docs.astral.sh/uv/getting-started/installation/) from Astral.
1. `git clone git@github.com:TUM-Aries-Lab/exosuit-python.git`
2. Install the dependencies to use Makefiles.
3. `make init` to create the virtual environment and install dependencies
Expand All @@ -31,7 +31,7 @@ It's super easy to publish your own packages on PyPI. To build and publish this
uv build
uv publish # make sure your version in pyproject.toml is updated
```
The package can then be found at: https://pypi.org/project/exosuit-python
The package can then be found at: **https://pypi.org/project/exosuit-python**

## Module Usage
```python
Expand All @@ -49,3 +49,34 @@ if __name__ == "__main__":
```bash
uv run python -m exosuit_python
```

## Structure
Run `make tree` to update the repository tree scene below.
<!-- TREE-START -->
```
├── src
│ └── exosuit_python
│ ├── __init__.py
│ ├── __main__.py
│ ├── definitions.py
│ ├── exosuit.py
│ └── utils.py
├── tests
│ ├── __init__.py
│ ├── conftest.py
│ ├── exosuit_test.py
│ └── utils_test.py
├── .dockerignore
├── .gitignore
├── .pre-commit-config.yaml
├── .python-version
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
├── pyproject.toml
├── repo_tree.py
└── uv.lock
```
<!-- TREE-END -->
87 changes: 36 additions & 51 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,86 +1,71 @@
[project]
name = "exosuit-python"
name = "exosuit_python"
version = "0.0.2"
description = "Python-based lower limb exosuit"
description = "IMU sensor codes in Python for the exosuit"
readme = "README.md"
authors = [{ name = "Tsmorz", email = "tony.smoragiewicz@tum.de" }]
requires-python = ">=3.11,<3.14"

# --- Core dependencies: NO hardware here ---
dependencies = [
"numpy>=2.2.3",
"loguru>=0.7.3",
"numpy>=2.2.3",
"loguru>=0.7.3",
]

[dependency-groups]
dev = [
"ruff>=0.6.9",
"mypy>=1.11",
"pytest>=8.3",
"pytest-cov>=6.0",
"pre-commit>=4.1.0",
"coveralls>=4.0.1",
"ruff>=0.6.9",
"mypy>=1.11",
"pytest>=8.3",
"pytest-cov>=6.0",
"pre-commit>=4.1.0",
"coveralls>=4.0.1",
"pyright>=1.1.407",
]
hw = [
]
no_hw = [
]

[project.urls]
homepage = "https://github.com/TUM-Aries-Lab/exosuit-python"

[tool.ruff]
line-length = 88
fix = true

lint.select = [
"E", # pycodestyle (style errors)
"F", # Pyflakes (logical errors)
"W", # Warnings
"C90", # mccabe (complexity checks)
"I", # isort (import sorting)
"N", # pep8-naming (naming conventions)
"D", # pydocstyle (docstring conventions)
"UP", # pyupgrade (Python syntax modernization)
"B", # flake8-bugbear (common pitfalls and performance issues)
"S", # flake8-bandit (security issues)
"YTT", # flake8-2020 (Python 2 compatibility issues)
"Q", # flake8-quotes (quote consistency)
"PL", # pylint (general best practices)
"RUF", # Ruff-specific rules
"T20",
"F841", # unused variable
"ERA001" # commented out code
"E","F","W","C90","I","N","D","UP","B","S","YTT","Q","PL","RUF","T20","F841","ERA001",
]

lint.ignore = [
"D203",
"D213",
"E501",
"N803",
"N806",
"D415",
"S101",
"E203",
"E731",
"D107",
"PLR2004",
"S607",
"S605",
"S603",
"D203","D213","E501","N803","N806","D415","S101","E203","E731",
"D107","PLR2004","S607","S605","S603",
]

fix = true

[tool.ruff.lint.isort]
known-first-party = ["exosuit-python"]
known-first-party = ["exosuit_python"]
combine-as-imports = true

[tool.lint.pydocstyle]
convention = "google"

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "lf"

# -------------------------
# BUILD SYSTEM
# -------------------------
# UV uses hatchling by default; Poetry build backend removed.
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.metadata]
allow-direct-references = true

# Tell hatchling where the package lives (src layout)
[tool.hatch.build.targets.wheel]
packages = ["src/exosuit_python"]

[tool.hatch.build.targets.sdist]
include = [
"src/exosuit_python",
"README.md",
"LICENSE",
]
Loading
Loading