Skip to main content

A Python module for calling functions by string with argument support

Project description

Callixir

A small and convenient tool for implementing command execution in any application. Suitable for a console application or a social media bot.

Its principle of operation is simple: the user sends a string containing the command name and its arguments, if required. The next step is to execute the corresponding method based on this string.


Example

from callixir import SimpleShell

shell = SimpleShell()

@shell.reg("echo")
def cmdEcho(arg: str):
	return f"Echo {arg}"

@shell.reg("sum")
def сmdSum(a: int, b: int):
	return a + b

@shell.reg("log")
def cmdLog(*args: str):
	return ", ".join(args)

result = shell.execute("echo Hello_World!")
print(result.result) # Echo Hello_World!

result = shell.execute("sum 1 2")
print(result.result) # 3

result = shell.execute("log 1 2 Hi 10 J 100 \"many words in one\" 999 71")
print(result.result) # 1, 2, Hi, 10, J, 100, many words in one, 999, 71

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

callixir-0.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

callixir-0.0.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file callixir-0.0.1.tar.gz.

File metadata

  • Download URL: callixir-0.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.9 Windows/11

File hashes

Hashes for callixir-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3b81e14ca871c53067543484fbf3fbcec2a64a53aa657643eb6c60a27a8be05a
MD5 0a226fccfbb5725806d0e0fc1552d7a5
BLAKE2b-256 8ff0f3dc759d31b7374d649fc39cab8476609ea4cbfa7a56bcf7eda8ada8c585

See more details on using hashes here.

File details

Details for the file callixir-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: callixir-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.9 Windows/11

File hashes

Hashes for callixir-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75b7388fba179bb41320f8a7d182b92a0e2dc2209d550145782499305e1b43e0
MD5 6d0a5ce652f0399e2c1583a7c072981c
BLAKE2b-256 e2ee63c2e76bc4bbca494b827f7080252f35e1ffa13b37f3b2cbf665deddea80

See more details on using hashes here.

Supported by

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