一个独立的、轻量级的 web 服务器,用于在 ipython 中创建、共享图形。让 ipython 做它关注的事情,让它做每个人都需要做的事情,以构建交互式、协作和实时的流式仪表板。
项目描述
*灵感来自`IPython <http://ipython.org/>`__,用爱构建*
IPython-仪表板
一个独立的、轻量级的 Web 服务器,用于构建、共享在 IPython 中创建的图形。为数据科学、数据分析人员构建。旨在构建交互式可视化、协作仪表板和实时流图。
用法
安装先决条件
安装最新稳定的 IPython-Dashboard: pip install ipython-dashboard --upgrade
安装 redis 2.6+:安装指南
[选项,如果你需要运行 sql]安装 mysql: brew install mysql或apt-get install mysql
安装 IPython-Dashboard 要求 [有时不需要]:
cd ~/你的 python 包路径/IPython-Dashboard
pip install -r requirements.txt
[``option``, if you need run sql]Config mysql
启动mysql服务器:mysql.server start
使用root登录mysql:mysql -u root
创建用户并授予权限;
查看当前数据库用户
mysql> SELECT User,Host FROM mysql.user; +------+-----------+ | User | Host | +------+-----------+ | root | 127.0.0.1 | | root | ::1 | | | localhost | | root | localhost | | | mac007 | | root | mac007 | +------+-----------+ 6 rows in set (0.00 sec)
为 IPython-Dashboard 创建用户
mysql> create user 'ipd'@'localhost' identified by 'thanks'; Query OK, 0 rows affected (0.00 sec) mysql> grant all privileges on *.* to ipd@localhost; Query OK, 0 rows affected (0.00 sec) mysql> SELECT User,Host FROM mysql.user; +------+-----------+ | User | Host | +------+-----------+ | root | 127.0.0.1 | | root | ::1 | | | localhost | | ipd | localhost | | root | localhost | | | mac007 | | root | mac007 | +------+-----------+ 7 rows in set (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
创建表格;
nosetests -s dashboard.tests.testCreateData:test_create_mysql_data
创建日志记录路径
创建一个文件夹来存储日志文件。我目前把它放在mnt下 :/mnt/ipython-dashboard/logs
确保日志文件夹是可写的,使用chmod和 ls -l来确认。
chenshan@mac007:/mnt/ipython-dashboard$ls -l total 0 drwxrwxrwx 9 root wheel 306 Dec 15 22:09 logs
配置 IPython-Dashboard 服务器:``IPython-Dashboard/dashboard/config.py``
app_host='ip_address:port'
启动redis和IPython-Dashboard server
chenshan@mac007:~/Desktop/github/IPython-Dashboard$redis-server & chenshan@mac007:~/Desktop/github/IPython-Dashboard$dash-server --help usage: dash-server [-h] [-H HOST] [-p PORT] [-d DEBUG] Start your IPython-Dashboard server ... optional arguments: -h, --help show this help message and exit -H HOST, --host HOST server host, default localhost -p PORT, --port PORT server port, default 9090 -d DEBUG, --debug DEBUG server port, default true chenshan@mac007:~/Desktop/github/IPython-Dashboard$dash-server Namespace(debug=True, host='0.0.0.0', port=9090) * Running on http://0.0.0.0:9090/ * Restarting with reloader Namespace(debug=True, host='0.0.0.0', port=9090)做你的探索
*IPython-Dashboard-Tutorial.ipynb*:在 nbviewer 或github 上
目标
支持原始html可视化
支持python对象可视化
可编辑
渲染变量python对象时实时刷新
可以共享,公共和私人[需要密码]
在笔记本中,可以将对象共享到仪表板 [在该仪表板中可视化该对象]
用例
在笔记本中探索,分享/发送结果/总结给人们,没有细节。
在私人笔记本中共享一些数据。
使用 matplotlib/seaborn/mpld3 等绘制优美/静态图形时,对复杂的代码感到失望。
想要一个交互式图表,允许人们放大/缩小,调整大小,获得悬停提示,轻松更改图表类型。
想要一个实时图表。
想要一个协作的图表/仪表板。
明智的选择
</figcaption> </figure>截图和演示
<图>截屏
</figcaption> </figure> <figure>截屏
</figcaption> </figure> <figure>截屏
</figcaption> </figure> <figure>截屏
</figcaption> </figure>运行测试
只需在这个 repo 下运行sudo nosetests --with-coverage --cover-package=dashboard
taotao@mac007:~/Desktop/github/IPython-Dashboard$sudo nosetests --with-coverage --cover-package=dashboard
Password:
../Users/chenshan/Desktop/github/IPython-Dashboard/dashboard/tests/testCreateData.py:69: Warning: Can't create database 'IPD_data'; database exists
conn.cursor().execute('CREATE DATABASE IF NOT EXISTS {};'.format(config.sql_db))
/Users/chenshan/Desktop/github/IPython-Dashboard/dashboard/server/utils.py:135: Warning: Unknown table 'ipd_data.businesses'
cursor.execute(sql)
/Library/Python/2.7/site-packages/pandas/io/sql.py:599: FutureWarning: The 'mysql' flavor with DBAPI connection is deprecated and will be removed in future versions. MySQL will be further supported with SQLAlchemy engines.
warnings.warn(_MYSQL_WARNING, FutureWarning)
...
Name Stmts Miss Cover Missing
---------------------------------------------------------------------
dashboard.py 13 0 100%
dashboard/client.py 1 0 100%
dashboard/client/sender.py 11 3 73% 26-27, 33
dashboard/conf.py 0 0 100%
dashboard/conf/config.py 29 0 100%
dashboard/server.py 0 0 100%
dashboard/server/resources.py 0 0 100%
dashboard/server/resources/dash.py 35 10 71% 36, 55-56, 67-69, 86-89
dashboard/server/resources/home.py 40 12 70% 25, 28-30, 83-91
dashboard/server/resources/sql.py 27 11 59% 30, 52-75
dashboard/server/resources/status.py 8 1 88% 19
dashboard/server/resources/storage.py 13 5 62% 26-28, 43-47
dashboard/server/utils.py 79 18 77% 20-24, 78-80, 82-83, 86, 96, 99-100, 126-127, 140-142
dashboard/server/views.py 21 1 95% 16
---------------------------------------------------------------------
TOTAL 277 61 78%
----------------------------------------------------------------------
Ran 5 tests in 9.885s
OK
taotao@mac007:~/Desktop/github/IPython-Dashboard$
更改日志
未来
正面,databricks 风格
pep 8,代码清理和重组
悬停提示
编辑模式可以调整大小
分享一张图
共享一个仪表板
演示模式
页脚
统一消息展示中心
SQL 编辑器
登录管理
统一的记录器和异常报告
服务器端日志
客户端日志
支持python3
创建示例
在仪表板中呈现 sql
图表优化
*V 0.1.6:优化图表 [当前开发版本]*
仪表板
重构代码,遵循 pep8 风格
创建 1 个示例
优化图表
SQL 编辑器
优化页面
将 sql 结果呈现为图形
*V 0.1.5 : sql-server-log [当前稳定版本]*
仪表板
创建 1 个示例
服务器端日志
支持 x 轴作为日期格式
实时更新数据框的研究
SQL 编辑器
sql server develop : 将 sql 结果呈现为表视图