Skip to main content

# Unitconvert: Unit conversion tool - Version 1.0.4

## Synopsis

A command line tool and import library for performing unit conversions.

## Testing

There is a “tests” directory containing some unit tests for some of the classes and functions in this application.

Additionally, the application has been tested on the following systems and python versions:

  • Ubuntu 16.04 (python 3.5.2, python 2.7.12)

## Known Issues

  • Fully untested on Windows, Mac, and BSD at this time

## Installation

Install with pip:

pip install unitconvert

## Usage

After installation is completed, you may run the unitconvert tool in a terminal using the following command:

unitconvert -a AMOUNT -f UNIT_FROM -t UNIT_TO

To print version information:

unitconvert -v

To print help:

unitconvert -h

The unit libraries may also be imported and used in Python scripts to perform conversions. Example:

` # Filename: testconvert.py from unitconvert import digitalunits print(digitalunits.DigitalUnit(500, 'GB', 'MB').doconvert()) `

Output:

` $ python testconvert.py 500000.0 `

Command line arguments: * -a AMOUNT: Amount to convert * -f UNIT_FROM: Unit to convert from * -t UNIT_TO: Unit to convert to * -v VERSION: Optional, print version info * -h with no other arguments: print help info

Available unit types with associated class (in brackets) and arguments (in parentheses):

  • Digital [DigitalUnit]: - Decimal: Byte (B), Kilobyte (kB), Megabyte (MB), Gigabyte (GB), Terabyte (TB), Petabyte (PB), Exabyte (EB), Zettabyte (ZB), Yottabyte (YB) - Binary: Kibibyte (KiB), Mebibyte (MiB), Gibibyte (GiB), Tebibyte (TiB), Pebibyte (PiB), Exbibyte (EiB), Zebibyte (ZiB), Yobibyte (YiB)

  • Length [LengthUnit]: Millimeter (mm), Centimeter (cm), Inch (in), Foot (ft), Yard (yd), Meter (m), Kilometer (km), Mile (mi)

  • Time [TimeUnit]: Millisecond (ms), second (sec), Minute (min), Hour (hr), Day (day), Week (wk), Month (mo), Year (yr)

  • Volume [VolumeUnit]: - Metric: Milliliter (ml), Liter (l) - US customary: Teaspoon (tsp), Tablespoon (tbsp), fluid Ounces (floz), Cup (cup), Pint (pt), Quart (qt), Gallon (gal) - US legal: Cup (lcup) - Cubic: Cubic Inch (in3), Cubic Foot (ft3)

  • Mass [MassUnit]: Milligram (mg), Gram (g), Ounce (oz), Pound (lb), Kilogram (kg)

  • Temperature [TemperatureUnit]: Fahrenheit (F), Celsius (C), Kelvin (K)

## Updating

If you want to update the application currently installed, just run the following to upgrade with pip:

pip install unitconvert –upgrade

## Uninstalling

If you want to uninstall the application, run the following to uninstall with pip:

pip uninstall unitconvert

## To Do

  • Add support for more units

## Contributors

Get in touch with me if you’d like to contribute.

## License

The code contained within this repository is released under the MIT license.

## Changelog

### Version 1.0.4 * 12/09/2017: Converted individual class methods to single dict for simplicity. Added new module to hold parent classes. Updated setup.py and runconvert.py with new version.

### Version 1.0.3 * 10/21/2017: Updated README with import instructions. Updated setup.py and runconvert.py with updated description.

### Version 1.0.2 * 10/21/2017: Updated README

### Version 1.0.1 * 06/17/2017: Added fluid ounces

### Version 1.0.0 * 06/10/2017: Initial release

Release files for unitconvert 1.0.4

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

Source distribution (sdist)

Source distribution for unitconvert 1.0.4
File Size Uploaded
unitconvert-1.0.4.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for unitconvert 1.0.4
File Interpreter ABI Platform
unitconvert-1.0.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 20.2 kB

Release files / unitconvert-1.0.4.tar.gz

Download URL unitconvert-1.0.4.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
08fe6c733e0c17f465a31e3c7c7cd5dc820d6f2c7579ae50dd0e15bf5977377a
BLAKE2b-256 checksum
How to use checksums
95a13aceb470154fffd183c2874575fba2f8cb4fdf45598b60cbe7ca43b2be69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / unitconvert-1.0.4-py2.py3-none-any.whl

Download URL unitconvert-1.0.4-py2.py3-none-any.whl
Size 12.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2f7c99d719f48edee2e2f5ecae35d15b702c0568082439423be20bd3b6084be6
BLAKE2b-256 checksum
How to use checksums
ff43babde8e73779c182b94cd077aeee9ec5d8ffad6f387f02dd2100b746fab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

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