From 8f2ffa8cd62f4a6374edc14589b833072bf268cb Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Wed, 15 Mar 2023 18:33:26 +0800 Subject: [PATCH] chore: manage deps with maturin (#1611) * chore: manage deps with maturin Signed-off-by: Chojan Shang * chore(ci): try to make the workflow work Signed-off-by: Chojan Shang * ci: build with pip and maturin Signed-off-by: Chojan Shang --------- Signed-off-by: Chojan Shang --- .github/workflows/bindings_python.yml | 13 ++++--------- bindings/python/README.md | 16 ++++++++-------- bindings/python/pyproject.toml | 3 +++ bindings/python/test_requirements.txt | 2 -- 4 files changed, 15 insertions(+), 19 deletions(-) delete mode 100644 bindings/python/test_requirements.txt diff --git a/.github/workflows/bindings_python.yml b/.github/workflows/bindings_python.yml index 82510c873523..610cea3aa64f 100644 --- a/.github/workflows/bindings_python.yml +++ b/.github/workflows/bindings_python.yml @@ -47,18 +47,13 @@ jobs: with: python-version: '3.11' - uses: Swatinem/rust-cache@v2 - - uses: PyO3/maturin-action@v1 - with: - manylinux: off - working-directory: "bindings/python" - command: build - args: --release --sdist -o dist + - name: Build with maturin + working-directory: "bindings/python" + run: | + python -m pip install -e .[test] - name: Run pytest working-directory: "bindings/python" run: | - set -e - python -m pip install dist/opendal-*.whl - python -m pip install -r test_requirements.txt python -m pytest linux: diff --git a/bindings/python/README.md b/bindings/python/README.md index 5222651e5198..473668e4439e 100644 --- a/bindings/python/README.md +++ b/bindings/python/README.md @@ -34,16 +34,10 @@ asyncio.run(main()) ## Development -Install `maturin`: - -```shell -pip install maturin -``` - Setup virtualenv: ```shell -virtualenv venv +python -m venv venv ``` Activate venv: @@ -52,6 +46,12 @@ Activate venv: source venv/bin/activate ```` +Install `maturin`: + +```shell +pip install maturin[patchelf] +``` + Build bindings: ```shell @@ -61,6 +61,6 @@ maturin develop Running some tests: ```shell -pip install -r test_requirements.txt +maturin develop -E test pytest ``` diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index f955deeba406..dbf3b6b68372 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -31,6 +31,9 @@ name = "opendal" readme = "README.md" requires-python = ">=3.7" +[project.optional-dependencies] +test = ["pytest", "pytest-asyncio"] + [project.urls] Documentation = "https://docs.rs/opendal/" Homepage = "https://opendal.databend.rs/" diff --git a/bindings/python/test_requirements.txt b/bindings/python/test_requirements.txt deleted file mode 100644 index ee4ba018603b..000000000000 --- a/bindings/python/test_requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -pytest -pytest-asyncio