开发设置#

另请参阅 CONTRIBUTING.mdARCHITECTURE.md

开发环境设置为本地原生和容器化的Python编码与测试,并使用自动化的GitHub Actions进行CI + CD。服务器测试与本地测试类似,只是针对更广泛的环境测试矩阵。

LFS#

我们开始使用 git lfs 来管理数据:

# install git lfs: os-specific commands below
git lfs install
git lfs checkout

git lfs: ubuntu#

curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs

Docker#

安装#

cd docker && docker compose build && docker compose up -d

仅针对CPU测试,您可以专注于test-cpu并使用以下运行指令:

cd docker && docker compose build test-cpu

无需重建即可运行本地测试#

容器化调用 pytest 用于 CPU + GPU 模式:

cd docker

# cpu - pandas
./test-cpu-local.sh

# cpu - fast & targeted
WITH_LINT=0 WITH_TYPECHECK=0 WITH_BUILD=0 ./test-cpu-local.sh graphistry/tests/test_hyper_dask.py::TestHypergraphPandas::test_hyper_to_pa_mixed2

# gpu - pandas, cudf, dask, dask_cudf; test only one file
./test-gpu-local.sh graphistry/tests/test_hyper_dask.py

连接器测试(目前仅限neo4j):cd docker && WITH_NEO4J=1 ./test-cpu-local.sh(可选WITH_SUDO=" "

  • 将启动一个本地的neo4j(docker),然后启用并运行针对它的测试

文档#

通过ReadTheDocs从内联定义自动构建。

要手动构建,请参见 docs/

忽略文件#

您可能需要添加忽略规则:

  • flake8: bin/lint.sh

  • mypi: mypi.ini

  • sphinx: docs/source/conf.py

远程#

一些数据库如Neptune可以通过云编辑更容易操作,特别是在Jupyter中:

git clone https://github.com/graphistry/pygraphistry.git
git checkout origin/my_branch
pip install --user -e .
git diff

import logging
logging.basicConfig(level=logging.DEBUG)

import graphistry
graphistry.__version__

CI#

GitHub Actions: 请查看 .github/workflows

调试技巧#

  • 使用单元测试

  • 使用logging模块按文件

发布:合并、标记和上传#

  1. 手动更新CHANGELOG.md

  2. 使用新的版本号标记仓库。我们使用形式为X.Y.Z的语义版本号。

    git tag X.Y.Z
    git push --tags
    
  3. 确认发布 Github Action 已发布到 pypi,或为主分支手动运行它

  4. ReadTheDocs上将版本切换为活动状态

  5. 将所需的PR合并到master并切换到master头 (git checkout master && git pull)