A powerful unit conversion library with CLI and API support
Project description
Conversion Unit Library
CLI Usage Demo
REST API Usage Demo
📌 Overview
A powerful Python library for unit conversion, supporting CLI and REST API. Convert units effortlessly for length, weight, volume, time, speed, and more!
🔥 Features
- ✅ CLI Support: Run conversions from the command line
- ✅ FastAPI REST API: Convert units via HTTP requests
- ✅ Comprehensive Units: Includes length, mass, volume, temperature, energy, and more
- ✅ Custom Units: Add your own conversions dynamically
🚀 Installation
pip install conversion_unit
🔧 Usage
1️⃣ CLI Mode
convert 5 km to m
# Output: 5000.0
2️⃣ Python Library
from conversion_unit import convert
result = convert(5, "km", "m")
print(result) # 5000.0
3️⃣ REST API Mode
Run the API server:
python -m conversion_unit
Then access:
GET http://localhost:8000/convert?value=5&from_unit=km&to_unit=m
Response:
{ "result": 5000.0 }
📜 License
This project is licensed under the MIT License.
🌍 Contribute
Pull requests are welcome! Open an issue to suggest features or improvements.
⭐ Support the Project
If you find this project useful, give it a ⭐ on GitHub!
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
conversion_unit-1.0.2.tar.gz
(2.9 kB
view details)
File details
Details for the file conversion_unit-1.0.2.tar.gz.
File metadata
- Download URL: conversion_unit-1.0.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f790f54cddd04577280b32205a9253448bb8db3c3738b92698b34fe043ad4c0d
|
|
| MD5 |
2a9df2951911071160120825f0e9c346
|
|
| BLAKE2b-256 |
0cc9fd0a6ba5ebbd800e5b65e0350bc37dae3a17b20ffdbe7def905fac96f405
|