decore Base is an out-of-the-box "Python to Vue.js" data application dashboard that helps you go from idea to view in a few simple steps. It is aimed at those who want to focus on the results of their algorithms , do scientific work, or perform teaching or learning functions.
Project description
Introduction
decore Base is an out-of-the-box “Python to Vue.js” data application dashboard that helps you go from idea to view in a few simple steps. It is aimed at those who want to focus on the results of their algorithms, do scientific work or perform teaching and learning functions.
Notes
decore Base is currently a work in progress, only locally deployable, only available for Windows and not yet production ready.
The recommended IDE is Visual Studio Code and all my comments and documentation here will also refer to vscode only.
Insights into the current status of the Decore project.
This documentation was translated from German into English with Deepl.
Features and Integrations
Ready-made SPA (Single Page Application) with Vue.js using Quasar Framework (https://github.com/quasarframework/quasar)
Predefined Webapi for meta and actions with Flask (https://github.com/pallets/flask)
Integrated ORM for data management and database interfaces (SQLite) powered by the great Peewee (https://github.com/coleifer/peewee)
Data validation using Cerberus (https://github.com/pyeve/cerberus)
Password management using pykeepass (https://github.com/libkeepass/pykeepass)
Please support these great projects!
Contribution
The biggest help I can get right now is if you take a look at the project and tell me what you think. I am grateful for any criticism.
My current sample project is included directly in the Python package. To install the example application, please read the documentation in Example. Please read Installation, Use and Preparation first.
Anything found in the documentation in terms of features, bugs or ambiguities, please let me know.
Please use the problem area in the repository for this purpose.
Get started
To illustrate application creation with decore Base, we will now create a small web application together.
The decoartorators are primarily used to create meta-information for later evaluation in the decore Front web application and are nothing to be afraid of.
It’s really simple, please follow me!
Installation
Let’s first create an empty Python project in your desired directory.
To install decore Base, we run the following command in the project root directory. Let’s use the terminal in vscode.
pip install decore-Base
This requires an enabled Python environment! To learn more about this, visit Python environments in VS Code.
Preperation
Now let’s create a new file named app.py in the project root directory.
To use decore Base, we first import it into the module app.py.
from decore_base import decore
Then we use the prepare command to create all the necessary auxiliary files in the project root directory.
Now, to actually prepare the application, we run the command python app.py --prepare in the terminal. The path must be in the project root directory, i.e. where the app.py is located.
Usage
To allow the Python interpreter to process the future base classes, we add the following import.
from bases import *
Typically, a Python main module contains a query that checks if it is the main module so that we can call the main function afterwards.
Next, we create a line if __name__ == '__main__': in the app.py file.
To create a new Decore application instance, we use a @decore.app decorated main() function in the app.py file, just below the line: if __name__ == '__main__':.
from decore_base import decore
from bases import *
if __name__ == '__main__':
@decore.app(title='My App')
def main():
pass
Model
In a model we define the data fields that are needed for the later assigned base. It serves as a database interface to the database drivers such as SQLite, MySQL, PostgreSQL, etc.
We now create the file first_model.py in the directory models and insert the following code:
from decore_base.uniform.conform_model import *
class First_model(Conform_model):
firstname = CharField(verbose_name='First Name')
lastname = CharField(verbose_name='Last Name')
Base
These base classes serve the decore application as a carrier element for the view components, maintain the data model and are thus also considered the data source for evaluation in the decore Front web application.
Now we need to create a new Python module containing a base class, for example: first_base.py, in the bases directory in our project root directory. The bases directory was co-created by the python app.py --prepare command executed earlier.
from decore_base import decore
from models.first_model import First_model
@decore.base(title='First Base', icon='mdi-home', model=First_model)
class First_base:
pass
View
Views are used by the decore application to present the data sets in the decore Front web application.
With the view decorator we can now create a view component and link it to the previously created base class.
We now edit the first_base.py file again and extend the code as follows:
from decore_base import decore
from models.first_model import First_model
@decore.base(title='First Base', icon='mdi-home', model=First_model)
class First_base:
@decore.view(title='First View', icon='mdi-home', type='table', fields=[First_model.firstname, First_model.lastname])
def first_view():
pass
Dialog
Dialogs are the supporting elements for widgets in the decore Front web application. They can only be added to views and control the visibility and display style of child elements. Dialogs also get control over the submit functions of the widgets.
In our case, we create a diaolg to create a new person with first name and last name.
Here we go … again the file first_base.py and extend the code as follows:
from decore_base import decore
from models.first_model import First_model
@decore.base(title='My First Base', icon='mdi-home', model=First_model)
class First_base:
@decore.view(title='Person', icon='mdi-account', type='table', fields=[First_model.firstname, First_model.lastname])
def first_view():
@decore.dialog(title='Add Person', icon='mdi-plus', type='standard', display='drawer', activator='default-menu')
def first_dialog():
pass
Widget
Widgets are components with which we can perform interactions on the single record. They can only be added to dialogs and are stackable.
What we need now is to create an input form to enter the data for the new person.
from decore_base import decore
from models.first_model import First_model
@decore.base(title='My First Base', icon='mdi-home', model=First_model)
class First_base:
@decore.view(title='Person', icon='mdi-account', type='table', fields=[First_model.firstname, First_model.lastname])
def first_view():
@decore.dialog(title='Add Person', icon='mdi-plus', type='standard', display='drawer', activator='default-menu')
def first_dialog():
@decore.widget(title='Add Person Form', icon='mdi-account', type='form', fields=[First_model.firstname, First_model.lastname])
def first_widget():
pass
Action
Actions are methods with which decore Front can communicate with decore Base. They can be added to views and widgets and are the only real class methods in the meta kit.
We now need an action to store the data of the new person and extend the code in first_base.py as follows:
from decore_base import decore
from models.first_model import First_model
@decore.base(title='My First Base', icon='mdi-home', model=First_model)
class First_base:
@decore.view(title='Person', icon='mdi-account', type='table', fields=[First_model.firstname, First_model.lastname])
def first_view():
@decore.dialog(title='Add Person', icon='mdi-plus', type='standard', display='drawer', activator='default-menu')
def first_dialog():
@decore.widget(title='Add Person Form', icon='mdi-account', type='form', fields=[First_model.firstname, First_model.lastname])
def first_widget():
@decore.action(title='Save Person', icon='mdi-content-save', type='submit')
def first_action(self, data):
item = First_model(**data['item'])
item.title = item.firstname + ' ' + item.lastname
if item.save():
return True, item.title + ' saved successfully'
else:
return False, 'Error while saving ' + item.title
Run, Development and Build
To start only your application, run python app.py in your project root directory. Use the terminal in vscode.
Open the browser and type http://localhost:5555.
Development
To develop your application, use your debugger with the [dev] decore base development profile in vscode.
Open the browser and type http://localhost:5555.
Build
To build your application, run python app.py --build in your project root directory. Use the terminal in vscode.
Sample application
To better understand how decore base works, it is best to look at the sample application. The application represents my continuous development of decore base.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file decore_Base-0.2.27.tar.gz
.
File metadata
- Download URL: decore_Base-0.2.27.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76c8ea5517f56290cdec1163c9f2f5e465cf9d3b5635b43e03e741b78b1ad659 |
|
MD5 | 1b1ff4c9d737e1c185a04ea03b697306 |
|
BLAKE2b-256 | 1305a7f188a031217c2094e2ffbe81c5f8e711fef3c7ee20013b2280b54b54e0 |
File details
Details for the file decore_Base-0.2.27-py3-none-any.whl
.
File metadata
- Download URL: decore_Base-0.2.27-py3-none-any.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf93de77788df4d1d8f4e52a219b49eef636677833cda1e07c6413ff8aea19ae |
|
MD5 | 36db7918929453eb5be7bfd3ab101b55 |
|
BLAKE2b-256 | 17eefdc41adc60f2d311c40f0eed9221cf85c48b248212f183b0fa7b2e1db4fb |