Skip to main content

PyOpenSim: Portable Python bindings for OpenSim

Project description

support build kernel pypi downloads

PyOpenSim: Unofficial Portable Python bindings for OpenSim, which is an open source software system for biomechanical modeling, simulation and analysis.

Key Features

  • Portable: Self-contained Python wheels with bundled OpenSim libraries
  • Type Hints: Comprehensive .pyi stub files for excellent IDE support and type checking
  • Cross-Platform: Native support for Linux, macOS, and Windows
  • Official Bindings: Uses OpenSim's native SWIG bindings for full API compatibility

Installation

Install directly from PyPI:

pip install pyopensim

No additional setup required! All OpenSim dependencies are bundled in the wheel.

Why pyopensim?

While the OpenSim team provide an excellent conda package, pyopensim offers complementary benefits for specific use cases:

  • Enhanced IDE Support: Comprehensive type hints (.pyi stubs) provide excellent autocomplete, type checking, and documentation in modern IDEs
  • Wheel Distribution: Self-contained wheels make it easy to bundle OpenSim with your applications without requiring users to manage conda environments
  • Flexible Deployment: Works well in environments where conda isn't preferred (Docker containers, CI/CD pipelines)

Quick Start

import pyopensim as osim

# Check versions
print(f"PyOpenSim version: {osim.__version__}")
print(f"OpenSim core version: {osim.__opensim_version__}")

# Create a simple model
model = osim.Model()
model.setName("MyModel")

# Add a body
body = osim.Body("body", 1.0, osim.Vec3(0), osim.Inertia(1))
model.addComponent(body)

# Build and initialize
state = model.initSystem()
print(f"Model has {model.getNumBodies()} bodies")

Versioning

PyOpenSim uses a 4-digit versioning scheme that directly tracks the OpenSim core version:

  • Version format: <MAJOR>.<MINOR>.<PATCH>.<BUILD>

    • Example: 4.5.2.0 - Matches OpenSim 4.5.2 exactly
    • Example: 4.5.2.1 - First Python binding fix for OpenSim 4.5.2
    • Example: 4.5.2.2 - Second Python binding fix for OpenSim 4.5.2
  • What the version tells you:

    • The first 3 digits (e.g., 4.5.2) match the bundled OpenSim core version exactly
    • The 4th digit indicates Python binding-specific fixes or improvements
    • A build number of 0 means the bindings match OpenSim without additional changes

This makes it easy to know which OpenSim version you're using:

import pyopensim as osim
print(osim.__version__)          # e.g., "4.5.2.0" or "4.5.2.1"
print(osim.__opensim_version__)  # e.g., "4.5.2" (always the core version)

PyPI Distribution

pyopensim is automatically built and deployed to PyPI using:

  • Automated Builds: GitHub Actions CI/CD builds wheels for all platforms
  • cibuildwheel: Ensures compatibility across Python versions and platforms
  • Bundled Libraries: All OpenSim dependencies are included in the wheels
  • Version Management: Semantic versioning automatically aligned with OpenSim releases
  • Automated Tests: Automated testing ensures each release works correctly (work in progress)

This provides an alternative distribution method that complements the official OpenSim library.

Contributing

We welcome contributions of all kinds! Whether you're fixing bugs, improving type stubs, or enhancing documentation, your help is appreciated.

Contributing Guidelines - Complete guide for contributors

Key areas where you can help:

  • Type Stub Improvements: Enhance IDE support and type checking
  • Documentation: Add examples and usage guides
  • Testing: Cross-platform validation and edge cases
  • Bug Reports: Help us improve reliability

Relationship to OpenSim

pyopensim is an unofficial python package that is built on top of the official OpenSim project:

  • Same API: Identical to the official OpenSim Python bindings
  • Same Functionality: Full access to all OpenSim features and capabilities
  • Regular Updates: Tracks OpenSim releases to provide latest features

To use the official OpenSim conda package, checkout this package.

Development

This project builds OpenSim from source to create self-contained Python wheels.

Linux/macOS:

# Clone the repository
git clone https://github.com/neurobionics/pyopensim.git
cd pyopensim

# Build OpenSim and dependencies
make setup

# Build Python wheels
make build

Windows:

# Clone the repository
git clone https://github.com/neurobionics/pyopensim.git
cd pyopensim

# Build OpenSim and dependencies
.\make.ps1 setup

# Build Python wheels
.\make.ps1 build

See WINDOWS.md for detailed Windows build instructions.

The build process includes:

  • Compiling OpenSim's C++ libraries and dependencies
  • Generating SWIG Python bindings
  • Creating comprehensive type stubs for IDE support
  • Bundling everything into portable wheels

License

This project is licensed under Apache License 2.0. OpenSim is licensed under the Apache License 2.0. See the OpenSim license for details.

Issues

If you encounter any issues or have questions regarding pyopensim, please open an issue here.

Community & Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyopensim-4.5.2.0.tar.gz (54.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyopensim-4.5.2.0-cp312-cp312-win_amd64.whl (28.2 MB view details)

Uploaded CPython 3.12Windows x86-64

pyopensim-4.5.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (29.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyopensim-4.5.2.0-cp312-cp312-macosx_11_0_universal2.whl (45.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ universal2 (ARM64, x86-64)

pyopensim-4.5.2.0-cp311-cp311-win_amd64.whl (28.2 MB view details)

Uploaded CPython 3.11Windows x86-64

pyopensim-4.5.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (29.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyopensim-4.5.2.0-cp311-cp311-macosx_11_0_universal2.whl (45.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ universal2 (ARM64, x86-64)

pyopensim-4.5.2.0-cp310-cp310-win_amd64.whl (28.2 MB view details)

Uploaded CPython 3.10Windows x86-64

pyopensim-4.5.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (29.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyopensim-4.5.2.0-cp310-cp310-macosx_11_0_universal2.whl (45.9 MB view details)

Uploaded CPython 3.10macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file pyopensim-4.5.2.0.tar.gz.

File metadata

  • Download URL: pyopensim-4.5.2.0.tar.gz
  • Upload date:
  • Size: 54.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyopensim-4.5.2.0.tar.gz
Algorithm Hash digest
SHA256 3cbfb9b6a101834d62a7636c9d4883664480577f4c07035c485a3dc0f7d43cd1
MD5 ab389f8cf81d7d24b7ab5a6a84f6708c
BLAKE2b-256 00e047a8b07d78a320c149eb25b8b2c81dfe7a4ae603a8678d6711d669bf90d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopensim-4.5.2.0.tar.gz:

Publisher: wheels.yml on neurobionics/pyopensim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyopensim-4.5.2.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyopensim-4.5.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5566653672a75214e0973ba367ada5f4200f769c8d60d1aeb3f77cade1cbfb46
MD5 2b1c058e5df09331364c6c45c9f76dc1
BLAKE2b-256 d1a0b3ce9d425db75cfc0b9ce3879ff7294e7650b4ec710419c54decd1ad842b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopensim-4.5.2.0-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on neurobionics/pyopensim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyopensim-4.5.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyopensim-4.5.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7efdce3c1313c0d18392772cedde208fe966df1ff56e932328b7759bd03141d0
MD5 6c882bd2908407657409de41f75598ab
BLAKE2b-256 34c733e78da6f4aa733a236214a58c11ab8ae960debb371acbfb0e864c2fc086

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopensim-4.5.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on neurobionics/pyopensim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyopensim-4.5.2.0-cp312-cp312-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for pyopensim-4.5.2.0-cp312-cp312-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 6b92415d4d93a89a76db732798f6e7d960c8ecc6791f37581ad003441252fafe
MD5 5179ea446ada872032a939ede27e782d
BLAKE2b-256 d0cdee9500869e2cc285af7096fa6cf2b7d506d9a41e2dad0e0aba81988b61ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopensim-4.5.2.0-cp312-cp312-macosx_11_0_universal2.whl:

Publisher: wheels.yml on neurobionics/pyopensim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyopensim-4.5.2.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyopensim-4.5.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c036e3798690b35968ecfa89e992059adec29ad44c50452cc8b1d7bd9e91435a
MD5 df2456ea6dbe416e9deca662c43f2111
BLAKE2b-256 fc472c7f8e5833864f9a9934fbd3c94e30c8d76d2c696eb2730c475b6a4ca720

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopensim-4.5.2.0-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on neurobionics/pyopensim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyopensim-4.5.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyopensim-4.5.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 02fff95197971c7c4e36b7c0e7d4adf82f08cfc098012295a1770ab2f94134b2
MD5 b86b466b34f80df7b0884b2988fc2a37
BLAKE2b-256 fd4377dbadfab331c0f2d50a8a2ea42c64e8ed8a83805066e7706fd85751de8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopensim-4.5.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on neurobionics/pyopensim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyopensim-4.5.2.0-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for pyopensim-4.5.2.0-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 8a61f2331cea5cab06ab0f8274bbd43d19fdfc4e1735cfc132b65fa243a43f42
MD5 d706567e21da1eef7ed0d358b3093f94
BLAKE2b-256 c9784fff63717ec9b192038f32fc9d7564d5cd329c20ebd7cc47d054e25152f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopensim-4.5.2.0-cp311-cp311-macosx_11_0_universal2.whl:

Publisher: wheels.yml on neurobionics/pyopensim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyopensim-4.5.2.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyopensim-4.5.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bd23b4f57e7b56d657dd762e7fa04206380a12ccf17450e7ce74f2b696b569fd
MD5 2b6a10ddf334fa3c1d4ef92cc4d2fbf0
BLAKE2b-256 f0e8bfe4133ee3f80f7d1a70f7b2d82a6a0c3c711371ffc4e25ab13309c8e000

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopensim-4.5.2.0-cp310-cp310-win_amd64.whl:

Publisher: wheels.yml on neurobionics/pyopensim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyopensim-4.5.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyopensim-4.5.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 85037046600d6b86599955c9136acebcbb159238baf459e15c6fa87e0692e85e
MD5 1456a0525114dbbef7fe7ab9e17353d5
BLAKE2b-256 b842ba4ef6d1ec8f9cb48603e5e4a73f89d2919d766af47f733c0007ec1c139d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopensim-4.5.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on neurobionics/pyopensim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyopensim-4.5.2.0-cp310-cp310-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for pyopensim-4.5.2.0-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 19a15ab5c4b403ad27e2d85ca275e756e948ceead7db8b6f0c8408b846260cf3
MD5 2182f377fe0fb695eeb27649466fa907
BLAKE2b-256 7147a48255fb6c9460d6cfd427468c3738fcf8977dc3378f265b32b33ad5fc4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopensim-4.5.2.0-cp310-cp310-macosx_11_0_universal2.whl:

Publisher: wheels.yml on neurobionics/pyopensim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page