Skip to main content

MesPy

PyPI version Python versions License Documentation

Small Python toolbox for mechanics laboratory data analysis.

Open the MesPy documentation

MesPy started as a set of helper functions that kept reappearing across mechanics lab notebooks and classroom scripts: loading CSV measurements, computing descriptive and weighted statistics, plotting histograms, and running linear fits with uncertainties. The library brings those recurring tasks together into a single typed package with a small public API that is easy to use in notebooks, scripts, and teaching material.

What It Provides

  • CSV loading with explicit missing-data policies
  • Descriptive and weighted statistics for one-dimensional data
  • Histogram plotting for quick exploratory analysis
  • Linear fitting with absolute or residual-scaled uncertainties and a typed result object
  • Clear validation errors instead of silent nan propagation

Public API

The root package exports:

  • load_csv
  • median
  • weighted_mean
  • variance
  • covariance
  • standard_deviation
  • histogram
  • lin_fit

The root namespace stays intentionally small. Additional public types, such as mespy.fit_utils.LinearFitResult, live in submodules.

Installation

mespy requires Python >= 3.12.

pip install git+https://github.com/giancarmine-sparso/mespy.git

Development Setup

To set up a local development environment:

Unix / macOS

git clone https://github.com/giancarmine-sparso/mespy
cd mespy
make setup

To activate the virtual environment manually:

source .venv/bin/activate

Windows

git clone https://github.com/giancarmine-sparso/mespy
cd mespy
python -m venv .venv
.venv\Scripts\activate
pip install -e ".[dev]"

Documentation

The Sphinx source lives in docs/source, and the generated site is written to docs/build/html.

Build the documentation with:

make docs

The generated site includes both English and Italian outputs, with English as the default landing page. The documentation also includes usage examples for the available functions. Complete usage workflows and notebooks are available in docs/source/examples.

Project Structure

mespy/
├── .github/
│   └── workflows/          # automation for documentation publishing
├── data/
│   └── reference/          # reference datasets used by tests and examples
├── docs/
│   ├── source/             # Sphinx source, examples, and translations
│   ├── Makefile
│   └── make.bat
├── figures/                # exported example figures
├── src/
│   └── mespy/              # library package
├── tests/                  # pytest suite
├── tools/                  # release and smoke-test helpers
├── LICENSE
├── Makefile                # local setup, testing, release, and docs tasks
├── pyproject.toml          # package metadata and dependencies
├── README.md
└── uv.lock

Metadata

Release files for mespy 1.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 mespy 1.2.0
File Size Uploaded Provenance Actions
mespy-1.2.0.tar.gz 32.9 kB Without provenance Details for mespy-1.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 57.2 kB

Release files / mespy-1.2.0.tar.gz

Download URL mespy-1.2.0.tar.gz
Size 32.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3b013bb39a609cc4667bbf01a912da499c87519800d2bdbe413a84614c097e24
BLAKE2b-256 checksum
How to use checksums
738ff268acebcfd50e05d349870f5ef3890232687bf1dade807dcffdb3de502c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / mespy-1.2.0-py3-none-any.whl

Download URL mespy-1.2.0-py3-none-any.whl
Size 24.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a65bd51e9292e2769289ba7400f39506bc45841c03ab6237a8940971f877746b
BLAKE2b-256 checksum
How to use checksums
f272aed7ea22aba9880b06317fc2187234e195fa2101a452dc27302297f1dfcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Security for mespy 1.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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