From 9778fe6e77ed7fe374718655214418e72983c4f0 Mon Sep 17 00:00:00 2001 From: Sung Yun <107272191+sungwy@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:34:02 -0400 Subject: [PATCH] Python: Use hatch for dependency management (#572) --- .github/workflows/bindings_python_ci.yml | 6 +++--- bindings/python/README.md | 10 +++------- bindings/python/pyproject.toml | 14 +++++++++++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/bindings_python_ci.yml b/.github/workflows/bindings_python_ci.yml index 82f13e752..1f50a8eb5 100644 --- a/.github/workflows/bindings_python_ci.yml +++ b/.github/workflows/bindings_python_ci.yml @@ -78,6 +78,6 @@ jobs: shell: bash run: | set -e - pip install dist/pyiceberg_core-*.whl --force-reinstall - pip install pytest - pytest -v + pip install hatch==1.12.0 + hatch run dev:pip install dist/pyiceberg_core-*.whl --force-reinstall + hatch run dev:test \ No newline at end of file diff --git a/bindings/python/README.md b/bindings/python/README.md index 566a7bcb8..fe4300e1f 100644 --- a/bindings/python/README.md +++ b/bindings/python/README.md @@ -24,21 +24,17 @@ This project is used to build an iceberg-rust powered core for pyiceberg. ## Setup ```shell -python -m venv venv -source ./venv/bin/activate - -pip install maturin +pip install hatch==1.12.0 ``` ## Build ```shell -maturin develop +hatch run dev:develop ``` ## Test ```shell -maturin develop -E test -pytest -v +hatch run dev:test ``` \ No newline at end of file diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 4a489adde..910cf50dc 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -31,9 +31,6 @@ classifiers = [ "Programming Language :: Python :: 3.12", ] -[project.optional-dependencies] -test = ["pytest"] - [tool.maturin] features = ["pyo3/extension-module"] python-source = "python" @@ -41,3 +38,14 @@ module-name = "pyiceberg_core.pyiceberg_core_rust" [tool.ruff.lint] ignore = ["F403", "F405"] + +[tool.hatch.envs.dev] +dependencies = [ + "maturin>=1.0,<2.0", + "pytest>=8.3.2", +] + +[tool.hatch.envs.dev.scripts] +develop = "maturin develop" +build = "maturin build --out dist --sdist" +test = "pytest"