Learn how to use SpaceWorld from this step-by-step user guide.
You can learn all the features of SpaceWorld in this guide for creating simple and complex CLI applications. Let’s go on a space trip using this framework!
First of all, if you are not familiar with Python annotations, let’s study them.
def hello(name: str, upper: bool = False) -> None:
string = f"Hello {name}"
print(string.upper() if upper else string)
This example shows a few things:
This annotation affects the resulting function value and validation in SpaceWorld.
All the code blocks can be copied and used directly (they are tested Python files).
To run any of the examples, copy the code to a file main.py, and run it:
python main.py
Study in order or skip to the appropriate section:
Improved framework structure
Added support for TypedDict, byte, complex, bytearray, Unpack in *args, **kwargs
Fixed errors with confirm and others