pint 0.2.1


pip install pint==0.2.1

Project Links

Meta
Author: Hernan E. Grecco

Classifiers

Development Status
  • 4 - Beta

Intended Audience
  • Developers
  • Science/Research

License
  • OSI Approved :: BSD License

Operating System
  • MacOS :: MacOS X
  • Microsoft :: Windows
  • POSIX

Programming Language
  • Python :: 2.7
  • Python :: 3.0
  • Python :: 3.1
  • Python :: 3.2
  • Python :: 3.3

Topic
  • Scientific/Engineering
  • Software Development :: Libraries

Pint: a Python units library

Pint is Python module/package to define, operate and manipulate physical quantities: the product of a numerical value and a unit of measurement. It allows arithmetic operations between them and conversions from and to different units.

It is distributed with a comprehensive list of physical units, prefixes and constants. Due to it’s modular design, you to extend (or even rewrite!) the complete list without changing the source code.

It has a complete test coverage. It runs in Python 2.7 and 3.X with no other dependency. It licensed under BSD.

Design principles

Although there are already a few very good Python packages to handle physical quantities, no one was really fitting my needs. Like most developers, I programed Pint to scratch my own itches.

  • Unit parsing: prefixed and pluralized forms of units are recognized without explicitly defining them. In other words: as the prefix kilo and the unit meter are defined, Pint understands kilometers. This results in a much shorter and maintainable unit definition list as compared to other packages.

  • Standalone unit definitions: units definitions are loaded from simple and easy to edit text file. Adding and changing units and their definitions does not involve changing the code.

  • Advanced string formatting: a quantity can be formatted into string using PEP 3101 syntax. Extended conversion flags are given to provide latex and pretty formatting.

  • Small codebase: small and easy to maintain with a flat hierarchy.

  • Dependency free: it depends only on Python and it’s standard library.

  • Python 2 and 3: A single codebase that runs unchanged in Python 2.7+ and Python 3.0+.

  • Advanced NumPy support: While NumPy is not a requirement for Pint, when available ndarray methods and ufuncs can be used in Quantity objects.

Pint is written and maintained by Hernan E. Grecco <hernan.grecco@gmail.com>.

Other contributors, listed alphabetically, are:

Pint Changelog

0.2.1 (2013-07-02)

  • fix error raised while converting from a single unit to one expressed as the relation between many. (Issue #29)

0.2 (2013-05-13)

  • support for Measurement (Quantity +/- error).

  • implemented buckingham pi theorem for dimensional analysis.

  • support for temperature units and temperature difference units.

  • parser can infers if the user mean temperature or temperature difference.

  • support for derived dimensions (e.g. [speed] = [length] / [time]).

  • refactored the code into multiple files.

  • refactored code to isolate definitions and converters.

  • refactored formatter out of UnitParser class.

  • added tox and travis config files for CI.

  • comprehensive NumPy testing including almost all ufuncs.

  • full NumPy support (features is not longer experimental).

  • fixed bug preventing from having independent registries. (Issue #10, thanks bwanders)

  • forces real division as default for Quantities. (Issue #7, thanks dbrnz)

  • improved default unit definition file. (Issue #13, thanks r-barnes)

  • smarter parser supporting spaces as multiplications and other nice features. (Issue #13, thanks r-barnes)

  • moved testsuite inside package.

  • short forms of binary prefixes, more units and fix to less than comparison. (Issue #20, thanks muggenhor)

  • pint is now zip-safe (Issue #23, thanks muggenhor)

Version 0.1.3 (2013-01-07)

  • abbreviated quantity string formating.

  • complete Python 2.7 compatibility.

  • implemented pickle support for Quantities objects.

  • extended NumPy support.

  • various bugfixes.

Version 0.1.2 (2012-08-12)

  • experimenal NumPy support.

  • included default unit definitions file. (Issue #1, thanks fish2000)

  • better testing.

  • various bugfixes.

  • fixed some units definitions. (Issue #4, thanks craigholm)

Version 0.1.1 (2012-07-31)

  • better packaging and installation.

Version 0.1 (2012-07-26)

  • first public release.

No dependencies