This release is a pre-release and may not be stable for production use.
Ballistic Solver Library
LGPL library for small arms ballistic calculations based on point-mass (3 DoF) plus spin drift.
Contents
Installation
uv
uv add py-ballisticcalc
# Using precompiled backend (improves performance)
uv add py-ballisticcalc[exts]
# Using matplotlib and pandas uses additional dependencies
uv add py-ballisticcalc[charts]
# Get everything, including the SciPy engine
uv add py-ballisticcalc[exts,charts,scipy]
pip
pip install py-ballisticcalc
# Using precompiled backend (improves performance)
pip install py-ballisticcalc[exts]
# Using matplotlib and pandas uses additional dependencies
pip install py-ballisticcalc[charts]
# Get everything, including the SciPy engine
pip install py-ballisticcalc[exts,charts,scipy]
Quick Start - click here to open Quick Start guide
Interactive Web REPL
Prefer to try it before installing anything? Open the Interactive Web REPL — runs entirely in your browser via Pyodide.
Examples
Ballistic Concepts
Units
Work in your preferred terms with easy conversions for the following dimensions and units:
- Angular: radian, degree, MOA, mil, mrad, thousandth, inch/100yd, cm/100m, o'clock
- Distance: inch, foot, yard, mile, nautical mile, mm, cm, m, km, line
- Energy: foot-pound, joule
- Pressure: mmHg, inHg, bar, hPa, PSI
- Temperature: Fahrenheit, Celsius, Kelvin, Rankine
- Time: second, minute, millisecond, microsecond, nanosecond, picosecond
- Velocity: m/s, km/h, ft/s, mph, knots
- Weight: grain, ounce, gram, pound, kilogram, newton
Calculation Engines
Choose between different calculation engines, or build your own. Included engines:
| Engine Name | Speed (Find Zero / Trajectory) | Dependencies | Description |
|---|---|---|---|
[rk4_engine][py_ballisticcalc.engines.RK4IntegrationEngine] |
Baseline (1x) | None; default | Runge-Kutta 4th-order integration |
[euler_engine][py_ballisticcalc.engines.EulerIntegrationEngine] |
:material-arrow-down: 0.5x / 0.5x (slower) | None | Euler 1st-order integration |
[verlet_engine][py_ballisticcalc.engines.VelocityVerletIntegrationEngine] |
:material-arrow-down: 0.8x / 0.8x (slower) | None | Verlet 2nd-order symplectic integration |
[cythonized_rk4_engine][py_ballisticcalc_exts.CythonizedRK4IntegrationEngine] |
:material-arrow-up: 205x / 144x (faster) | [exts] |
Compiled Runge-Kutta 4th-order |
[cythonized_euler_engine][py_ballisticcalc_exts.CythonizedEulerIntegrationEngine] |
:material-arrow-up: 54x / 52x (faster) | [exts] |
Compiled Euler integration |
[cythonized_verlet_engine][py_ballisticcalc_exts.CythonizedVelocityVerletIntegrationEngine] |
:material-arrow-up: 130x / 99x (faster) | [exts] |
Compiled Verlet 2nd-order symplectic |
[cythonized_rkck_engine][py_ballisticcalc_exts.CythonizedCashKarpIntegrationEngine]1 |
:material-arrow-up: ~3370x / ~335x (faster) | [exts] |
Compiled Cash-Karp adaptive RK45 |
[cythonized_dopri_engine][py_ballisticcalc_exts.CythonizedDormandPrinceIntegrationEngine]1 |
:material-arrow-up: ~3370x / ~335x (faster) | [exts] |
Dormand--Prince 5(4), SciPy RK45-style controller |
[cythonized_tsitouras_engine][py_ballisticcalc_exts.CythonizedTsitourasIntegrationEngine]1 |
:material-arrow-up: ~3370x / ~335x (faster) | [exts] |
Tsitouras 5(4), SciPy RK45-style controller |
[scipy_engine][py_ballisticcalc.engines.SciPyIntegrationEngine] |
:material-arrow-up: 4.6x / 8.3x (faster) | [scipy] |
Advanced numerical methods |
About project
The library provides trajectory calculation for ballistic projectiles launched by airguns, bows, firearms, artillery, etc.
The core point-mass (3DoF) ballistic model underlying this project was used on the earliest digital computers. Robert McCoy (author of Modern Exterior Ballistics) implemented one in BASIC. JBM published code in C. Nikolay Gekht ported that to C#, extended it with formulas from Bryan Litz's Applied Ballistics, and ported it to Go, while Alexandre Trofimov implemented a calculator in JavaScript.
This Python3 implementation has been expanded to support multiple ballistic coefficients and custom drag functions, such as those derived from Doppler radar data.
Contributors
This project exists thanks to all the people who contribute.
Special thanks to:
- David Bookstaber - Ballistics Expert
For help understanding and improving the functionality - Serhiy Yevtushenko - Applied Mathematician
For helping in consultations, testing, and improving edge case compatibility - Nikolay Gekht
For the source code in C# and GO-lang from which this project firstly was forked
Sister projects
- bclibc - High performance C++/C99 Ballistic solver engine
- micropython-bclibc - Pure C99 Ballistic Solver Engine for MicroPython (bclibc subset)
- ebalistyka - Ballistic Calculator built with Flutter and high performance C++ engine
- js-ballistics - ISC library for small arms ballistic calculations (JavaScript ES6+)
License
Copyright (C) 2023 Yaroshenko Dmytro (o-murphy)
This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License v3.0 as published by the Free Software Foundation.
See LICENSE for the full text. See CHANGELOG for release history.
-
Adaptive RK45; actual speed depends on the configured tolerances. Cash-Karp, Dormand-Prince, and Tsitouras measure in the same performance class as each other on typical trajectories -- see benchmarks for the measurement, not a ranking. ↩ ↩2 ↩3
Release files for py-ballisticcalc 3.0.0b2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_ballisticcalc-3.0.0b2.tar.gz | 7.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_ballisticcalc-3.0.0b2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.4 MB
Release files / py_ballisticcalc-3.0.0b2.tar.gz
| Download URL | py_ballisticcalc-3.0.0b2.tar.gz |
|---|---|
| Size | 7.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70a2a3726146b8bd7a870757ae7ad2fd0ceac95c493f3e86451aeab5c26a94e0
|
|
BLAKE2b-256 checksum How to use checksums |
a0bfc06c132b70808f1acba2edd4cb3780dcf81a057882124d7306cf8b929477
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / py_ballisticcalc-3.0.0b2-py3-none-any.whl
| Download URL | py_ballisticcalc-3.0.0b2-py3-none-any.whl |
|---|---|
| Size | 151.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca776cd73f073d4d05a95dcd18cd25095194ffb8f006aa174cf6abcda830f4cd
|
|
BLAKE2b-256 checksum How to use checksums |
43fb6dae1c771dc176b2fec5a977facc16799083178ae549ed0ab6a46f27a62e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency log