SolveBio Dash组件套件
solvebio-dash-components的Python项目详细描述
SolveBio仪表板组件
此软件包提供了用于SolveBio特定仪表板组件的React组件套件
开发
设置
# Install JavaScript dependencies $ npm install # Create Python 2 virtual environment and install Python dependencies $ pipenv --two install --dev # Enter virtual environment $ pipenv shell
将以下行添加到Dash应用程序中
app.scripts.config.serve_locally = True
成分
要在本地安装solvebio dash组件,只需将repo克隆到 仪表板应用程序
$ git clone https://github.com/solvebio/solvebio-dash-components.git
然后cd
进入目录并遵循上述设置过程。
此外,在Dash应用程序中添加以下行
sys.path.insert(0, 'solvebio-dash-components')
import solvebio_dash_components as sdc
仪表板3上载程序
dashs3uploader组件的工作示例可以使用以下命令启动:
$ python usage.py $ open http://local.solvebio.com:8050
dashs3uploader需要注意的一点是,当在本地运行时,它必须在local.solvebio.com
上运行。
为了正常的功能。这是因为CORS配置是在服务器端设置的
以便仅允许s3从上述地址上传。
代码质量和测试
运行lint和单元测试:
$ npm test
运行单元测试并监视更改:
$ npm run test-watch
运行特定测试
在测试中,将.only
附加到describe
或it
语句:
describe.only('Foo component',()=>{// ...});
在Dash中测试组件
将开发包构建到
lib/
,并监视更改# Once this is started, you can just leave it running. $ npm start
在本地安装模块(每次更改后)
# Generate metadata, and build the JavaScript bundle $ npm run install-local # Now you're done. For subsequent changes, if you've got `npm start` # running in a separate process, it's enough to just do: $ python setup.py install
运行包含组件的短划线文件
$ python usage.py
在本地安装python包
在发布到pypi之前,可以在本地测试安装模块:
# Install in `site-packages` on your machine
$ npm run install-local
在本地卸载python包
$ npm run uninstall-local
发布
目前,必须采取单独的步骤将此项目发布到npm和pypi 基于dash-components-archetype。目前正在进行简化工作 发布进入一个工作流here。
向NPM发布
# Prepublish $ npm run prepublish # Bump the package version $ vim package.json # Create new tag $ git tag -a vx.x.x -m "tag message" # Push branch and tags to repo $ git push origin --tags # Publish to NPM $ npm publish
发布到pypi
# Bump the PyPi package to the same version $ vim solvebio_dash_components/version.py # Commit to github $ git add solvebio_dash_components/version.py $ git commit -m "Bump pypi package version to vx.x.x" # Create new dist $ python setup.py sdist # Publish to PyPi using $ twine upload dist/solvebio_dash_components-<new_version>.tar.gz
生成器/原型
我们使用Builder集中管理构建配置、依赖项和 剧本。
要查看所有可用的builder
脚本:
$ builder help
有关详细信息,请参见dash-components-archetype回购协议。