Script creates a project with the MVC pattern
New in version 1.0.0. See also Use a clean architecture for your applications. Use a clean architecture for your applications. KivyMD allows you to quickly
create a project template with the MVC pattern. So far, this is the only
pattern that this utility offers. You can also include database support in
your project. At the moment, support for the Firebase database
(the basic implementation of the real time database) and RestDB
(the full implementation) is available. Template command: Example command: This command will by default create a project with an MVC pattern.
Also, the project will create a virtual environment with Python 3.10,
Kivy version 2.1.0 and KivyMD master version. Note Please note that the Python version you specified must be installed on your
computer. Note Note that in the following command, you can use one of two database names:
‘firebase’ or ‘restdb’. Template command: Example command: This command will create a project with an MVC template by default.
The project will also create a virtual environment with Python 3.10,
Kivy version 2.1.0, KivyMD master version and a wrapper for working with
the database restdb.io. Note Please note that database.py the shell in the DataBase class uses the
database_url and api_key parameters on the test database (works only in read mode),
so you should use your data for the database. Template command: Example command: After creating the project, open the file main.py, there is a lot of useful
information. Also, the necessary information is in other modules of the project
in the form of comments. So do not forget to look at the source files of the
created project. the name of the pattern with which the project will be created directory in which the project will be created project name the version of Python (specify as python3.9 or python3.8) with which the virtual environment will be created version of Kivy (specify as 2.1.0 or master) that will be used in the project the name of the class which be used when creating the project pattern provides a basic template for working with the ‘firebase’ library or a complete implementation for working with a database ‘restdb.io’ creates a hot reload entry point to the application creates application localization files Warning On Windows, hot reloading of Python files may not work.
But, for example, there is no such problem in macOS. If you fix this,
please report it to the KivyMD community.
Project creation
python -m kivymd.tools.patterns.create_project \
name_pattern \
path_to_project \
name_project \
python_version \
kivy_version
python -m kivymd.tools.patterns.create_project \
MVC \
/Users/macbookair/Projects \
MyMVCProject \
python3.10 \
2.1.0
Creating a project using a database
python -m kivymd.tools.patterns.create_project \
name_pattern \
path_to_project \
name_project \
python_version \
kivy_version \
--name_database
python -m kivymd.tools.patterns.create_project \
MVC \
/Users/macbookair/Projects \
MyMVCProject \
python3.10 \
2.1.0 \
--name_database restdb
class DataBase:
def __init__(self):
database_url = "https://restdbio-5498.restdb.io"
api_key = "7ce258d66f919d3a891d1166558765f0b4dbd"
Preview of the basic MVC template using the RestDB database
Create project with hot reload
python -m kivymd.tools.patterns.create_project \
name_pattern \
path_to_project \
name_project \
python_version \
kivy_version \
--use_hotreload
python -m kivymd.tools.patterns.create_project \
MVC \
/Users/macbookair/Projects \
MyMVCProject \
python3.10 \
2.1.0 \
--use_hotreload yes
Others command line arguments
Required Arguments
Optional arguments
API - kivymd.tools.patterns.create_project
- kivymd.tools.patterns.create_project.available_patterns = ['MVC']
- kivymd.tools.patterns.create_project.available_databases = ['firebase', 'restdb']
- kivymd.tools.patterns.create_project.main()
- kivymd.tools.patterns.create_project.create_main_with_hotreload(path_to_project: str, project_name: str, name_screen: str, module_name: str, name_database: str, use_localization: str) None
- kivymd.tools.patterns.create_project.create_main(name_database: str, use_localization: str, path_to_project: str, project_name: str) None
- kivymd.tools.patterns.create_project.create_model(name_database: str, name_screen: str, module_name: str, path_to_project: str) None
- kivymd.tools.patterns.create_project.create_controller(name_database: str, use_hotreload: str, name_screen: str, module_name: str, path_to_project: str) None
- kivymd.tools.patterns.create_project.create_view(name_database: str, use_localization: str, name_screen: str, module_name: str, path_to_project: str) None
- kivymd.tools.patterns.create_project.create_requirements(name_database: str, path_to_project: str) None
- kivymd.tools.patterns.create_project.create_makefile(path_to_project: str, project_name: str, module_name: str, name_screen: str) None
- kivymd.tools.patterns.create_project.create_virtual_environment(python_version: str, path_to_project: str) None
- kivymd.tools.patterns.create_project.install_requirements(path_to_project: str, kivy_version: str, name_database: str) None
- kivymd.tools.patterns.create_project.check_databases(name_database: str, path_to_project: str) None
- kivymd.tools.patterns.create_project.create_argument_parser() ArgumentParserWithHelp