Skip to main content

Unit Converter

Description

Package for converting quantities into different units.

Basic usages

>>> from unit_converter.converter import convert, converts
>>>
>>> convert('2.78 daN*mm^2', 'mN*µm^2')
>>> Decimal('2.78E+10')
>>>
>>> converts('2.78 daN*mm^2', 'mN*µm^2')
>>> '2.78E+10'
>>>
>>> converts('78 min', 'h')
>>> '1.3'
>>>
>>> converts('52°C', '°F')
>>> '125.6'
>>>
>>> converts('120 km*h^-1', 'mile*h^-1')
>>> '74.56454306848007635409210214'

Note: It is necessary to provide the value as a string. Indeed, the high precision of conversion (1E-27) is possible only with string, by using Decimal object in replacement of float object.

Contributing

Please submit and comment on bug reports and feature requests.

To submit a patch:

  1. Fork it (https://bitbucket.org/negetem/unit_converter/fork).

  2. Create your feature branch (git checkout -b my-new-feature).

  3. Make changes.

  4. Commit your changes (git commit -am ‘Add some feature’).

  5. Push to the branch (git push origin my-new-feature).

  6. Create a new Pull Request.

License

This app is licensed under the MIT license.

Warranty

This software is provided “as is” and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose.

Release History

0.0.1 (2016-09-21)

  • Initial release

0.1.1 (2016-09-27)

Improvements

  • Added support for combined units like ‘kg*m*s^-2’

1.0.0 (2018-01-16)

Improvements

  • Big code refactoring

  • Added handy functions convert and converts (return a string)

1.1.0 (2018-01-16)

Improvements

  • Add handling french format number 78,6 instead of 78.6

Tests - Check if all prefix + unit are unique

Metadata

Release files for unit-converter 1.1.0

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

Built distribution (wheel)

Table of built distributions (wheels) for unit-converter 1.1.0
File Interpreter ABI Platform Actions
unit_converter-1.1.0-py3-none-any.whl Python 3 none any Details for unit_converter-1.1.0-py3-none-any.whl

Release files / unit_converter-1.1.0-py3-none-any.whl

Download URL unit_converter-1.1.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c31ca2ae7b64839b2a4b687c1892c80c7253aaee9332fed8c5de7c8a52cb2686
BLAKE2b-256 checksum
How to use checksums
fd61c6e0ee359172c92d0c694c18f91e7ed3f026c53111aae687aee84da50d3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for unit-converter 1.1.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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file No provenance

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