-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (cli): initialize the CLI of GraphAr and support baseETL functio…
…ns (#616) * init cli * fix include * add ci * add vertex info * change config * finish * license * fix license * remove conda recipe * enbale ci * fix typo * fix dependency * update ci * add data * fix ci * fix cmake * add arrow in cmake * add dependency * fix review * fix ci * fix ci * fix ci * fix ci * Update cli.yml * Update cli.yml * fix config type * fix ci with new testing * use enum * use enum * pin pydantic version
- Loading branch information
Showing
21 changed files
with
2,424 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
name: GraphAr CLI CI | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'cpp/**' | ||
- 'cli/**' | ||
- '.github/workflows/ci.yml' | ||
- '.github/workflows/cli.yml' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'cpp/**' | ||
- 'cli/**' | ||
- '.github/workflows/ci.yml' | ||
- '.github/workflows/cli.yml' | ||
concurrency: | ||
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
ubuntu: | ||
name: Ubuntu 22.04 CLI | ||
runs-on: ubuntu-latest | ||
if: ${{ !contains(github.event.pull_request.title, 'WIP') && !github.event.pull_request.draft }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Install dependencies | ||
run: | | ||
# install the latest arrow deb to test arrow | ||
wget -c https://apache.jfrog.io/artifactory/arrow/"$(lsb_release --id --short | tr 'A-Z' 'a-z')"/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb \ | ||
-P /tmp/ | ||
sudo apt-get install -y /tmp/apache-arrow-apt-source-latest-"$(lsb_release --codename --short)".deb | ||
sudo apt-get update -y | ||
sudo apt install -y libarrow-dev \ | ||
libarrow-dataset-dev \ | ||
libarrow-acero-dev \ | ||
libparquet-dev | ||
sudo apt-get install -y ccache libcurl4-openssl-dev | ||
- name: Install GraphAr CLI and Run Tests | ||
working-directory: "cli" | ||
run: | | ||
pip install ./ -v | ||
graphar --help | ||
graphar check -p ../testing/neo4j/MovieGraph.graph.yml | ||
graphar show -p ../testing/neo4j/MovieGraph.graph.yml -v Person | ||
graphar show -p ../testing/neo4j/MovieGraph.graph.yml -es Person -e ACTED_IN -ed Movie | ||
graphar import -c ../testing/neo4j/data/import.mini.yml | ||
# TODO: Add unit tests | ||
|
||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v4.0.1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
macos: | ||
name: ${{ matrix.architecture }} macOS ${{ matrix.macos-version }} CLI | ||
runs-on: macos-${{ matrix.macos-version }} | ||
# TODO: Remove this when the macos issue is fixed | ||
if: false | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- architecture: AMD64 | ||
macos-version: "12" | ||
- architecture: ARM64 | ||
macos-version: "14" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Install dependencies | ||
run: | | ||
brew bundle --file=cpp/Brewfile | ||
- name: Build GraphAr And Run Tests | ||
working-directory: "cli" | ||
run: | | ||
pip install ./ | ||
graphar --help | ||
graphar check -p ../testing/neo4j/MovieGraph.graph.yml | ||
graphar show -p ../testing/neo4j/MovieGraph.graph.yml -v Person | ||
graphar show -p ../testing/neo4j/MovieGraph.graph.yml -es Person -e ACTED_IN -ed Movie | ||
graphar import -c ../testing/neo4j/data/import.mini.yml | ||
# TODO: Add unit tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
BasedOnStyle: Google | ||
DerivePointerAlignment: false | ||
PointerAlignment: Left | ||
Cpp11BracedListStyle: true | ||
IndentCaseLabels: false | ||
AllowShortBlocksOnASingleLine: true | ||
AllowShortLoopsOnASingleLine: false | ||
AllowShortIfStatementsOnASingleLine: false | ||
Standard: 'Cpp11' | ||
SpaceAfterCStyleCast: true | ||
AlignAfterOpenBracket: Align | ||
SortIncludes: true | ||
IncludeBlocks: Preserve | ||
ForEachMacros: | ||
- BOOST_FOREACH | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
# Using https://github.com/github/gitignore/blob/master/Python.gitignore | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
docs/_generate/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
_skbuild/ | ||
.pyodide-xbuildenv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# Require CMake 3.15+ (matching scikit-build-core) Use new versions of all | ||
# policies up to CMake 3.27 | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
# Scikit-build-core sets these values for you, or you can just hard-code the | ||
# name and version. | ||
project( | ||
${SKBUILD_PROJECT_NAME} | ||
VERSION ${SKBUILD_PROJECT_VERSION} | ||
LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../cpp ${CMAKE_BINARY_DIR}/graphar) | ||
|
||
# Find the module development requirements (requires FindPython from 3.17 or | ||
# scikit-build-core's built-in backport) | ||
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) | ||
find_package(pybind11 CONFIG REQUIRED) | ||
find_package(Arrow REQUIRED) | ||
find_package(ArrowDataset REQUIRED) | ||
find_package(ArrowAcero REQUIRED) | ||
find_package(Parquet REQUIRED) | ||
|
||
# Add a library using FindPython's tooling (pybind11 also provides a helper like | ||
# this) | ||
python_add_library(_core MODULE src/main.cc WITH_SOABI) | ||
|
||
target_link_libraries(_core PRIVATE pybind11::headers graphar Arrow::arrow_shared | ||
Parquet::parquet_shared | ||
ArrowDataset::arrow_dataset_shared | ||
ArrowAcero::arrow_acero_shared | ||
) | ||
target_include_directories(_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) | ||
target_include_directories(_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../cpp/src) | ||
target_include_directories(_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../cpp/thirdparty) | ||
|
||
# This is passing in the version as a define just as an example | ||
target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION}) | ||
|
||
# The install directory is the output (wheel) directory | ||
set_target_properties(_core PROPERTIES INSTALL_RPATH "$ORIGIN") | ||
install(TARGETS graphar DESTINATION graphar_cli) | ||
install(TARGETS _core DESTINATION graphar_cli) |
Oops, something went wrong.