-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python API typing, lint, config/makefile (#3023)
* Python API typing, lint, config/makefile * Fix pyproject.toml for wheel building * Add linter check on CI --------- Co-authored-by: Chang Liu <liuc223@gmail.com>
- Loading branch information
1 parent
8f5f64a
commit 3bdc752
Showing
38 changed files
with
2,869 additions
and
1,892 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
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
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
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,42 @@ | ||
.DEFAULT_GOAL := help | ||
|
||
PYTHONPATH= | ||
SHELL=/bin/bash | ||
VENV=.venv | ||
|
||
ifeq ($(OS),Windows_NT) | ||
VENV_BIN=$(VENV)/Scripts | ||
else | ||
VENV_BIN=$(VENV)/bin | ||
endif | ||
|
||
.venv: ## Set up a Python virtual environment and install dev packages | ||
python3 -m venv $(VENV) | ||
$(MAKE) requirements | ||
|
||
.PHONY: requirements | ||
requirements: .venv ## Install/update Python dev packages | ||
@unset CONDA_PREFIX \ | ||
&& $(VENV_BIN)/python -m pip install -U uv \ | ||
&& $(VENV_BIN)/uv pip install --upgrade -r requirements_dev.txt \ | ||
|
||
.PHONY: lint | ||
lint: ## Apply autoformatting and linting rules | ||
$(VENV_BIN)/ruff check src_py test | ||
$(VENV_BIN)/ruff format src_py test | ||
-$(VENV_BIN)/mypy src_py test | ||
|
||
.PHONY: build | ||
build: ## Compile kuzu (and install in 'build') for Python | ||
$(MAKE) -C ../../ python | ||
cp src_py/*.py build/kuzu/ | ||
|
||
.PHONY: test | ||
test: ## Run the Python unit tests | ||
cp src_py/*.py build/kuzu/ && cd build | ||
$(VENV_BIN)/pytest test | ||
|
||
.PHONY: help | ||
help: ## Display this help information | ||
@echo -e "\033[1mAvailable commands:\033[0m" | ||
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort |
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,97 @@ | ||
[project] | ||
name = "kuzu" | ||
description = "Highly scalable, extremely fast, easy-to-use embeddable graph database" | ||
readme = "README.md" | ||
license = { file = "LICENSE" } | ||
keywords = ["graph", "database"] | ||
version = "0.0.1" | ||
|
||
[project.urls] | ||
Homepage = "https://kuzudb.com/" | ||
Documentation = "https://docs.kuzudb.com/" | ||
Repository = "https://github.com/kuzudb/kuzu" | ||
Changelog = "https://github.com/kuzudb/kuzu/releases" | ||
|
||
[tool.mypy] | ||
files = ["src_py", "test"] | ||
strict = true | ||
enable_error_code = [ | ||
"redundant-expr", | ||
"truthy-bool", | ||
"ignore-without-code", | ||
] | ||
disable_error_code = [ | ||
"import-not-found", | ||
"no-any-return", | ||
] | ||
|
||
[[tool.mypy.overrides]] | ||
module = [ | ||
"_kuzu.*", | ||
"networkx.*", | ||
"pandas.*", | ||
"pyarrow.*", | ||
"pytz.*", | ||
"torch_geometric.*", | ||
] | ||
ignore_missing_imports = true | ||
|
||
[tool.ruff] | ||
line-length = 119 | ||
preview = true | ||
fix = true | ||
|
||
[tool.ruff.lint] | ||
select = [ | ||
"E", # pycodestyle | ||
"W", # pycodestyle | ||
"F", # Pyflakes | ||
"B", # flake8-bugbear | ||
"C4", # flake8-comprehensions | ||
"D", # flake8-docstrings | ||
"D213", # Augment NumPy docstring convention: Multi-line docstring summary should start at the second line | ||
"D417", # Augment NumPy docstring convention: Missing argument descriptions | ||
"I", # isort | ||
"SIM", # flake8-simplify | ||
"TCH", # flake8-type-checking | ||
"TID", # flake8-tidy-imports | ||
"UP", # pyupgrade | ||
"PT", # flake8-pytest-style | ||
"RUF", # Ruff-specific rules | ||
"PTH", # flake8-use-pathlib | ||
"FA", # flake8-future-annotations | ||
"PIE", # flake8-pie | ||
"TD", # flake8-todos | ||
"TRY", # tryceratops | ||
"EM", # flake8-errmsg | ||
"FBT001", # flake8-boolean-trap | ||
] | ||
ignore = [ | ||
"D401", # First line should be in imperative mood | ||
"D105", # Missing docstring in magic method | ||
"D100", # Missing docstring in public module | ||
"D104", # Missing docstring in public package | ||
"D205", # 1 blank line required between summary line and description | ||
"TD002", # Missing author in TODO | ||
"TD003", # Missing issue link on the line following TODO | ||
] | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
"test/**/*.py" = ["D100", "D102", "D103", "E501", "F841", "TCH002"] | ||
"src_py/torch_geo*.py" = ["E501", "FBT001"] | ||
|
||
[tool.ruff.lint.pycodestyle] | ||
max-doc-length = 119 | ||
|
||
[tool.ruff.lint.pydocstyle] | ||
convention = "numpy" | ||
|
||
[tool.ruff.lint.flake8-type-checking] | ||
strict = true | ||
|
||
[tool.ruff.format] | ||
docstring-code-format = true | ||
|
||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" |
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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
pybind11>=2.6.0 | ||
pytest | ||
# required for tests | ||
networkx~=3.0 | ||
numpy | ||
pandas | ||
polars | ||
networkx~=3.0.0 | ||
numpy | ||
pyarrow==14.0.1 | ||
pyarrow>=14 | ||
pybind11>=2.6.0 | ||
pytest | ||
torch | ||
torch-geometric~=2.3.0 | ||
setuptools~=69.0 | ||
|
||
# required for lint/formatting | ||
ruff==0.3.2 | ||
mypy==1.9.0 | ||
uv==0.1.17 |
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
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
Oops, something went wrong.