Skip to content

Updated docstring

Updated docstring #935

# This workflow will install Python dependencies, run tests and lint on several OS with a several versions of Python
# See: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Build on Win-MacOS-Ubuntu with Python 3.10-3.12
on:
push:
branches: [ "main", "experimental" ]
paths-ignore:
- 'README.md'
- 'Content/**'
pull_request:
branches: [ "main", "experimental" ]
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest] #, macos-13] # opensim not supported on macos Intel AMD x64 beyond python 3.11
python-version: ["3.10", "3.11", "3.12"]
include:
- os: ubuntu-latest
cache-path: ~/.cache/pip
- os: windows-latest
cache-path: C:\Users\runneradmin\AppData\Local\pip\Cache
- os: macos-latest #arm64
cache-path: /Library/Caches/pip
# - os: macos-13
# cache-path: ~/Library/Caches/pip
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache conda environment
uses: actions/cache@v4
with:
path: ~/.conda
key: ${{ runner.os }}-conda-${{ matrix.python-version }}-${{ hashFiles('**/environment.yml') }}
restore-keys: ${{ runner.os }}-conda-${{ matrix.python-version }}-
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: pose2sim
- name: Install OpenSim with conda
shell: bash -l {0}
run: |
conda install -n pose2sim -c conda-forge -c defaults pip
conda install -n pose2sim opensim-org::opensim -y
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ${{ matrix.cache-path }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install pip dependencies
shell: bash -l {0}
run: |
conda run -n pose2sim python -m ensurepip --upgrade
conda run -n pose2sim python -m pip install --upgrade pip setuptools wheel
conda run -n pose2sim python -m pip install flake8 pytest
conda run -n pose2sim python -m pip install git+https://github.com/${{ github.repository }}.git@${{ github.sha }}
- name: Lint with flake8
shell: bash -l {0}
run: |
conda activate pose2sim
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Smoke test CLI entry points
shell: bash -l {0}
run: |
conda activate pose2sim
entry_points=(
AlphaPose_to_OpenPose
# Blazepose_runsave # requires pip install mediapipe
bodykin_from_mot_osim
c3d_to_trc
calib_easymocap_to_toml
calib_from_checkerboard
calib_qca_to_toml
calib_toml_to_easymocap
calib_toml_to_opencap
calib_toml_to_qca
DLC_to_OpenPose
face_blurring
# json_display_with_img # requires cmapy
json_display_without_img
MMPose_to_OpenPose
reproj_from_trc_calib
trc_combine
trc_desample
trc_filter
trc_from_easymocap
trc_from_mot_osim
trc_gaitevents
trc_plot
trc_to_c3d
trc_Zup_to_Yup
)
for cmd in "${entry_points[@]}"; do
echo "Testing: $cmd --help"
if ! "$cmd" --help >/dev/null 2>&1; then
echo "❌ Failed to run: $cmd"
exit 1
fi
done
- name: Test with pytest
shell: bash -l {0}
env:
PYTHONIOENCODING: utf-8
PYTHONUNBUFFERED: "1"
KMP_DUPLICATE_LIB_OK: TRUE
run: |
conda activate pose2sim
pytest -v Pose2Sim/Utilities/tests.py --capture=sys