Github
PYPI
Discord
EasyCommandInterface
Sometimes running a project like flask or a discord bot will remove the flexibility of using console to send commands, This library will revive that with just a simple setup.
How to install
To install just use following command
pip install EasyCommandInterface
If you are looking for latest beta/alpha, you can use following command
pip install --upgrade git+https://github.com/Ashenguard/EasyCommandInterface.git
Example
from EasyCommandInterface import CommandInterface
# Only one Interface is allowed, If you try to create another one CommandInterfaceError will be raised.
interface = CommandInterface()
# A simple command, All the arguments are passed as string.
# Example input: test 1 Hi "Hello World!"
# Result: TEST COMMAND: ('1', 'Hi', 'Hello world!')
@interface.command('test')
def _test(*args):
print('TEST COMMAND:', args)
# Another command with fixed arguments! If 2 arguments is not passed, It will raise CommandExecutionError
# Example input: sum 5 5.5
# Result: 10.5
@interface.command('sum')
def _sum(a, b):
print(float(a) + float(b))
# As default, All commands will be executed inside a separate thread, But if you set `thread` to `False`, Command will be executed inside the interface thread
# Example input: sleep
# Result: Nothing - Except for that the interface will not accept another command before this one ends.
@interface.command('sleep', thread=False)
def _sleep(*args):
from time import sleep
sleep(10)
# There is a known issue (Fetal Python Error) when the program ends if the interface is waiting for another command.
# So we recommend using the `stop` method inside a not threaded command to stop the input thread as soon as it receives the command.
# Calling this method outside will stop the thread AFTER it received another command.
@interface.command('exit', thread=False)
def _exit():
interface.stop()
# To start the interface, just say START!
interface.start()
# Since the interface will read all inputs as soon as it starts, If you need an input just use following method. Using `input` might not work as intended
value = interface.get_input('Input something: ')
print("Input received:", value)
# You should keep the program alive since as soon as main program ends, Interface will be closed.
# You can use other projects like a flask or discord bot or ... instead
while interface.is_alive():
pass
❗ There will be more tutorials and examples at Wiki ❗
Metadata
Release files for EasyCommandInterface 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| EasyCommandInterface-1.0.0.tar.gz | 4.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| EasyCommandInterface-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / EasyCommandInterface-1.0.0.tar.gz
| Download URL | EasyCommandInterface-1.0.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c53d8954ff6de648b862532f66e3fe96d7ff87b69ce6b78e435efce137b75eb9
|
|
BLAKE2b-256 checksum How to use checksums |
4230e7d55d4906d2fdc6a98db64835cc2bf870620f0dba8c078318d36d6efdbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.27.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.6
|
Release files / EasyCommandInterface-1.0.0-py3-none-any.whl
| Download URL | EasyCommandInterface-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a63a913c51b06e64e68870b0fac211b40fb37fab1ad9ab5bc5b0ec164a98e3ee
|
|
BLAKE2b-256 checksum How to use checksums |
06a42239da159f1115f42430aec2a094c908508fe70862e38bbba15b31081323
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.27.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.6
|
Security for EasyCommandInterface 1.0.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.