Skip to main content

A powerful unit conversion library with CLI and API support

Project description

Conversion Unit Library

CLI Usage Demo

Unit Conversion CPL

REST API Usage Demo

Unit Conversion REST API

📌 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


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.0.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file conversion_unit-1.0.0.tar.gz.

File metadata

  • Download URL: conversion_unit-1.0.0.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

Hashes for conversion_unit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 69d39ed0ba0f94794d7881ad661f75e0942f18dfc9049a9c041faef58cfab2dd
MD5 f8c35b61ecea4e323115662e395ea84d
BLAKE2b-256 51df9c65277ab65d8dd304d26bf54063ba1b85652b87e76959d3b39a184625eb

See more details on using hashes here.

Supported by

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