Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Pythonic Vue.js

Project description




Install

using pip

pip install pyvuejs



Usage

start server by main.py file in project directory

python .\main.py



VUE editing guide

same as vue.js, can support by linting

  • for now, template, style blocks are supported
<template>
    <div id="sample">
        <p>{{ text }}</p>
    </div>
</template>

<style>
    div#sample {
        width: 100%;
        height: 100%;
    }
</style>



App registering guide

  • App registers in main.py in project directory/main.py
  • same syntax as Vue.js javascript defines
from pyvuejs import Vue

class sample():
    def data(self):
        # return as dictionary
        return {
            "text": "hello, pyvuejs!"
        }

    def methods(self):
        def change_text(self):
            self.text = "I'm changed!"

        # return as dictionary
        return {
            "change_text": change_text
        }

Vue.createApp(sample).mount("#sample")

"""
and many other apps...
"""


Component editing guide

  • component defines in component directory
  • name of python file is not important
  • no global components
from pyvuejs import Vue

class sample():
    # props are list only
    props = [ "label" ]
    # template is required
    template = "<label>{{ label }}</label>"

Vue.component("sample-label", sample)



Routing editing guide

  • Routing options register in project directory/router/init.py
from pyvuejs import Vue

Vue.Router({
    # url of public files can be registered
    "public": {
        "url": "/public"
    },
    # url of app and components can be registered
    "sample": {
        # url is required
        "url": "/sample",
        # names of components to use
        "components": [ "sample-label" ]
    }
})



Todo

  • [ ] method, created, mounted of component


License

pyvuejs is MIT license



Release History

change log of Rev versions deleted

  • V 0.1.0 [2020/07/17]
    • initial commit

  • V 0.2.0 [2020/07/18]

    • enable componenting
    • multi locational data binding
    • add computed binding
    • dataSession
  • V 0.2.1 [2020/07/19]

    • change decoration as "@method", "@compute"
    • multi locational strategy changed to IP from idGeneration
  • V 0.2.2 [2020/07/19]

    • bug fixes
    • parsing errors if model block is empy

  • V 0.3.0 [2020/07/21]

    • change backend server to flask from quart
    • changes in requirements.txt
    • bug fixed
      • session datas are not sync from view to model
  • V 0.3.1 [2020/07/21]

    • cli changed
      • "init" command is available from module cli
      • "run", "stop", "create", "remove" commands are moved to manage.py
    • logger added
      • server logs server-side loggings only
      • client(web) logs client-side loggings only
  • V 0.3.2 [2020/07/22]

    • standalone mode added
      • use PySide2 WebEngineView as UI
    • "logging" option added
      • if enable, server log to console
      • if not, server doesn't log to console
  • V 0.3.3 [2020/07/22]

    • bug fixed
      • model's native functions got erros during interpreting
    • add pyvue-component tag and change component to pyvue-component
      • format change to normal html format, "<pyvue-component endpoint="componentName"></pyvue-component>"
    • webview attribute changed to appView
    • creating a new WebView window is available from model
  • V 0.3.4 [2020/07/22]

    • change UI module from PySide2 to pycefsharp
      • appView can be invoked, too

  • V 0.4.0 [2020/07/28]

    • change structure of project
      • project now managed by app
        • app has single view.html file
        • app can has multiple models in models.py
      • project information managed by .config file
    • cli changed
      • cli provides as follows
        • create-project
        • create-app
        • remove-app
        • start
        • stop
  • V 0.4.1 [2020/07/29]

    • remove unnecessary requirements
    • change session refresh interval from 0.5s to 0.1s
  • V 0.4.2 [2020/07/29]

    • change webview frontend from pycefsharp to pywebview
  • V 0.4.3 [2020/07/29]

    • change webview frontend from pywebview to PySide2
    • child window appears properly


※ WARNING: PROJECT SKELETON CHANGED A LOT FROM V0.5!
  • V 0.5.0 [2020/08/10]

    • BIG CHANGES!
      • server changes to bottle
      • change project structure more likely to Vue.js
      • separate cli to pyvuejs-cli
  • V 0.5.1 [2020/08/10]

    • remove unsed requirement bottle-websocket
    • set server config by default if not configured
    • add default_app parameter to standalone server method
    • add show_messagebox method to webview
      • not receive result now
  • V 0.5.1 [2020/08/11]

    • remove config.py
    • change app structure
      • register app in project directory/src/main.py
    • register routing infos in project directory/src/router/init.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyvuejs, version 0.5.2
Filename, size File type Python version Upload date Hashes
Filename, size pyvuejs-0.5.2-py3-none-any.whl (104.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pyvuejs-0.5.2.tar.gz (105.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page