# python-revue

> Python framework for building ML & data science web apps.

Latest version **0.2.0** (published 2021-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install python-revue
pnpm add python-revue
yarn add python-revue
bun add python-revue
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-04-23 |
| First published | 2021-04-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 33.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | r-eng |
| Maintainers | bbtfr |

## Links

- npm: https://www.npmjs.com/package/python-revue
- Repository: git@git-core.megvii-inc.com:reng/revue
- npm.io page: https://npm.io/package/python-revue

## Recent versions

- 0.2.0 (latest) — 2021-04-23

## README

revue - Python Vue Binding
===

revue 期望提供一个前端 Vue 后端 Flask，快速开发标注工具 / 可视化页面的最佳实践，它可以帮助你

1. 生成一个静态页面托管在 oss 上
2. 生成一个标注工具，把比较重的任务放在后端计算


Usage
---

- [使用 router 的例子](examples/router)
- [使用自定义 vue 插件的例子](examples/plugin)
- [一个简单的带进度条的标注工具](examples/taskqueue)

### 启动服务

```
cd examples/boilerplate
python3 app.py
```

### 开发前必读

1. vue 组件默认放在 python 文件同级的 `components` 目录下，可以通过 `Vue` 类的 `component_folder` 参数控制
    1. revue 使用前端编译，一般情况下开发时无需安装 npm 环境
    2. 编写好的前端组件可以通过命令行工具 `revue build` / `revue publish PACKAGE VERSION` 预先编译好，并传到 oss 上，加快页面加载速度，但编译时需要安装 npm + webpack 环境
2. revue 提供生成静态页面托管在 pages 服务上，和自己启动 web 服务两种模式
    1. 静态页面的数据可以通过 `app.data` 传入，参考：[模板项目](examples/boilerplate)
    2. 启动服务时可以使用 `@app.method` 定义供前端使用的回调函数，参考：[模板项目](examples/boilerplate)
        * `@app.method` 定义的回调函数仅对启动服务生效，静态页面会忽略这些回调
    3. 可以通过 `@app.data` 定义懒加载的数据，参考：[模板项目](examples/boilerplate)
3. 通过 `app.use` 可以使用用户自定义的 Vue 组件，传入的参数可以是字符串，或一个生成字符串的函数
    * 字符串是一些 html 标签，这些标签会被放在 index.html 的头部（head 标签里），但通过传入 `prepend=True` 可以使它拼在文件末尾
    * 例如：`app.use('<script src="https://unpkg.com/viser-vue/umd/viser-vue.min.js"></script>', prepend=True)`

---
_Source: https://npm.io/package/python-revue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
