Fletxible is a Python web boilerplate project designed to provide a solid foundation for building web applications with Python and Flet. The project comes pre-configured with a range of tools and features to make it easy for developers to get started building their applications, without the need to spend time setting up infrastructure or configuring tools.
To use Fletxible, you need to have the following installed:
- Latest version of Flet
- Python 3.5+
If you don't have Flet installed, installing Fletxible automatically installs it for you. You can install Fletxible using the following command:
$ pip install Fletxible
After installing Fletxible, you can test if it's working properly by running the following command:
$ fx-init
If the package was installed correctly, a folder called src
will be generated inside the root directory. Other directories and files will also be generated.
Open the config.py
file inside the src
folder and configure the document as needed. Change the site name, repository link, as well as any theme-related settings. You can also add/remove the navigation section as needed.
When you're ready, change directories to the source folder, cd src
, and then run the following command to generate your files/pages:
python3 scripts/build.py
If successful, the script should generate the files inside the pages
folder that correspond to the config.py
navigation map.
You can then run the following command to see your application:
python3 main.py
If the setup has no error, you can start customizing your pages by adding in your personal layout directly within the generated pages inside the pages
directory.
This algorithm is a script that loads and processes data from a YAML file flet_config.yml
that contains navigation information for a web application. The script then updates and creates various files and directories necessary for the application to function.
Here is a summary of what the algorithm does (v0.2.0):
-
Import necessary libraries and functions
-
Define a dictionary variable to hold route keys
-
Define several functions to perform various tasks:
- open_yaml_script(): Loads data from the "fx_config.yml" file.
- check_pages_directory_script(): Checks if a "pages" directory exists and creates one if not.
- update_pages_directory_script(docs: dict): Loops over the files in the "pages" directory and deletes any files that are not listed in the navigation information.
- handle_navigation_routing_script(docs: dict): Loops over the navigation information and writes route strings to a temporary file.
- set_application_routing_script(docs: dict): Reads the temporary file created in the previous step, creates a route.py file with the appropriate routes, and deletes the temporary file.
- set_default_methods_script(docs: dict): Loops over the navigation information and creates default pages for each page listed, and creates a route.pickle file with information about the modules used in the application.
- map_yaml(yaml_file_path, output_file_path): Reads a YAML file and writes its contents to a Python file with a specified filename.
- script(page: ft.Page): Main function that calls the other functions to process the data and set up the application.
Overall, the script is part of a larger application development process that involves reading and processing data from a YAML file, creating and updating various files and directories, and setting up routing information for a web application.
Contributions are highly encouraged and welcomed.
Fletxible is open-source and licensed under the MIT License.