Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Human friendly output for text interfaces using Python

Project description

https://travis-ci.org/xolox/python-humanfriendly.svg?branch=master https://coveralls.io/repos/xolox/python-humanfriendly/badge.png?branch=master

The functions and classes in the humanfriendly package can be used to make text interfaces more user friendly. Some example features:

  • Parsing and formatting numbers, file sizes, pathnames and timespans in simple, human friendly formats.
  • Easy to use timers for long running operations, with human friendly formatting of the resulting timespans.
  • Prompting the user to select a choice from a list of options by typing the option’s number or a unique substring of the option.
  • Terminal interaction including text styling (ANSI escape sequences), user friendly rendering of usage messages and querying the terminal for its size.

The humanfriendly package is currently tested on Python 2.6, 2.7, 3.4 and PyPy.

Getting started

It’s very simple to start using the humanfriendly package:

>>> import humanfriendly
>>> user_input = raw_input("Enter a readable file size: ")
Enter a readable file size: 16G
>>> num_bytes = humanfriendly.parse_size(user_input)
>>> print num_bytes
17179869184
>>> print "You entered:", humanfriendly.format_size(num_bytes)
You entered: 16 GB

Contact

The latest version of humanfriendly is available on PyPI and GitHub. The documentation is hosted on Read the Docs. For bug reports please create an issue on GitHub. If you have questions, suggestions, etc. feel free to send me an e-mail at peter@peterodding.com.

License

This software is licensed under the MIT license.

© 2015 Peter Odding.

Release history Release notifications

History Node

4.12.1

History Node

4.12

History Node

4.11

History Node

4.10

History Node

4.9

History Node

4.8

History Node

4.7

History Node

4.6

History Node

4.5

History Node

4.4.2

History Node

4.4.1

History Node

4.4

History Node

4.3

History Node

4.2

History Node

4.1

History Node

4.0

History Node

3.8

History Node

3.7

History Node

3.6.1

History Node

3.6

History Node

3.5

History Node

3.4.1

History Node

3.4

History Node

3.3

History Node

3.2

History Node

3.1

History Node

3.0

History Node

2.4

History Node

2.3.2

History Node

2.3.1

History Node

2.3

History Node

2.2.1

History Node

2.2

History Node

2.1

History Node

2.0.1

History Node

2.0

History Node

1.44.9

History Node

1.44.8

History Node

1.44.7

History Node

1.44.6

History Node

1.44.5

History Node

1.44.4

History Node

1.44.3

History Node

1.44.2

History Node

1.44.1

History Node

1.43.1

History Node

1.43

History Node

1.42

History Node

1.41

History Node

1.40

History Node

1.38

History Node

1.37

History Node

1.36

History Node

1.35

History Node

1.33

History Node

1.32

History Node

1.31

History Node

1.30

This version
History Node

1.29

History Node

1.27

History Node

1.26

History Node

1.25.1

History Node

1.25

History Node

1.24

History Node

1.23.1

History Node

1.23

History Node

1.22

History Node

1.21

History Node

1.20

History Node

1.19

History Node

1.17

History Node

1.16

History Node

1.15

History Node

1.14

History Node

1.13

History Node

1.11

History Node

1.10

History Node

1.9.6

History Node

1.9.4

History Node

1.9.3

History Node

1.9.2

History Node

1.9.1

History Node

1.9

History Node

1.8.6

History Node

1.8.4

History Node

1.8.3

History Node

1.8.2

History Node

1.8.1

History Node

1.8

History Node

1.7.1

History Node

1.7

History Node

1.6

History Node

1.5

History Node

1.4.2

History Node

1.4.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
humanfriendly-1.29.tar.gz (27.1 kB) Copy SHA256 hash SHA256 Source None Jun 24, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page