Skip to main content

BallisticCalculator

LGPL library for small arms ballistic calculations based on point-mass (3 DoF) plus spin drift.

This repo offers py_ballisticcalc under the more convenient name pyballistic.

license pypi downloads coverage py-versions Made in Ukraine

Pytest RK4 Pytest RK4 (Cython) Pytest Scipy

Contents

Installation

pip

pip install pyballistic

# Using precompiled backend (improves performance)
pip install pyballistic[exts]

# Using matplotlib and pandas uses additional dependencies
pip install pyballistic[charts]

# Get everything, including the SciPy-powered calculation engine
pip install pyballistic[exts,charts,scipy]

QuickStart

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 Dependencies Description
rk4_engine Baseline (1x) None, default Runge-Kutta 4th-order integration
euler_engine 0.5x (slower) None Euler 1st-order integration
verlet_engine 0.7x (slower) None Verlet 2nd-order integration
cythonized_rk4_engine 50x (faster) [exts] Compiled Runge-Kutta 4th-order
cythonized_euler_engine 40x (faster) [exts] Compiled Euler integration
scipy_engine 10x (faster) scipy Advanced numerical methods

Keeping in sync with upstream

This repository tracks the upstream project py-ballisticcalc while preserving a few local differences (package name, URLs, and select docs like this README).

  • Sync locally:
    • python scripts/sync_upstream.py to sync latest master from upstream.
    • python scripts/sync_upstream.py --ref pull/219/head to sync a specific PR.
    • Add --clean to remove files deleted upstream (excluded paths remain).
  • Automation:
    • GitHub Action Sync Upstream runs on-demand, opening a PR with changes. It can also be scheduled to run regularly (uncomment the schedule block).
  • Configuration:
    • See sync_config.json for upstream repo/branch, text/path replacements, and excluded files. Adjust exclude_paths if you want additional files to remain customized here.

RISK NOTICE

The library performs numerical approximations of complex physical processes. The calculation results MUST NOT be considered as completely and reliably reflecting real-world behavior of projectiles. While these results may be used for educational purpose, they must NOT be considered as reliable for the areas where incorrect calculation may cause making a wrong decision, financial harm, or can put a human life at risk.

THE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

Metadata

Release files for pyballistic 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyballistic 2.2.0
File Size Uploaded
pyballistic-2.2.0.tar.gz 121.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyballistic 2.2.0
File Interpreter ABI Platform
pyballistic-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 253.9 kB

Release files / pyballistic-2.2.0.tar.gz

Download URL pyballistic-2.2.0.tar.gz
Size 121.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fcfb58240257a4c5e86df76026352dfe0e6676cb8133d721c4b9a52084d1406c
BLAKE2b-256 checksum
How to use checksums
a8c749116c05d931f636cab723f671adb82123497576e445fe35e1291360ad6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 22, 2025.

Transparency log

Release files / pyballistic-2.2.0-py3-none-any.whl

Download URL pyballistic-2.2.0-py3-none-any.whl
Size 132.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a17eb8c40f9606ac5878b0a5d30575f7cc83cc549375e1371c100e2bdab36a4
BLAKE2b-256 checksum
How to use checksums
32695f7a870243d4edf7bd6e6ce56953dce309768ede2703182395e069657edc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 22, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page