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 2.0.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 2.0.0
File Size Uploaded Provenance Actions
mespy-2.0.0.tar.gz 66.7 kB Without provenance Details for mespy-2.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 99.1 kB

Release files / mespy-2.0.0.tar.gz

Download URL mespy-2.0.0.tar.gz
Size 66.7 kB
Tags Source
SHA-256 checksum
How to use checksums
75c15e566d63981013c99ed48a381c359a41cada948b72f8c3cb854a5208deee
BLAKE2b-256 checksum
How to use checksums
621c36a170281fa3db131f9b4dde12f418df9d1f52ec31c4c1508e4e18703097
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL mespy-2.0.0-py3-none-any.whl
Size 32.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31e62dc5df6ed00a6bd0be14bd25561efe0e74a18c8456601cfc2f94eaf2b96e
BLAKE2b-256 checksum
How to use checksums
d2d880fb57086d6627a11f1dc13570fc2fab47c344f3bc75dc0d913bae55776b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for mespy 2.0.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