# SpaceWorld
[](https://www.python.org/)
[](https://opensource.org/licenses/MIT)
**Spaceworld is a new generation Cli framework for convenient development of your
teams written in Python 3.12+ with support for asynchronous commands**
Source Code: https://github.com/Binobinos/SpaceWorld
The key features are:
- Highest speed: For high-load applications
- Huge flexibility: The ability to customize handlers, commands, and modules
- Code simplicity: With all the advantages, your code remains as simple as possible
- Support for *args, **kwargs
- Extended type annotations: Use new annotations like Annotated, Literal, Union, and others
- Support for Validators and transformers in annotations
# Example
The simplest example
```python
import spaceworld
def main():
print("Hello World")
if __name__ == '__main__':
spaceworld.run(main)
```
Copy that to a file main.py.
Test it:
```
$ python main.py main
Hello World
$ python main.py main --help
Usage: main [ARGS] [OPTIONS]
None documentation
Options:
--help - Displays the help on the command
```
# One Cli argument
This output for the function looks very simple.
Let's create a new function. hello, which displays a welcome message to the user
```python
import spaceworld
def hello(name: str):
print(f"Hello {name}")
if __name__ == '__main__':
spaceworld.run(hello)
```
Now let's run this script and see what happens.
```shell
$ python app.py hello
ERROR: Missing required argument: 'name'
```
We see an error due to the absence of the name argument. Let's welcome bino
```shell
$ python app.py hello bino
Hello bino
```
# Async command
Creating an asynchronous command
```python
import asyncio
import spaceworld
async def sleep(second: int):
await asyncio.sleep(second)
print(f"Hello in {second} second")
if __name__ == '__main__':
spaceworld.run(sleep)
```
Copy that to a file main.py.
Test it:
```shell
$ python .\main.py sleep 1
# After 1 second
Hello in 1 second
$ python .\main.py sleep
# After 1 second
Hello in 1 second
$ python .\main.py sleep 5
# After 5 second
Hello in 5 second
```
# The validation Command
Creating a validation Command
```python
from typing import Annotated
import spaceworld
def check(
age: Annotated[
int,
lambda x: x if x >= 18 else
ValueError("The user must be over 18 years old")]):
print(f"Hello {age} year old")
if __name__ == '__main__':
spaceworld.run(check)
```
Copy that to a file main.py.
Test it:
```shell
$ python .\main.py check 1
ERROR:Invalid argument for 'age':
Error in the Annotated validation for `1`: Arg: 1, Error: The user must be over 18 years old, <class 'spaceworld.exceptions.annotations_error.AnnotationsError'>
$ python .\main.py check 15
ERROR:Invalid argument for 'age':
Error in the Annotated validation for `15`: Arg: 15, Error: The user must be over 18 years old, <class 'spaceworld.exceptions.annotations_error.AnnotationsError'>
$ python .\main.py check 18
Hello 18 year old
$ python .\main.py check -1
ERROR:Invalid argument for 'age':
Error in the Annotated validation for `-1`: Arg: -1, Error: The user must be over 18 years old, <class 'spaceworld.exceptions.annotations_error.AnnotationsError'>
```
---
Great!
As we can see, we entered the hello command with the bino argument and the script displayed greeting messages to him.
But what if we want to make a conclusion in big letters? Then let's add a flag.
## Documentation
Full documentation this:
[Docs](documentation/learn.md)
## License
This project is licensed under the terms of the MIT license.
Raw data
{
"_id": null,
"home_page": "https://github.com/Binobinos/spaceworld-sli",
"name": "spaceworld",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "python, shell, cli, performance, terminal, async, python3, typehints, spaceworld",
"author": "binobinos",
"author_email": "binobinos <binobinos.dev@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/06/2d/f42fd1edd07de32d46eafef1fbc202070073e7af064f3ac70220a31b5b31/spaceworld-0.1.0.tar.gz",
"platform": "any",
"description": "# SpaceWorld\r\n[](https://www.python.org/)\r\n[](https://opensource.org/licenses/MIT)\r\n\r\n\r\n**Spaceworld is a new generation Cli framework for convenient development of your\r\nteams written in Python 3.12+ with support for asynchronous commands**\r\n\r\nSource Code: https://github.com/Binobinos/SpaceWorld\r\n\r\n\r\nThe key features are:\r\n\r\n- Highest speed: For high-load applications\r\n- Huge flexibility: The ability to customize handlers, commands, and modules\r\n- Code simplicity: With all the advantages, your code remains as simple as possible\r\n- Support for *args, **kwargs\r\n- Extended type annotations: Use new annotations like Annotated, Literal, Union, and others\r\n- Support for Validators and transformers in annotations\r\n\r\n# Example\r\n\r\nThe simplest example\r\n\r\n```python\r\nimport spaceworld\r\n\r\n\r\ndef main():\r\n print(\"Hello World\")\r\n\r\n\r\nif __name__ == '__main__':\r\n spaceworld.run(main)\r\n```\r\n\r\nCopy that to a file main.py.\r\n\r\nTest it:\r\n\r\n```\r\n$ python main.py main\r\n\r\nHello World\r\n\r\n$ python main.py main --help\r\n\r\nUsage: main [ARGS] [OPTIONS] \r\nNone documentation\r\n\r\nOptions:\r\n --help - Displays the help on the command\r\n\r\n```\r\n\r\n# One Cli argument\r\n\r\nThis output for the function looks very simple.\r\nLet's create a new function. hello, which displays a welcome message to the user\r\n\r\n```python\r\nimport spaceworld\r\n\r\n\r\ndef hello(name: str):\r\n print(f\"Hello {name}\")\r\n\r\n\r\nif __name__ == '__main__':\r\n spaceworld.run(hello)\r\n```\r\n\r\nNow let's run this script and see what happens.\r\n\r\n```shell\r\n$ python app.py hello\r\n\r\nERROR: Missing required argument: 'name'\r\n```\r\n\r\nWe see an error due to the absence of the name argument. Let's welcome bino\r\n\r\n```shell\r\n$ python app.py hello bino\r\n\r\nHello bino\r\n```\r\n# Async command\r\n\r\nCreating an asynchronous command\r\n\r\n```python\r\nimport asyncio\r\n\r\nimport spaceworld\r\n\r\n\r\nasync def sleep(second: int):\r\n await asyncio.sleep(second)\r\n print(f\"Hello in {second} second\")\r\n\r\n\r\nif __name__ == '__main__':\r\n spaceworld.run(sleep)\r\n\r\n```\r\n\r\nCopy that to a file main.py.\r\n\r\nTest it:\r\n```shell\r\n$ python .\\main.py sleep 1\r\n\r\n# After 1 second\r\nHello in 1 second\r\n\r\n$ python .\\main.py sleep\r\n\r\n# After 1 second\r\nHello in 1 second\r\n\r\n$ python .\\main.py sleep 5\r\n\r\n# After 5 second\r\nHello in 5 second\r\n```\r\n\r\n# The validation Command\r\n\r\nCreating a validation Command\r\n\r\n```python\r\n\r\nfrom typing import Annotated\r\n\r\nimport spaceworld\r\n\r\n\r\ndef check(\r\n age: Annotated[\r\n int,\r\n lambda x: x if x >= 18 else\r\n ValueError(\"The user must be over 18 years old\")]):\r\n print(f\"Hello {age} year old\")\r\n\r\n\r\nif __name__ == '__main__':\r\n spaceworld.run(check)\r\n\r\n```\r\n\r\nCopy that to a file main.py.\r\n\r\nTest it:\r\n```shell\r\n$ python .\\main.py check 1\r\n\r\nERROR:Invalid argument for 'age':\r\nError in the Annotated validation for `1`: Arg: 1, Error: The user must be over 18 years old, <class 'spaceworld.exceptions.annotations_error.AnnotationsError'> \r\n\r\n$ python .\\main.py check 15\r\n\r\nERROR:Invalid argument for 'age': \r\nError in the Annotated validation for `15`: Arg: 15, Error: The user must be over 18 years old, <class 'spaceworld.exceptions.annotations_error.AnnotationsError'>\r\n\r\n$ python .\\main.py check 18\r\n\r\nHello 18 year old\r\n\r\n$ python .\\main.py check -1\r\n\r\nERROR:Invalid argument for 'age': \r\nError in the Annotated validation for `-1`: Arg: -1, Error: The user must be over 18 years old, <class 'spaceworld.exceptions.annotations_error.AnnotationsError'>\r\n```\r\n\r\n---\r\n\r\nGreat!\r\nAs we can see, we entered the hello command with the bino argument and the script displayed greeting messages to him.\r\n\r\nBut what if we want to make a conclusion in big letters? Then let's add a flag.\r\n\r\n## Documentation\r\n\r\nFull documentation this:\r\n[Docs](documentation/learn.md)\r\n\r\n## License\r\n\r\nThis project is licensed under the terms of the MIT license.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Spaceworld is a new generation Cli framework for convenient development of your teams written in Python 3.12+ with support for asynchronous commands",
"version": "0.1.0",
"project_urls": {
"Bug_Tracker": "https://github.com/Binobinos/SpaceWorld/issues",
"Homepage": "https://github.com/Binobinos/spaceworld-sli",
"Source_Code": "https://github.com/Binobinos/SpaceWorld"
},
"split_keywords": [
"python",
" shell",
" cli",
" performance",
" terminal",
" async",
" python3",
" typehints",
" spaceworld"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c2e9dd91f17c900d00f90f0bfe6979b511b08c2ea842a012850551991c3cc0b7",
"md5": "c82f2da871c91d4e48200f337b6c0e91",
"sha256": "ce96d75ded708354ffccc7585e1019366bb30bdd57cfbbdb5d81a7ba8c8253d3"
},
"downloads": -1,
"filename": "spaceworld-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c82f2da871c91d4e48200f337b6c0e91",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 17633,
"upload_time": "2025-08-14T23:12:53",
"upload_time_iso_8601": "2025-08-14T23:12:53.786066Z",
"url": "https://files.pythonhosted.org/packages/c2/e9/dd91f17c900d00f90f0bfe6979b511b08c2ea842a012850551991c3cc0b7/spaceworld-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "062df42fd1edd07de32d46eafef1fbc202070073e7af064f3ac70220a31b5b31",
"md5": "24d19badd835540f3a7c02e0aed82700",
"sha256": "096c2ba5c7167af28ad78294b84f82c2befa3711ca89f7c9eddfebea40e8d782"
},
"downloads": -1,
"filename": "spaceworld-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "24d19badd835540f3a7c02e0aed82700",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 20902,
"upload_time": "2025-08-14T23:12:55",
"upload_time_iso_8601": "2025-08-14T23:12:55.175380Z",
"url": "https://files.pythonhosted.org/packages/06/2d/f42fd1edd07de32d46eafef1fbc202070073e7af064f3ac70220a31b5b31/spaceworld-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-14 23:12:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Binobinos",
"github_project": "spaceworld-sli",
"github_not_found": true,
"lcname": "spaceworld"
}