Skip to main content

📦 pytemperatureconverter

A simple Python library to convert temperatures between four scales (Celsius, Fahrenheit, Kelvin, and Rankine) with user warnings for physically impossible conversions

pytemperatureconverter is a lightweight and easy-to-use Python package that provides functions to seamlessly convert temperatures across multiple scales. It includes robust warnings to prevent erroneous or physically impossible conversions, ensuring accurate and reliable temperature conversions.


🔍 Key Features

  • Support for All Major Temperature Scales: Easily convert temperatures between:

    • Celsius ↔ Fahrenheit
    • Celsius ↔ Kelvin
    • Celsius ↔ Rankine
    • Fahrenheit ↔ Kelvin
    • Rankine ↔ Celsius
  • User Input Warnings: Prevents conversions that result in physically impossible temperatures (e.g., temperatures below absolute zero).

  • Comprehensive Test Coverage: Includes robust test cases to ensure reliable conversions and edge case handling.

  • Open-Source Project: Fully transparent and open for contributions under the MIT license.


📝 Table of Contents

  1. Installation
  2. Usage
  3. API Reference
  4. Testing
  5. Changelog
  6. Contribution
  7. License
  8. Contact
  9. Donations

📦 Installation

Install the pytemperatureconverter library from PyPI:

pip install pytemperatureconverter

🚀 Usage

Here's a quick example to demonstrate some of the conversions:

from pytemperatureconverter import (
    celsius_to_fahrenheit,
    fahrenheit_to_celsius,
    celsius_to_kelvin,
    kelvin_to_celsius
)

# Celsius to Fahrenheit
temp_c = 25
print(f"{temp_c}°C is {celsius_to_fahrenheit(temp_c)}°F")

# Fahrenheit to Celsius
temp_f = 100
print(f"{temp_f}°F is {fahrenheit_to_celsius(temp_f)}°C")

# Celsius to Kelvin
print(f"{temp_c}°C is {celsius_to_kelvin(temp_c)}K")

# Kelvin to Celsius
temp_k = 300
print(f"{temp_k}K is {kelvin_to_celsius(temp_k)}°C")

🛡️ User Warnings

  • The library now includes validation mechanisms to prevent physically impossible conversions.
  • Temperatures that would result in unrealistic or negative Kelvin conversions will trigger appropriate warnings.
  • This ensures that only meaningful and valid conversions are processed.

✅ Testing

We have included comprehensive test cases to ensure:

  • Accurate conversions across all supported temperature scales.
  • Handling of edge cases (e.g., extreme temperatures).
  • Robust input validation to catch erroneous or invalid conversions.

Run the test suite to verify the correctness of conversions:

pytest tests/

🔄 Changelog

Latest Updates (v1.1.0)

  • Added User Input Validation with warnings for physically impossible conversions.
  • Included new test cases to cover all edge cases across temperature scales.
  • Fully open-sourced the project, ensuring the MIT license allows for free copying and modification.

🤝 Contribution

We welcome contributions! If you have any improvements, bug fixes, or new test ideas, feel free to contribute to the repository:

  • Fork the repository.
  • Create a new branch.
  • Submit a Pull Request with a detailed description of your changes.

📜 License

This project is licensed under the MIT License, allowing you to freely use, modify, and distribute the code.

MIT License


📧 Contact

For any questions, suggestions, or feedback, please reach out:


💖 Donations

If you find this project helpful and would like to support its continued development, you can donate using the following cryptocurrency addresses:

  • Ethereum (ETH): 0x23774348bc491Ff70F39c63f39B0e542a59b5B14
  • Bitcoin (BTC): bc1qp7wltg8frvecuujjs9f3ck28r0s0h0qzld2fu6
  • Dogecoin (DOGE): DTbwxMs4wenN2kUea77rHPQ8nbJrSk4o7D

Your support is greatly appreciated and helps maintain and improve open-source projects!


Metadata

Release files for pytemperatureconverter 1.1.0

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

Source distribution (sdist)

Source distribution for pytemperatureconverter 1.1.0
File Size Uploaded
pytemperatureconverter-1.1.0.tar.gz 5.0 kB Details

Built distribution (wheel)

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

Total release size: 10.0 kB

Release files / pytemperatureconverter-1.1.0.tar.gz

Download URL pytemperatureconverter-1.1.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f350f01db5899d2f76479a945544630b68ff8f66b27168a38509b6ed14316955
BLAKE2b-256 checksum
How to use checksums
e776cf9a37f0123b096479ab860186f740aa96f0b48f4250530bd321ed404ea0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.9

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

Download URL pytemperatureconverter-1.1.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bbff1a3ba94487f63fac3cf59f6f29027c102b880cc543eaf4a31427f3fdd611
BLAKE2b-256 checksum
How to use checksums
92b3e6b57d28cd3ad2bc837ddb06af1854516a55f7250efdb499b4e159a4ea80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.9

Release history Release notifications | RSS feed

1.2.0

2 release files

This release

1.1.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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