Skip to main content

quantities

Quantities is designed to handle arithmetic and conversions of physical quantities, which have a magnitude, dimensionality specified by various units, and possibly an uncertainty. See the tutorial for examples. Quantities builds on the popular numpy library and is designed to work with numpy ufuncs, many of which are already supported. Quantities is actively developed, and while the current features and API are stable, test coverage is incomplete so the package is not suggested for mission-critical applications. Support for uncertainties is incomplete: many numpy functions do not propagate uncertainty (see the tutorial for details).

pypi version Build status Coverage Status

A Python package for handling physical quantities. The source code and issue tracker are hosted on GitHub:

https://www.github.com/python-quantities/python-quantities

Download

Get the latest version of quantities from https://pypi.python.org/pypi/quantities/

To get the Git version do:

$ git clone git://github.com/python-quantities/python-quantities.git

Documentation and usage

You can find the official documentation at:

http://python-quantities.readthedocs.io/

Here is a simple example:

>>> import quantities as pq
>>> distance = 42*pq.metre
>>> time = 17*pq.second
>>> velocity = distance / time
>>> "%.3f %s" % (velocity.magnitude, velocity.dimensionality)
'2.471 m/s'
>>> velocity + 3
Traceback (most recent call last):
  ...
ValueError: Unable to convert between units of "dimensionless" and "m/s"

Installation

To install quantities itself, simply run:

$ pip install quantities

Tests

To execute all tests, install pytest:

$ python -m pip install pytest

And run:

$ pytest

in the current directory. The master branch is automatically tested by GitHub Actions.

Contributing

Bug reports, fixes, and pull requests are welcome. Please see CONTRIBUTING.md for a quick overview, and the developer documentation for the onboarding guide, architecture overview, and development workflow.

Author

quantities was originally written by Darren Dale, and has received contributions from many people.

License

Quantities only uses BSD compatible code. See the Open Source Initiative licenses page for details on individual licenses.

See doc/user/license.rst for further details on the license of quantities

Metadata

Release files for quantities 0.17.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 quantities 0.17.0
File Size Uploaded Provenance Actions
quantities-0.17.0.tar.gz 118.3 kB Without provenance Details for quantities-0.17.0.tar.gz

Built distribution (wheel)

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

Total release size: 228.7 kB

Release files / quantities-0.17.0.tar.gz

Download URL quantities-0.17.0.tar.gz
Size 118.3 kB
Tags Source
SHA-256 checksum
How to use checksums
69fd1c5236b416cc524c2d512847bed509d1e78f1fcca59304bfe60f1f1d759e
BLAKE2b-256 checksum
How to use checksums
c66569619c6434d16cdc6384fae7110b5b2fdede3dabd32bb481084c019aad22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / quantities-0.17.0-py3-none-any.whl

Download URL quantities-0.17.0-py3-none-any.whl
Size 110.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6894d0dcdcd7d83d2a894f1775579d699ffb11bf2815bd2b47373c397ca17223
BLAKE2b-256 checksum
How to use checksums
0d348e82a038fc6461e48a0ac5f47f0921491e2af40322c8b7cd19532c6a5814
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for quantities 0.17.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