webviz配置的核心组件
webviz-core-components的Python项目详细描述
WebVIZ核心组件
webviz_core_components
是用于webviz
的短划线组件库。
您可以快速开始:
- 运行
pip install webviz-core-components
- 运行
python usage.py
- 访问网页浏览器中的http://localhost:8050
:warning: The components here are used by
webviz-config
. In order to facilitate a strong CSP configuration, this package has a side effect of changing the Plotly distribution coming withdash-core-components
to one that do not rely oneval()
. More specifically it changes fromplotly-full
toplotly-cartesian
bundle. This will be necessary in order to enforce a strong CSP configuration as long as thisplotly
issue and thisdash-core-components
issue both are open. Note that this side-effect only takes place ifdash-core-components
is installed, which is a requirement if theGraph
component from this repository is going to be used.
贡献
此项目由 dash-component-boilerplate。 它包含创建自定义短划线组件所需的最小代码集。
安装依赖项
如果在提示期间选择了“安装依赖项”,则可以跳过此部分。
安装NPM软件包
npm install
创建一个虚拟环境并激活。
virtualenv venv . venv/bin/activate
注意:venv\scripts\activate for windows
安装构建组件所需的python包。
pip install .[dependencies] pip install dash[dev]
安装python软件包进行测试(可选)
pip install .[tests] pip install dash[testing]
在src/lib/components/<component_name>.react.js
中编写组件代码
演示应用程序位于
src/demo
中,您将把示例组件代码导入到演示应用程序中。在python环境中测试代码:
- 构建代码
npm run build
- 运行并修改
usage.py
示例dash应用程序:python usage.py
- 构建代码
为组件编写测试。
样本测试在
tests/test_usage.py
中可用,它将加载usage.py
然后您就可以自动化与硒的交互。用
pytest tests
运行测试。dash团队广泛使用这些类型的集成测试。 浏览github上的dash组件代码以获取更多测试示例 (例如dash-core-components)。
通过将自定义css文件放入 您的分发文件夹(
webviz_subsurface_components
)。确保它们在
MANIFEST.in
中被引用,以便它们得到 准备发布组件时正确包含。确保将样式表添加到
webviz_core_components/__init__.py
所以dash将为他们服务 在请求组件套件时自动执行。
编译代码并安装
- 生成代码:
npm run build
- 安装python包:
pip install -e .