Skip to content
Open
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
e2c7a13
Add BUILD_PYPI option, use it to control installtion of libraries int…
aymanhab Nov 7, 2025
1f6cfde
Build wheel in python package on windows
aymanhab Nov 10, 2025
9b26069
fix syntax error for indentation
aymanhab Nov 10, 2025
a23d758
Update SWIG version in CI workflow
aymanhab Nov 10, 2025
cf9dece
Add wheel installation to CI workflow
aymanhab Nov 10, 2025
52f998a
Change wheel build command to use python -m build
aymanhab Nov 11, 2025
9466176
Add build package installation to CI workflow
aymanhab Nov 11, 2025
ceea798
Upgrade Numpy to version 2.0 and install build tools
aymanhab Nov 11, 2025
8c434f1
Add step to upload Windows wheel artifact
aymanhab Nov 11, 2025
17df8c7
Use OpenSimAddLibrary macro for Moco for uniform treatment downstream
aymanhab Nov 11, 2025
ac0544d
Merge branch 'build_pypi_opensim' of https://github.com/opensim-org/o…
aymanhab Nov 11, 2025
1ff753b
remove stale python2 check
Nov 12, 2025
42c6a37
restore linux configuration to test python old setup
aymanhab Nov 13, 2025
7916392
Add CMake argument for building Python package
aymanhab Nov 13, 2025
a174cfb
Add wheel building step to CI workflow on osx arm64
aymanhab Nov 13, 2025
6ff1ef7
Add step to upload OSX wheel in CI workflow
aymanhab Nov 13, 2025
61971b6
Restore wheel build and upload steps in CI
aymanhab Nov 13, 2025
38c5c6d
Fix path for uploading OSX wheel artifact
aymanhab Nov 13, 2025
d173732
Disable OPENSIM_WITH_CASADI in CI configuration
aymanhab Nov 14, 2025
b223a14
Disable ctest execution in CI workflow
aymanhab Nov 14, 2025
96178bc
Fix path for uploading Linux wheel artifact
aymanhab Nov 14, 2025
1787203
copy moco dependencies to python wheel osx
Nov 14, 2025
604a7be
restore building moco on osx and ubuntu
Nov 14, 2025
fd3f4c9
Update wheel file name for Linux artifact upload
aymanhab Nov 14, 2025
41cb305
Upgrade numpy version from 1.25 to 2.2
aymanhab Nov 14, 2025
f9555cb
Uncomment ctest command in CI workflow
aymanhab Nov 15, 2025
70de77d
fix rpath for simtk libraries after copy
aymanhab Nov 15, 2025
e88b262
Merge branch 'build_pypi_opensim' of https://github.com/opensim-org/o…
aymanhab Nov 15, 2025
35a1b4c
merge branch and fix rpath on osx
Nov 16, 2025
69f22e3
BuildWheel post normal install
Nov 16, 2025
d2330d4
Remove Python wrapping installation for CasADi libraries
aymanhab Nov 16, 2025
d315f78
copy .so* on linux
Nov 16, 2025
838fc7b
adjust rpath for simtk libs on linux
aymanhab Nov 17, 2025
7482155
Enable UNIX FHS installation for OpenSim
aymanhab Nov 17, 2025
6db98c6
account for FHS layout
aymanhab Nov 17, 2025
af7eeef
Merge branch 'build_pypi_opensim' of https://github.com/opensim-org/o…
aymanhab Nov 17, 2025
65a032e
Uncomment conditional for building dependencies
aymanhab Nov 17, 2025
e07f79f
account for layout on ci
Nov 18, 2025
525d9d1
Update CI workflow for Python wheel build path
aymanhab Nov 18, 2025
bcbdc32
Use wheel for testing Python bindings, no path change
aymanhab Nov 18, 2025
92a2b44
Update wheel names for Python 3.10 compatibility
aymanhab Nov 18, 2025
4de4e39
Modify Python test command in CI workflow
aymanhab Nov 18, 2025
d3fcb85
Update numpy version requirement in setup.py
aymanhab Nov 18, 2025
d7b1827
pin python and platform in wheel name
aymanhab Nov 20, 2025
3e3788a
change file names of wheels to match standard and currently generated…
aymanhab Nov 20, 2025
f3e4e76
Fix wheel file path for Python bindings installation
aymanhab Nov 20, 2025
2def671
Run Python tests linux
aymanhab Nov 20, 2025
449313f
Remove or comment out tests within the python packaging as they refer…
aymanhab Nov 20, 2025
c931aee
Merge branch 'main' into build_pypi_opensim
aymanhab Nov 20, 2025
14c4fec
disable cache for ubuntu22 to sort out casadi not found
aymanhab Nov 20, 2025
9db9038
Update CMake arguments for OpenSim configuration
aymanhab Nov 20, 2025
6b0e844
Update CMake flags for OpenSim dependencies
aymanhab Nov 21, 2025
a56298e
Fix merge issues and update wheel names to reflect python 3.11
aymanhab Nov 21, 2025
ef903ea
Fix syntax running python tests on windows
aymanhab Nov 21, 2025
2fce98c
Add support for building PYPI distribution wheels
aymanhab Nov 21, 2025
6bd5c80
Fix paths in continuous integration workflow on windows
aymanhab Nov 21, 2025
fb3c0fa
Enhance PYPI distribution support for Python 3.11
aymanhab Nov 21, 2025
cb7a29a
copy dlls on windows
aymanhab Nov 21, 2025
d7fd29e
Add status messages for DLL file copying
aymanhab Nov 21, 2025
4f2e0f2
enable buildWheel for windows
Nov 22, 2025
00b4782
fix buildWheel for windows
Nov 22, 2025
2c8177b
Avoid using data_files on windows
Nov 22, 2025
72bdbe9
use data_files to include dlls on windows
Nov 22, 2025
4e80a08
Address feedback on PR
aymanhab Nov 23, 2025
472984d
Update CMake arguments for OpenSim configuration
aymanhab Nov 23, 2025
8062ae2
use BUILD_PYTHON_WHEELS
aymanhab Nov 23, 2025
90ff559
Fix CMake command to include BUILD_PYTHON_WHEELS option
aymanhab Nov 23, 2025
23f77af
Use cibuildwheel on windows
aymanhab Nov 24, 2025
2fecd97
Fix typo in CMake arguments for Python wheels
aymanhab Nov 24, 2025
eb84982
Fix paths for Windows wheel and Python tests
aymanhab Nov 24, 2025
fb35d9c
Fix paths for wheel installation and testing
aymanhab Nov 24, 2025
ed9efb2
Upgrade pip, setuptools, and wheel in CI workflow
aymanhab Nov 24, 2025
317bb32
Change OPENSIM_INSTALL_UNIX_FHS to OFF
aymanhab Nov 24, 2025
bb7944d
Update paths for building and testing Python wheel on ubuntu due FHS …
aymanhab Nov 24, 2025
c3747cb
Update pip install path for Python bindings on windows
aymanhab Nov 25, 2025
379c3ca
Disable caching dependencies on windows
aymanhab Nov 25, 2025
ff145a2
Update CI workflow to include delvewheel installation
aymanhab Nov 25, 2025
289d6ca
Disable wheel build and test steps in CI for windows
aymanhab Nov 25, 2025
caac7da
Remove status messages in buildWheel.cmake
aymanhab Nov 25, 2025
29809b8
Revert "Remove or comment out tests within the python packaging as th…
aymanhab Nov 26, 2025
a2aa2c7
Fix path for Python tests in CI workflow ubuntu24
aymanhab Nov 26, 2025
e2aa899
Reenable using cached dependencies on windows
aymanhab Nov 27, 2025
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
81 changes: 62 additions & 19 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ jobs:
python-version: '3.11'

- name: Install numpy
# Need numpy to use SWIG numpy typemaps.
run: python3 -m pip install numpy==2.0
#Need numpy to use SWIG numpy typemaps.
run: |
python3 -m pip install numpy==2.0
python3 -m pip install wheel
python3 -m pip install build


- name: Install SWIG
run: |
Expand Down Expand Up @@ -68,7 +72,7 @@ jobs:
# /W0 disables warnings.
# https://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
# TODO: CMake provides /W3, which overrides our /W0
cmake -E env CXXFLAGS="/W0 /MD" cmake $env:GITHUB_WORKSPACE/dependencies -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DSUPERBUILD_ezc3d=ON -DOPENSIM_WITH_CASADI=ON
cmake -E env CXXFLAGS="/W0 /MD" cmake $env:GITHUB_WORKSPACE/dependencies -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DSUPERBUILD_ezc3d=ON -DOPENSIM_WITH_CASADI=ON -DOPENSIM_PYTHON_STANDALONE=ON
cmake --build . --config Release -- /maxcpucount:4

- name: Configure opensim-core
Expand All @@ -79,7 +83,7 @@ jobs:
# TODO: Can remove /WX when we use that in CMakeLists.txt.
# Set the CXXFLAGS environment variable to turn warnings into errors.
# Skip timing test section included by default.
cmake -E env CXXFLAGS="/WX /MD -DSKIP_TIMING" cmake $env:GITHUB_WORKSPACE -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DOPENSIM_C3D_PARSER=ezc3d -DOPENSIM_WITH_CASADI=on -DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on -DPython3_ROOT_DIR=C:\hostedtoolcache\windows\Python\3.11.9\x64
cmake -E env CXXFLAGS="/WX /MD -DSKIP_TIMING" cmake $env:GITHUB_WORKSPACE -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DOPENSIM_C3D_PARSER=ezc3d -DOPENSIM_WITH_=on -DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on -DPython3_ROOT_DIR=C:\hostedtoolcache\windows\Python\3.11.9\x64
$env:match = cmake -L . | Select-String -Pattern OPENSIM_QUALIFIED_VERSION
$version = $env:match.split('=')[1]
echo $version
Expand All @@ -106,13 +110,22 @@ jobs:
Copy-Item -Path "~/opensim-core-install" -Destination "opensim-core-${{ steps.configure.outputs.version }}" -Recurse
7z a "opensim-core-${{ steps.configure.outputs.version }}.zip" "opensim-core-${{ steps.configure.outputs.version }}"

# - name: Test Python bindings
# run: |
# echo "PYTHONPATH= $env:USERPROFILE/opensim-core-install/bin">> $GITHUB_ENV
# # Move to the installed location of the python package.
# cd ~/opensim-core-install/sdk/python
# # Run python tests.
# python -m unittest discover --start-directory opensim/tests --verbose
- name: Build wheel
run: |
cd ~/opensim-core-install/sdk/python
python -m build --wheel

- name: Upload windows wheel
uses: actions/upload-artifact@v4
with:
name: opensim-4.5.2-cp311-cp311-win_amd64.whl
path: ~/opensim-core-install/sdk/python/dist/opensim-4.5.2-cp311-cp311-win_amd64.whl

- name: Test Python bindings
run: |
cd ~/opensim-core-install/sdk/python
# Run the python tests, verbosely.
python3 -m unittest discover --start-directory opensim/tests --verbose

- name: Upload opensim-core
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -180,7 +193,7 @@ jobs:
DEP_CMAKE_ARGS+=(-DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install)
DEP_CMAKE_ARGS+=(-DCMAKE_BUILD_TYPE=Release)
DEP_CMAKE_ARGS+=(-DSUPERBUILD_ezc3d=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_CASADI=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_DISABLE_LOG_FILE=ON)
DEP_CMAKE_ARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=11)
printf '%s\n' "${DEP_CMAKE_ARGS[@]}"
Expand Down Expand Up @@ -231,7 +244,7 @@ jobs:
mv $GITHUB_WORKSPACE/../opensim-core-install opensim-core-${{ steps.configure.outputs.version }}
zip --symlinks --recurse-paths --quiet opensim-core-${{ steps.configure.outputs.version }}.zip opensim-core-${{ steps.configure.outputs.version }}
mv opensim-core-${{ steps.configure.outputs.version }} $GITHUB_WORKSPACE/../opensim-core-install

- name: Test Python bindings
run: |
cd $GITHUB_WORKSPACE/../opensim-core-install/sdk/Python
Expand Down Expand Up @@ -267,6 +280,8 @@ jobs:
brew install pkgconfig autoconf libtool automake wget pcre doxygen llvm
brew reinstall gcc
pip3 install numpy==2.0
pip3 install wheel
pip3 install build
gfortran -v
mkdir gfortran_version
gfortran -v &> gfortran_version/gfortran_version.txt
Expand Down Expand Up @@ -306,9 +321,10 @@ jobs:
DEP_CMAKE_ARGS+=(-DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install)
DEP_CMAKE_ARGS+=(-DCMAKE_BUILD_TYPE=Release)
DEP_CMAKE_ARGS+=(-DSUPERBUILD_ezc3d=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_CASADI=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_WITH_=ON)
DEP_CMAKE_ARGS+=(-DOPENSIM_DISABLE_LOG_FILE=ON)
DEP_CMAKE_ARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=11)

printf '%s\n' "${DEP_CMAKE_ARGS[@]}"
cmake "${DEP_CMAKE_ARGS[@]}"
make --jobs 4
Expand All @@ -325,6 +341,8 @@ jobs:
OSIM_CMAKE_ARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=11)
OSIM_CMAKE_ARGS+=(-DOPENSIM_C3D_PARSER=ezc3d)
OSIM_CMAKE_ARGS+=(-DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on)
OSIM_CMAKE_ARGS+=(-DBUILD_PYPI=on)
OSIM_CMAKE_ARGS+=(-DOPENSIM_WITH_=ON)
OSIM_CMAKE_ARGS+=(-DSWIG_EXECUTABLE=$HOME/swig/bin/swig)
OSIM_CMAKE_ARGS+=(-DOPENSIM_INSTALL_UNIX_FHS=OFF)
OSIM_CMAKE_ARGS+=(-DOPENSIM_DOXYGEN_USE_MATHJAX=off)
Expand Down Expand Up @@ -358,6 +376,17 @@ jobs:
zip --symlinks --recurse-paths --quiet opensim-core-${{ steps.configure.outputs.version }}.zip opensim-core-${{ steps.configure.outputs.version }}
mv opensim-core-${{ steps.configure.outputs.version }} $GITHUB_WORKSPACE/../opensim-core-install

- name: Build wheel
run: |
cd $GITHUB_WORKSPACE/../opensim-core-install/sdk/Python
python3 -m build --wheel

- name: Upload osx wheel
uses: actions/upload-artifact@v4
with:
name: opensim-4.5.2-cp311-cp311-macosx_15_0_universal2.whl
path: /Users/runner/work/opensim-core/opensim-core-install/sdk/python/dist/opensim-4.5.2-cp311-cp311-macosx_15_0_universal2.whl

- name: Test Python bindings
run: |
cd $GITHUB_WORKSPACE/../opensim-core-install/sdk/Python
Expand Down Expand Up @@ -508,6 +537,8 @@ jobs:
run: |
pip install pip --upgrade
pip install numpy==2.0
pip install build
pip install wheel

- name: Install packages
run: sudo apt-get update && sudo apt-get install --yes build-essential libtool autoconf pkg-config gfortran libopenblas-dev liblapack-dev freeglut3-dev libxi-dev libxmu-dev doxygen patchelf
Expand Down Expand Up @@ -561,9 +592,11 @@ jobs:
OSIM_CMAKE_ARGS+=(-DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install)
OSIM_CMAKE_ARGS+=(-DOPENSIM_C3D_PARSER=ezc3d)
OSIM_CMAKE_ARGS+=(-DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on)
OSIM_CMAKE_ARGS+=(-DBUILD_PYPI=on)
OSIM_CMAKE_ARGS+=(-DOPENSIM_WITH_CASADI=ON)
OSIM_CMAKE_ARGS+=(-DSWIG_DIR=~/swig/share/swig)
OSIM_CMAKE_ARGS+=(-DSWIG_EXECUTABLE=~/swig/bin/swig)
OSIM_CMAKE_ARGS+=(-DOPENSIM_INSTALL_UNIX_FHS=OFF)
OSIM_CMAKE_ARGS+=(-DOPENSIM_INSTALL_UNIX_FHS=ON)
OSIM_CMAKE_ARGS+=(-DOPENSIM_DOXYGEN_USE_MATHJAX=off)
# TODO: Update to simbody.github.io/latest
OSIM_CMAKE_ARGS+=(-DOPENSIM_SIMBODY_DOXYGEN_LOCATION="https://simbody.github.io/simtk.org/api_docs/simbody/latest/")
Expand Down Expand Up @@ -596,13 +629,23 @@ jobs:
mv $GITHUB_WORKSPACE/../opensim-core-install opensim-core-${{ steps.configure.outputs.version }}
zip --symlinks --recurse-paths --quiet opensim-core-${{ steps.configure.outputs.version }}-ubuntu22.zip opensim-core-${{ steps.configure.outputs.version }}
mv opensim-core-${{ steps.configure.outputs.version }} $GITHUB_WORKSPACE/../opensim-core-install

- name: Build wheel
run: |
cd $GITHUB_WORKSPACE/../opensim-core-install/lib/python3.11/site-packages
python3 -m build --wheel

- name: Upload linux wheel
uses: actions/upload-artifact@v4
with:
name: opensim-4.5.2-cp311-cp311-linux_x86_64.whl
path: /home/runner/work/opensim-core/opensim-core-install/lib/python3.11/site-packages/dist/opensim-4.5.2-cp311-cp311-linux_x86_64.whl

- name: Test Python bindings
run: |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/opensim_dependencies_install/simbody/lib
cd $GITHUB_WORKSPACE/../opensim-core-install/sdk/Python
# Run the python tests, verbosely.
python3 -m unittest discover --start-directory opensim/tests --verbose
pip install /home/runner/work/opensim-core/opensim-core-install/lib/python3.11/site-packages/dist/opensim-4.5.2-cp311-cp311-linux_x86_64.whl
# Run the python tests, verbosely
python3 -m unittest discover --start-directory /home/runner/work/opensim-core/opensim-core-install/lib/python3.11/site-packages/opensim/tests --verbose

- name: Upload opensim-core
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions Bindings/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_BINARY_DIR}/version.py" opensim)

# Copy setup.py for each build configuration.
OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_SOURCE_DIR}/setup.py" ".")
OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_SOURCE_DIR}/pyproject.tom1" ".")

# __init__.py.
OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" opensim)
Expand Down
33 changes: 33 additions & 0 deletions Bindings/Python/pyproject.tom1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "opensim"
version = "0.1.0" # You may want to dynamically inject this from version.py
description = "OpenSim Simulation Framework"
authors = [{ name = "OpenSim Team", email = "[email protected]" }]
license = { text = "Apache 2.0" }
dynamic = ["version"]
readme = "README.md"
urls = { homepage = "http://opensim.stanford.edu/" }
classifiers = [
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Physics"
]
dependencies = [ "numpy>=2.0" ]

[project.scripts]
opensim-moco-generate-report = "opensim.report:main"

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
where = ["."]
include = ["opensim"]

[tool.setuptools.package-data]
opensim = ["_*.*", "*.dylib", "*.dll", "*.so*"]
15 changes: 12 additions & 3 deletions Bindings/Python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import sys
from setuptools import setup
from setuptools.dist import Distribution

# This provides a list of relative paths to all the dependencies in the bin folder.
# Only when installed locally via "python -m pip install ." in Windows
Expand All @@ -24,6 +25,10 @@
execfile('opensim/version.py')
else:
exec(compile(open('opensim/version.py').read(), 'opensim/version.py', 'exec'))
class BinaryDistribution(Distribution):
"""Distribution which always forces a binary package with platform name"""
def has_ext_modules(foo):
return True

setup(name='opensim',
version=__version__,
Expand All @@ -35,8 +40,7 @@
packages=['opensim'],
# Copy the bin_files and geometry_files into the opensim package directory
data_files=[
('Lib/site-packages/opensim', bin_files),
('Lib/site-packages/opensim/Geometry', geometry_files)
('opensim', bin_files)
],
# The last 3 entries are for if OPENSIM_PYTHON_STANDALONE is ON.
# The asterisk after the extension is to handle version numbers on Linux.
Expand All @@ -51,8 +55,13 @@
classifiers=[
'Intended Audience :: Science/Research',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Physics',
],
install_requires=[
"numpy>=2.0"
],
distclass=BinaryDistribution
)

#python setup.py bdist_wheel --python-tag cp310
109 changes: 0 additions & 109 deletions Bindings/Python/tests/test_DataAdapter.py

This file was deleted.

Loading
Loading