qiyas - A lightweight non-opinionated customizable unit conversion Python library
Project description
qias
qias is lightweight easy-to-use non-opinionated unit conversion Python library for scientists and engineers. It is based on graph theory and allows easy customization and addition of new units via script. Each unit need to be only defined by one existing unit. qias is smart enough to figure out the rest.
Important note
This is a very early release to proove the concept. Everything is working as expected and there are no issues. conversion tables need to be added. Currently, there are some units for length, mass, and volume for testing.
Philosophy
- Lightweight: it only relies on the
networkxpackage to handle graph operations andvarnameto identify variable names. - Easy-to-use: customize it easily with new units.
- non-opinionated: It does not assume anything about your data. It does not create new data type. You can pass numpy array (or datatype that can be multiplied by a number) to it without issue.
Installation
Install it in your environment by running the command
pip install qiyas
Getting started
from qiyas import qs
# Typical use
x = 10
x_cm = qs.convert(x, 'm', 'cm')
# Immediate use (Python 3.8+)
x_m = 10
x_cm = qs.to(x_m, 'cm')
# Get multiplier information
multiplier_info = qs.get_multiplier('m', 'cm')
Contribution
Contributions are welcome, especially for unit tables. Create an issue first to discuss architectural change.
MIT License
Copyright (c) 2021 Mustafa Al Ibrahim
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qiyas-0.2.3.tar.gz.
File metadata
- Download URL: qiyas-0.2.3.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f35ab59003c0620cd729cfdcbd80083b2143626a8de27e0f1fa3ec2478c31e88
|
|
| MD5 |
795d32ce80289cc7121efb6a5fb1bd3b
|
|
| BLAKE2b-256 |
8ec3a68fb8812fe6fb916e976a75d74b75fa67b491dd4a11bb5dae3527145ceb
|
File details
Details for the file qiyas-0.2.3-py3-none-any.whl.
File metadata
- Download URL: qiyas-0.2.3-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5ddecd7bc970bcaa10f498be4b551a7db4ea73b37eeee62f71267ef45172043
|
|
| MD5 |
cb0cdc06ff90f02f9ff578aad1579d8b
|
|
| BLAKE2b-256 |
876cf99c36d2dd2abe3d7e1fe458271c3b72cc17595d37b764294290f29ea4ed
|