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. When creating a project, you can specify which views should use responsive
behavior. To do this, specify the name of the view/views in the
–use_responsive argument: Template command: The FirstScreen and SecondScreen views will be created with an responsive
architecture. For more detailed information about using the adaptive view, see
the MDResponsiveLayout
widget. 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 When you need to create an application template with multiple screens,
use multiple values separated by a space for the name_screen parameter,
for example, as shown below: Template command: 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 the name/names of the views to be used by the responsive UI 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#
kivymd.create_project \
name_pattern \
path_to_project \
name_project \
python_version \
kivy_version
kivymd.create_project \
MVC \
/Users/macbookair/Projects \
MyMVCProject \
python3.10 \
2.1.0
Creating a project using a database#
kivymd.create_project \
name_pattern \
path_to_project \
name_project \
python_version \
kivy_version \
--name_database
kivymd.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"
Create project with hot reload#
kivymd.create_project \
name_pattern \
path_to_project \
name_project \
python_version \
kivy_version \
--use_hotreload
kivymd.create_project \
MVC \
/Users/macbookair/Projects \
MyMVCProject \
python3.10 \
2.1.0 \
--use_hotreload yes
Create project with responsive view#
kivymd.create_project \
name_pattern \
path_to_project \
name_project \
python_version \
kivy_version \
--name_screen FirstScreen SecondScreen ThirdScreen \
--use_responsive FirstScreen SecondScreen
Others command line arguments#
Required Arguments#
Optional arguments#
kivymd.create_project \
name_pattern \
path_to_project \
name_project \
python_version \
kivy_version \
--name_screen FirstScreen SecondScreen ThirdScreen
API - kivymd.tools.patterns.create_project
#
- kivymd.tools.patterns.create_project.main()#
Project creation function.