Skip to main content

Unit converter for O&G(and other) units

Project description

Units Converter

Library for converting between quantities in different units(including units specific to O&G).

This is a python version of the existing javascript app. Credit goes to the creator and contributors of the original version https://github.com/corva-ai/corva-convert-units, which is a fork of https://github.com/convert-units/convert-units.

Installation

pip install corva-unit-converter

Usage:

Imperial to metric:

from corva_unit_converter.converter import Converter
converter = Converter()
length_meters = converter.convert(unit_from="ft", unit_to="m", value=1)

Metric to imperial:

from corva_unit_converter.converter import Converter
converter = Converter()
torque_ft_lbf = converter.convert(unit_from="Nm", unit_to="ft-lbf", value=1)

Metric to metric:

from corva_unit_converter.converter import Converter
converter = Converter()
mass_grams = converter.convert(unit_from="kg", unit_to="g", value=1)

Contribution

  1. Cover your changes with unit tests.
  2. Bump version in src/version.py if you want your changes to be released.

Testing

  1. Create virtualenv via your favourite tool, for example
python3 -m venv venv
source venv/bin/activate
  1. Install all requirements:
pip install -r requirements.txt && pip install -r requirements-test.txt
  1. Run tests with coverage:
make coverage

or tests without coverage:

make test

Linters are available through

make lint

License

This project is licensed under the terms of the MIT license.

Copyright (c) 2013-2017 Ben Ng and Contributors, http://benng.me

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

corva_unit_converter-0.5.0.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

corva_unit_converter-0.5.0-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file corva_unit_converter-0.5.0.tar.gz.

File metadata

  • Download URL: corva_unit_converter-0.5.0.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for corva_unit_converter-0.5.0.tar.gz
Algorithm Hash digest
SHA256 6110c6dacc771e89d0539a299b3d93e5e279ac0a7a6bfdc4949f940f5374d4ae
MD5 f05022bd18dc53c0fc9a4967bf19f686
BLAKE2b-256 3974f5a70d5b7de6c246c79957775a3e1af39a748dbaf42c3fa5a8d01d668827

See more details on using hashes here.

File details

Details for the file corva_unit_converter-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for corva_unit_converter-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6fd3e5708e3d7845d04435a55c7fbf5a6c96bfded44af8a3677f9f59583c2822
MD5 b985e2fc95f43f606f295a7f8464806b
BLAKE2b-256 4aecd2cb6d1a32d7ff9a36beb64efe4cdb1584a545060c95ff78a078df99dbac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page