使用ibis表达式计算vega转换
ibis-vega-transform的Python项目详细描述
ibis-vega变换
使用ibis表达式对vega转换进行python求值。
有关灵感,请参见https://github.com/jakevdp/altair-transform
开始
pip install ibis-vega-transform jupyter labextension install ibis-vega-transform
然后在笔记本中,导入python包并传入一个ibis表达式 牵牛星图:
importaltairasaltimportibis_vega_transformimportibisimportpandasaspdsource=pd.DataFrame({'a':['A','B','C','D','E','F','G','H','I'],'b':[28,55,43,91,81,53,19,87,52]})connection=ibis.pandas.connect({'source':source})table=connection.table('source')alt.Chart(table).mark_bar().encode(x='a',y='b')
查看[./examples/
](./examples/]目录中的笔记本
使用交互式图表和Omnisci后端的一些选项。
开发
要从源安装,请在终端中运行以下命令:
git clone git@github.com:Quansight/ibis-vega-transform.git cd ibis-vega-transform conda env create -f binder/environment.yml conda activate ibis-vega-transform pip install -e .[dev] jlpm jupyter labextension install . --no-build jupyter lab --watch jlpm run build:watch
格式化所有文件:
black ibis_vega_transform jlpm run prettier
释放
首先创建一个测试环境:
conda create -n tmp -c conda-forge nodejs conda activate tmp
然后在setup.py
中弹出python版本并上载测试版本:
pip install --upgrade setuptools wheel twine rm -rf dist/ python setup.py sdist bdist_wheel twine upload --repository-url https://test.pypi.org/legacy/ dist/*
在新环境中安装测试版本:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple ibis-vega-transform
现在在package.json
中增加javascript包的版本。运行生成,
创建一个tarball,并将其作为jupyterlab扩展安装:
yarn run build yarn pack --filename out.tgz jupyter labextension install out.tgz
现在打开jupyterlab并运行examples
中的所有笔记本,以确保
它们仍然正确渲染。
现在您可以发布python包:
twine upload dist/*
并发布节点包:
npm publish out.tgz
并为发行版添加git标记并按下:
git tag <new version> git push git push --tags