Skip to main content

Human Readable

Project description

Status PyPI Python Version License

Read the documentation at https://human-readable.readthedocs.io/ Tests Codecov

pre-commit Black

Features

  • File size humanization.

  • List humanization.

Requirements

  • It works in Python 3.7+.

Installation

You can install Human Readable via pip from PyPI:

$ pip install human-readable

Usage

Import the lib with:

import human_readable

File size humanization:

human_readable.file_size(1000000)
"1.0 MB"

human_readable.file_size(1000000, binary=True)
"976.6 KiB"

human_readable.file_size(1000000, gnu=True)
"976.6K"

Lists humanization:

human_readable.listing(["Alpha", "Bravo"], ",")
"Alpha, Bravo"

human_readable.listing(["Alpha", "Bravo", "Charlie"], ";", "or")
"Alpha; Bravo or Charlie"

Numbers humanization:

human_readable.int_comma(12345)
"12,345"

human_readable.int_word(123455913)
"123.5 million"

human_readable.int_word(12345591313)
"12.3 billion"

human_readable.ap_number(4)
"four"

human_readable.ap_number(41)
"41"

Floating point number humanization:

human_readable.fractional(1.5)
"1 1/2"

human_readable.fractional(0.3)
"3/10"

Scientific notation:

human_readable.scientific_notation(1000)
"1.00 x 10³"

human_readable.scientific_notation(5781651000, precision=4)
"5.7817 x 10⁹"

Click here for more examples and detailed usage.

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the MIT license, Human Readable is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Credits

This lib is based on original humanize with some added features such as listing, improved naming, documentation, some more testing, bug fixes and better Portuguese support.

This project was generated from @cjolowicz’s Hypermodern Python Cookiecutter template.

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

human-readable-0.2.0.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

human_readable-0.2.0-py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 3

Supported by

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