<p align="center">
<img src="https://github.com/eseunghwan/pyvuejs/blob/master/logo.png?raw=true" width=250 />
<br>
<a href="https://pypi.python.org/pypi/pyvuejs">
<img src="https://img.shields.io/pypi/v/pyvuejs.svg" /></a>
<a href="https://travis-ci.org/eseunghwan/pyvuejs"><img src="https://travis-ci.org/eseunghwan/pyvuejs.svg?branch=master" /></a>
</p>
<br><br>
# RE:Newal!
- changed project style more silimar to vuejs 2.x template
- use vue file by <b>vbuild</b>
<br><br>
# Install
### using pip
```powershell
pip install pyvuejs
```
<br><br>
# Usage
### start server by <b>main.py</b> file in project directory
```powershell
python ./main.py
```
<br><br>
# serve configurations
config update by Vue.use in <b>main.py</b>
- parameters
- host[str]: host url of server(default: "0.0.0.0")
- port[int]: port number of server(default: 47372)
- debug[bool]: flag of show bottle log(default: True)
- open_webbrowser[bool]: flag of open browser when start(default: True)
```python
Vue.use(
VueConfig(
host = "0.0.0.0",
port = 47372,
debug = True,
open_webbrowser = True
)
)
```
<br><br>
# view/component editing guide
### same as vue.js, can support by linting
- for now, <b>template</b>, <b>style</b>, <b>script</b> blocks are supported
- more information on [vbuild](https://github.com/manatlan/vbuild) and [vbuild python document](https://github.com/manatlan/vbuild/blob/master/doc/PyComponent.md)
```html
<!-- template block -->
<template>
<div>
<label>{{ count }}</label>
<div>
<button style="margin-right:10px;" v-on:click="up_count">up</button>
<button v-on:click="down_count">down</button>
</div>
</div>
</template>
<!-- style block -->
<style scoped>
button {
width: 80px;
}
</style>
<!-- script block -->
<script lang="python">
class Component:
def __init__(self):
self.count = 0
def up_count(self):
self.count += 1
def down_count(self):
if self.count > 0:
self.count -= 1
</script>
```
<br><br>
# use view/component
just call name in other view
```html
<template>
<div id="app">
<div id="nav">
<router-link to="/Home">Home</router-link> |
<router-link to="/About">About</router-link> |
<router-link to="/Counter">Counter</router-link>
</div>
<router-view/>
</div>
</template>
```
<br><br>
# events mapping
define map class and map functions in each file of <b>maps</b>
- if <b>debug</b> option in config, functions can be reached by "GET" and "POST". else, "POST" only
```python
from pyvuejs import VueMap
class Counter(VueMap):
count = 0
@VueMap.map
def get_count(self):
return self.count
@VueMap.map
def up_count(self):
self.count += 1
@VueMap.map
def down_count(self):
if self.count > 0:
self.count -= 1
```
<br><br>
# routes
define route <b>path</b> and <b>component</b> in <b>router.py</b>
```python
from pyvuejs import Vue, VueRouter
Vue.use(VueRouter([
{
"path": "/About",
"component": "About"
},
{
"path": "/Home",
"component": "Home"
},
{
"path": "/Counter",
"component": "Counter"
}
]))
```
<br><br>
# Todo
- [x] <b>routes</b>
<br><br>
# License
pyvuejs is MIT license
<br>
Raw data
{
"_id": null,
"home_page": "https://github.com/eseunghwan/pyvuejs",
"name": "pyvuejs",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "vue",
"author": "eseunghwan",
"author_email": "shlee0920@naver.com",
"download_url": "https://files.pythonhosted.org/packages/01/4f/e83b11933c70f011ae733e9ceb0493ee2702601b3100ed361cafdbb26ab8/pyvuejs-2.0.5.post3.tar.gz",
"platform": "",
"description": "<p align=\"center\">\n<img src=\"https://github.com/eseunghwan/pyvuejs/blob/master/logo.png?raw=true\" width=250 />\n<br>\n<a href=\"https://pypi.python.org/pypi/pyvuejs\">\n<img src=\"https://img.shields.io/pypi/v/pyvuejs.svg\" /></a>\n<a href=\"https://travis-ci.org/eseunghwan/pyvuejs\"><img src=\"https://travis-ci.org/eseunghwan/pyvuejs.svg?branch=master\" /></a>\n</p>\n<br><br>\n\n# RE:Newal!\n- changed project style more silimar to vuejs 2.x template\n- use vue file by <b>vbuild</b>\n<br><br>\n\n# Install\n### using pip\n```powershell\npip install pyvuejs\n```\n<br><br>\n\n# Usage\n### start server by <b>main.py</b> file in project directory\n```powershell\npython ./main.py\n```\n<br><br>\n\n# serve configurations\nconfig update by Vue.use in <b>main.py</b>\n- parameters\n - host[str]: host url of server(default: \"0.0.0.0\")\n - port[int]: port number of server(default: 47372)\n - debug[bool]: flag of show bottle log(default: True)\n - open_webbrowser[bool]: flag of open browser when start(default: True)\n```python\nVue.use(\n VueConfig(\n host = \"0.0.0.0\",\n port = 47372,\n debug = True,\n open_webbrowser = True\n )\n)\n```\n<br><br>\n\n# view/component editing guide\n### same as vue.js, can support by linting\n- for now, <b>template</b>, <b>style</b>, <b>script</b> blocks are supported\n- more information on [vbuild](https://github.com/manatlan/vbuild) and [vbuild python document](https://github.com/manatlan/vbuild/blob/master/doc/PyComponent.md)\n```html\n<!-- template block -->\n<template>\n <div>\n <label>{{ count }}</label>\n <div>\n <button style=\"margin-right:10px;\" v-on:click=\"up_count\">up</button>\n <button v-on:click=\"down_count\">down</button>\n </div>\n </div>\n</template>\n<!-- style block -->\n<style scoped>\nbutton {\n width: 80px;\n}\n</style>\n<!-- script block -->\n<script lang=\"python\">\nclass Component:\n def __init__(self):\n self.count = 0\n\n def up_count(self):\n self.count += 1\n\n def down_count(self):\n if self.count > 0:\n self.count -= 1\n</script>\n```\n<br><br>\n\n# use view/component\njust call name in other view\n```html\n<template>\n <div id=\"app\">\n <div id=\"nav\">\n <router-link to=\"/Home\">Home</router-link> |\n <router-link to=\"/About\">About</router-link> |\n <router-link to=\"/Counter\">Counter</router-link>\n </div>\n <router-view/>\n </div>\n</template>\n```\n<br><br>\n\n# events mapping\ndefine map class and map functions in each file of <b>maps</b>\n- if <b>debug</b> option in config, functions can be reached by \"GET\" and \"POST\". else, \"POST\" only\n```python\nfrom pyvuejs import VueMap\n\nclass Counter(VueMap):\n count = 0\n\n @VueMap.map\n def get_count(self):\n return self.count\n\n @VueMap.map\n def up_count(self):\n self.count += 1\n\n @VueMap.map\n def down_count(self):\n if self.count > 0:\n self.count -= 1\n```\n<br><br>\n\n# routes\ndefine route <b>path</b> and <b>component</b> in <b>router.py</b>\n```python\nfrom pyvuejs import Vue, VueRouter\n\nVue.use(VueRouter([\n {\n \"path\": \"/About\",\n \"component\": \"About\"\n },\n {\n \"path\": \"/Home\",\n \"component\": \"Home\"\n },\n {\n \"path\": \"/Counter\",\n \"component\": \"Counter\"\n }\n]))\n```\n<br><br>\n\n# Todo\n- [x] <b>routes</b>\n\n<br><br>\n\n# License\npyvuejs is MIT license\n\n<br>\n\n\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Pythonic Vue.js",
"version": "2.0.5.post3",
"split_keywords": [
"vue"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "250bc50023cea3b88069b7ad115602d9",
"sha256": "6d60cfd59c5cead696a4eb741253cf263607cf6c6d5c5edbd09533741832b37d"
},
"downloads": -1,
"filename": "pyvuejs-2.0.5.post3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "250bc50023cea3b88069b7ad115602d9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 79171,
"upload_time": "2021-02-16T07:35:52",
"upload_time_iso_8601": "2021-02-16T07:35:52.747121Z",
"url": "https://files.pythonhosted.org/packages/25/f0/aaea0a61c236f6c5b9072be0c2522663031a7801e84e43d936ab0add84be/pyvuejs-2.0.5.post3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "5292d2771569ea4f3a789eafd9fdd568",
"sha256": "70b325f145addd5e3fb9bcaae6dd1e5718ea14112e5b364b5e8aab4d8cef1806"
},
"downloads": -1,
"filename": "pyvuejs-2.0.5.post3.tar.gz",
"has_sig": false,
"md5_digest": "5292d2771569ea4f3a789eafd9fdd568",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 77721,
"upload_time": "2021-02-16T07:35:54",
"upload_time_iso_8601": "2021-02-16T07:35:54.349872Z",
"url": "https://files.pythonhosted.org/packages/01/4f/e83b11933c70f011ae733e9ceb0493ee2702601b3100ed361cafdbb26ab8/pyvuejs-2.0.5.post3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-02-16 07:35:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": null,
"github_project": "eseunghwan",
"error": "Could not fetch GitHub repository",
"lcname": "pyvuejs"
}