Skip to main content

Questioner

https://img.shields.io/pypi/v/questioner.svg https://img.shields.io/travis/larsyencken/questioner.svg Documentation Status

A human-friendly Python library for asking people questions on the command-line.

Motivation

Data often needs a human eye. I found myself writing over and over the code to help me investigate data manually on the command-line; questioner is my attempt to make this tool the right way once.

It’s suitable for:

  • Labelling data manually faster than you can in excel spreadsheets or similar setups

  • Active learning loops where you and a machine-learnining agent collaborate, reducing the need for training data

  • Short question-based UIs on the command-line where you need a user’s input to continue

Usage

Python API

You write a simple Python api that asks you things.

import questioner

with questioner.Cli() as c:
    is_hurt = c.yes_or_no('Are you hurt')

    symptom_set = c.choose_many(
        'What symptoms do you have?',
        ['pain', 'nausea', 'anxiety'],
    )

    rating = c.give_an_int(
        'How would you rate this experience (1-5)', 1, 5
    )

    choice = c.choose_one('Which do you like best',
                          ['dogs', 'cats', 'horses'])

On the terminal

When run, the experience on the terminal looks like the following:

$ python -m questioner.demo
Are you hurt? (y/n) n

What symptoms do you have?
  pain? (y/n) y
  nausea? (y/n) n
  anxiety? (y/n) n

How would you rate this experience (1-5)
3

Which do you like best
  0. dogs
  1. cats
  2. horses
1

The user can by default skip a question (raising QuestionSkipped) by pressing enter, or quit the entire cli by pressing q (raising QuitCli).

Features

  • Support for boolean, numeric, single-choice and multiple-choice questions

  • Uses single-keystroke input where possible

License

MIT licensed.

History

0.1.0 (2019-02-15)

  • First release on PyPI.

Metadata

Release files for questioner 0.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 questioner 0.1.0
File Size Uploaded Provenance
questioner-0.1.0.tar.gz 10.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 16.9 kB

Release files / questioner-0.1.0.tar.gz

Download URL questioner-0.1.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4328bd3ab701aa94edbe8cadff8f5309e6a25fbfe7e417c1826e0807a71a0f80
BLAKE2b-256 checksum
How to use checksums
6806b1fc58c9fca1a6b3f687e9cce12ecf9ae46915ec871e473a12834c1664d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / questioner-0.1.0-py2.py3-none-any.whl

Download URL questioner-0.1.0-py2.py3-none-any.whl
Size 6.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3aecfc3ce751a8cd04b2273349e65d19f1502b125d9867e14723cb9021dcb0db
BLAKE2b-256 checksum
How to use checksums
dd2405a68eea43eacf57341f8a358f526d176f77d77bd960b7ead16623dcff19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for questioner 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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