Skip to main content

Autoinput

This library is for easier input in Python. It is 100% that you don't want to do this:

while 1:
  try:
    x = int(input())
    break
  except:
    print("Please input a number")

because it is 6 lines when you can have 1 line:

x = autoinput("", autoinput_type.INTEGER)

and everything is inside the function. No work by hands.

how to use

Here is the definition

def autoinput(outstring: str,
              typeel,
              pipe_in: Callable[[str], str]=input,
              pipe_out: Callable[[str], None]=print,
              pipe_out_end_name: str="end",
              pipe_out_flush_name: str = "flush",
              use_input_argument_for_output: bool=True,
              parser=None) -> Any:

First argument - outstring, string to show.

Second argument - typeel, use autoinput_type enum to form this (example: autoinput_type.INTEGER | autoinput_type.ARRAY)

kwargs:

pipe_in - for custom input function (for example if you use GUI)

pipe_out - for custom output function

parser - for custom parser (don't use with autoinput_type except of autoinput_type.ARRAY and/or autoinput_type.STRING)

pipe_out_end_name - if your custom output function doesn't have parameter like print's end use None, if has but called not end use the parameter to specify the name.

pipe_out_flush_name - the same as pipe_out_end_name but for flush.

use_input_argument_for_output - specifies if your pipe_in should get outsring as an output.

autoinput_type - the way to specify type of data

values

autoinput_type - IntFlag used to specify the type. Here are variants of it:

autoinput_type.INTEGER - return integer

autoinput_type.FLOAT - return floating point number

autoinput_type.STRING - return string, default type

autoinput_type.BOOLYN - asks yes or no, return bool

autoinput_type.BOOLTF - asks true or false, return bool

autoinput_type.ARRAY - asks for array where values are separated by space, return array of another type (if not specified returns str)

how to use

To combine autoinput_type use |. Example:

autoinput_type.INTEGER | autoinput_type.ARRAY

WARNING: Do not combine types like that:

autoinput_type.INTEGER | autoinput_type.FLOAT

You will get an error if you try to run this.

If you need not a basic type use parser named argument.

how to get Autoinput

To get Autoinput you can run this:

pip install autoinput

or:

GNU/Linux or MacOS:

python3 -m pip install autoinput

Windows:

py -m pip install autoinput

Metadata

Release files for autoinput 1.6.1

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

Source distribution (sdist)

Source distribution for autoinput 1.6.1
File Size Uploaded
autoinput-1.6.1.tar.gz 6.3 kB Details

Built distribution (wheel)

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

Total release size: 11.4 kB

Release files / autoinput-1.6.1.tar.gz

Download URL autoinput-1.6.1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f9d2085f7852a7312028d3b9e1282b3f2ad1cb303751e94c5720f4b1b9e5a5d8
BLAKE2b-256 checksum
How to use checksums
6635f2cf979784982818739da440f8f446a2fe5626651d99b67138d3fb74b33f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / autoinput-1.6.1-py3-none-any.whl

Download URL autoinput-1.6.1-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
276b01055c915472506918ec7b916fcc51ea85cb4bcab36269bf73c6040be299
BLAKE2b-256 checksum
How to use checksums
607a926a46ca54e84ddc8d3cde5e1eef6a4f6b7e2d99e7b13f82bdae9cd0aa07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.6.1 This release

2 release files

1.6

2 release files

1.5.2

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

0.0.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