Script creates a project with the MVC pattern

New in version 1.0.0.

See also

MVC pattern

Use a clean architecture for your applications.

https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/preview-mvc.png

Project creation

python -m kivymd.tools.patterns.create_project name_pattern path_to_project name_project python_used kivy_used

For example

python -m kivymd.tools.patterns.create_project MVC /Users/macbookair/Projects MyProject python3.9 master

This command will by default create a project with an MVC pattern that uses the Firebase library. Also, the project will create a virtual environment with Python 3.9 and the Kivy/KivyMD master version.

https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/mvc-firebase.png

There is only one screen available in the project. The application will ask the user for a login and password, check this data with the data in the database and report the result:

https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/mvc-firebase-preview.gif

To create a project without using the Firebase library, run the command:

python -m kivymd.tools.patterns.create_project name_pattern path_to_project name_project python3.9 master --use_firebase no

Create project with hot reload

python -m kivymd.tools.patterns.create_project name_pattern path_to_project name_project python3.9 master --use_hotreload yes

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.

Command line arguments

Required Arguments

  • pattern
    • the name of the pattern with which the project will be created

  • directory
    • directory in which the project will be created

  • name
    • project name

  • python_version
    • the version of Python (specify as python3.9 or python3.8) with

    • which the virtual environment will be created

  • kivy_version
    • version of Kivy (specify as 2.0.0 or master) that will be used in the project

Optional arguments

  • name_screen
    • the name of the class wich be used when creating the project pattern

  • use_firebase
    • use a basic template to work with the ‘firebase’ library

  • use_hotreload
    • creates a hot reload entry point to the application

-use_localization
  • creates application localization files

Warning

On Windows, hot reloading of Python files may not work. But, for example, there is no such problem in Mac OS. If you fix this, please report it to the KivyMD community.

API - kivymd.tools.patterns.create_project

kivymd.tools.patterns.create_project.available_patterns = ['MVC']
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, use_firebase: str, use_localization: str) NoReturn
kivymd.tools.patterns.create_project.create_main(use_firebase: str, use_localization: str, path_to_project: str, project_name: str) NoReturn
kivymd.tools.patterns.create_project.create_model(use_firebase: str, name_screen: str, module_name: str, path_to_project: str) NoReturn
kivymd.tools.patterns.create_project.create_controller(use_firebase: str, use_hotreload: str, name_screen: str, module_name: str, path_to_project: str) NoReturn
kivymd.tools.patterns.create_project.create_view(use_firebase: str, use_localization: str, name_screen: str, module_name: str, path_to_project: str) NoReturn
kivymd.tools.patterns.create_project.create_requirements(use_firebase: str, path_to_project: str) NoReturn
kivymd.tools.patterns.create_project.create_makefile(path_to_project: str, project_name: str, module_name: str, name_screen: str) NoReturn
kivymd.tools.patterns.create_project.create_mofile(path_to_project: str) NoReturn
kivymd.tools.patterns.create_project.create_virtual_environment(python_version: str, path_to_project: str) NoReturn
kivymd.tools.patterns.create_project.localization_po_file(path_to_project: str) NoReturn
kivymd.tools.patterns.create_project.install_requirements(path_to_project: str, kivy_version: str, use_firebase: str) NoReturn
kivymd.tools.patterns.create_project.rename_ext_py_tmp_to_py(path_to_project: str) NoReturn
kivymd.tools.patterns.create_project.move_init(path_to_project: str, name_screen: str) NoReturn
kivymd.tools.patterns.create_project.chek_camel_case_name_project(name_project) Union[bool, list]
kivymd.tools.patterns.create_project.replace_in_file(path_to_file: str, args) NoReturn
kivymd.tools.patterns.create_project.create_argument_parser() ArgumentParserWithHelp