Inspired by the following YouTube videos exploring the concept of Verlet Integration.
This project is written in Python and uses UV for dependency management, DearPyGui for the UI, Ruff for linting, and ty for type checking.
- Python 3.9 or higher
- UV - Fast Python package installer and resolver
-
Install UV (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh -
Clone this project:
git clone <repository-url> cd SimplePhysics
-
Install dependencies:
uv sync
Run the application with one of the available examples:
# Run with the ball example (default)
uv run python app/main.py
# Run with a specific example
uv run python app/main.py --example ball
uv run python app/main.py --example box
uv run python app/main.py --example cloth
uv run python app/main.py --example double_pendulumInstall all dependencies including development tools:
uv sync --all-extrasCheck for linting issues:
uv run ruff check app/Auto-fix linting issues:
uv run ruff check --fix app/Format code:
uv run ruff format app/Run type checking:
uv run ty check app/Run all tests:
uv run pytestRun tests with coverage:
uv run pytest --cov=app --cov-report=htmlRun specific test file:
uv run pytest tests/test_geometry.py -vBuild a standalone executable for your platform:
uv run pyinstaller simplephysics.specThe binary will be created in the dist/ directory.
For a one-off build without the spec file:
uv run pyinstaller --onefile --windowed app/main.pyThis project uses GitHub Actions for continuous integration and deployment:
- Linting & Type Checking: Automatically runs Ruff and ty on every push and pull request
- Testing: Runs the full test suite with coverage reporting
- Binary Builds: Automatically builds binaries for:
- Windows (amd64)
- Linux (amd64 and aarch64)
- macOS (aarch64/Apple Silicon)
Binaries are available as artifacts from the GitHub Actions workflow runs.
SimplePhysics/
├── app/
│ ├── __init__.py
│ ├── main.py # Entry point
│ ├── geometry.py # Core geometry and physics engine
│ ├── draw.py # Rendering with DearPyGui
│ ├── physics.py # Physics utilities
│ └── examples/ # Example simulations
│ ├── ball.py
│ ├── box.py
│ ├── cloth.py
│ └── double_pendulum.py
├── tests/
│ ├── __init__.py
│ └── test_geometry.py # Unit tests
├── .github/
│ └── workflows/
│ └── ci.yml # CI/CD pipeline
├── pyproject.toml # Project configuration
├── uv.lock # Dependency lock file
└── README.md
MIT
