From 0c82b3fefa844783f5296bbeafb714b187c63ebb Mon Sep 17 00:00:00 2001 From: Michael J Ward Date: Tue, 14 May 2024 13:31:56 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20update=20to=20maturin's=20recommended?= =?UTF-8?q?=20project=20layout=20for=20rust/python=E2=80=A6=20(#695)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update to maturin's recommended project layout for rust/python projects The previous layout leads to an import error when installing with `maturin build` and `pip install .`. This error was common enough that `maturin` changed the recommended project layout to what this commit does. A prior PR attempted to solve this by altering `lib.name` in Cargo.toml, but that did not work for me. - [Prior PR](https://github.com/apache/datafusion-python/pull/694) - [maturin ImportError issue](https://github.com/PyO3/maturin/issues/490) - [maturin changes recommended project structure](https://github.com/PyO3/maturin/pull/855) * ci: update `ruff check` for nested python directory --- .github/workflows/build.yml | 2 +- pyproject.toml | 1 + {datafusion => python/datafusion}/__init__.py | 0 {datafusion => python/datafusion}/common.py | 0 {datafusion => python/datafusion}/expr.py | 0 {datafusion => python/datafusion}/functions.py | 0 {datafusion => python/datafusion}/input/__init__.py | 0 {datafusion => python/datafusion}/input/base.py | 0 {datafusion => python/datafusion}/input/location.py | 0 {datafusion => python/datafusion}/object_store.py | 0 {datafusion => python/datafusion}/substrait.py | 0 {datafusion => python/datafusion}/tests/__init__.py | 0 {datafusion => python/datafusion}/tests/conftest.py | 0 .../datafusion}/tests/data_test_context/data.json | 0 {datafusion => python/datafusion}/tests/generic.py | 0 {datafusion => python/datafusion}/tests/test_aggregation.py | 0 {datafusion => python/datafusion}/tests/test_catalog.py | 0 {datafusion => python/datafusion}/tests/test_config.py | 0 {datafusion => python/datafusion}/tests/test_context.py | 0 {datafusion => python/datafusion}/tests/test_dataframe.py | 0 {datafusion => python/datafusion}/tests/test_expr.py | 0 {datafusion => python/datafusion}/tests/test_functions.py | 0 {datafusion => python/datafusion}/tests/test_imports.py | 0 {datafusion => python/datafusion}/tests/test_indexing.py | 0 {datafusion => python/datafusion}/tests/test_input.py | 0 {datafusion => python/datafusion}/tests/test_sql.py | 0 {datafusion => python/datafusion}/tests/test_store.py | 0 {datafusion => python/datafusion}/tests/test_substrait.py | 0 {datafusion => python/datafusion}/tests/test_udaf.py | 0 29 files changed, 2 insertions(+), 1 deletion(-) rename {datafusion => python/datafusion}/__init__.py (100%) rename {datafusion => python/datafusion}/common.py (100%) rename {datafusion => python/datafusion}/expr.py (100%) rename {datafusion => python/datafusion}/functions.py (100%) rename {datafusion => python/datafusion}/input/__init__.py (100%) rename {datafusion => python/datafusion}/input/base.py (100%) rename {datafusion => python/datafusion}/input/location.py (100%) rename {datafusion => python/datafusion}/object_store.py (100%) rename {datafusion => python/datafusion}/substrait.py (100%) rename {datafusion => python/datafusion}/tests/__init__.py (100%) rename {datafusion => python/datafusion}/tests/conftest.py (100%) rename {datafusion => python/datafusion}/tests/data_test_context/data.json (100%) rename {datafusion => python/datafusion}/tests/generic.py (100%) rename {datafusion => python/datafusion}/tests/test_aggregation.py (100%) rename {datafusion => python/datafusion}/tests/test_catalog.py (100%) rename {datafusion => python/datafusion}/tests/test_config.py (100%) rename {datafusion => python/datafusion}/tests/test_context.py (100%) rename {datafusion => python/datafusion}/tests/test_dataframe.py (100%) rename {datafusion => python/datafusion}/tests/test_expr.py (100%) rename {datafusion => python/datafusion}/tests/test_functions.py (100%) rename {datafusion => python/datafusion}/tests/test_imports.py (100%) rename {datafusion => python/datafusion}/tests/test_indexing.py (100%) rename {datafusion => python/datafusion}/tests/test_input.py (100%) rename {datafusion => python/datafusion}/tests/test_sql.py (100%) rename {datafusion => python/datafusion}/tests/test_store.py (100%) rename {datafusion => python/datafusion}/tests/test_substrait.py (100%) rename {datafusion => python/datafusion}/tests/test_udaf.py (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e03c2cbd..239b1718 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: pip install ruff # Update output format to enable automatic inline annotations. - name: Run Ruff - run: ruff check --output-format=github datafusion + run: ruff check --output-format=github python/ generate-license: runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index d3536051..24bd2961 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,6 +55,7 @@ repository = "https://github.com/apache/arrow-datafusion-python" profile = "black" [tool.maturin] +python-source = "python" module-name = "datafusion._internal" include = [ { path = "Cargo.lock", format = "sdist" } diff --git a/datafusion/__init__.py b/python/datafusion/__init__.py similarity index 100% rename from datafusion/__init__.py rename to python/datafusion/__init__.py diff --git a/datafusion/common.py b/python/datafusion/common.py similarity index 100% rename from datafusion/common.py rename to python/datafusion/common.py diff --git a/datafusion/expr.py b/python/datafusion/expr.py similarity index 100% rename from datafusion/expr.py rename to python/datafusion/expr.py diff --git a/datafusion/functions.py b/python/datafusion/functions.py similarity index 100% rename from datafusion/functions.py rename to python/datafusion/functions.py diff --git a/datafusion/input/__init__.py b/python/datafusion/input/__init__.py similarity index 100% rename from datafusion/input/__init__.py rename to python/datafusion/input/__init__.py diff --git a/datafusion/input/base.py b/python/datafusion/input/base.py similarity index 100% rename from datafusion/input/base.py rename to python/datafusion/input/base.py diff --git a/datafusion/input/location.py b/python/datafusion/input/location.py similarity index 100% rename from datafusion/input/location.py rename to python/datafusion/input/location.py diff --git a/datafusion/object_store.py b/python/datafusion/object_store.py similarity index 100% rename from datafusion/object_store.py rename to python/datafusion/object_store.py diff --git a/datafusion/substrait.py b/python/datafusion/substrait.py similarity index 100% rename from datafusion/substrait.py rename to python/datafusion/substrait.py diff --git a/datafusion/tests/__init__.py b/python/datafusion/tests/__init__.py similarity index 100% rename from datafusion/tests/__init__.py rename to python/datafusion/tests/__init__.py diff --git a/datafusion/tests/conftest.py b/python/datafusion/tests/conftest.py similarity index 100% rename from datafusion/tests/conftest.py rename to python/datafusion/tests/conftest.py diff --git a/datafusion/tests/data_test_context/data.json b/python/datafusion/tests/data_test_context/data.json similarity index 100% rename from datafusion/tests/data_test_context/data.json rename to python/datafusion/tests/data_test_context/data.json diff --git a/datafusion/tests/generic.py b/python/datafusion/tests/generic.py similarity index 100% rename from datafusion/tests/generic.py rename to python/datafusion/tests/generic.py diff --git a/datafusion/tests/test_aggregation.py b/python/datafusion/tests/test_aggregation.py similarity index 100% rename from datafusion/tests/test_aggregation.py rename to python/datafusion/tests/test_aggregation.py diff --git a/datafusion/tests/test_catalog.py b/python/datafusion/tests/test_catalog.py similarity index 100% rename from datafusion/tests/test_catalog.py rename to python/datafusion/tests/test_catalog.py diff --git a/datafusion/tests/test_config.py b/python/datafusion/tests/test_config.py similarity index 100% rename from datafusion/tests/test_config.py rename to python/datafusion/tests/test_config.py diff --git a/datafusion/tests/test_context.py b/python/datafusion/tests/test_context.py similarity index 100% rename from datafusion/tests/test_context.py rename to python/datafusion/tests/test_context.py diff --git a/datafusion/tests/test_dataframe.py b/python/datafusion/tests/test_dataframe.py similarity index 100% rename from datafusion/tests/test_dataframe.py rename to python/datafusion/tests/test_dataframe.py diff --git a/datafusion/tests/test_expr.py b/python/datafusion/tests/test_expr.py similarity index 100% rename from datafusion/tests/test_expr.py rename to python/datafusion/tests/test_expr.py diff --git a/datafusion/tests/test_functions.py b/python/datafusion/tests/test_functions.py similarity index 100% rename from datafusion/tests/test_functions.py rename to python/datafusion/tests/test_functions.py diff --git a/datafusion/tests/test_imports.py b/python/datafusion/tests/test_imports.py similarity index 100% rename from datafusion/tests/test_imports.py rename to python/datafusion/tests/test_imports.py diff --git a/datafusion/tests/test_indexing.py b/python/datafusion/tests/test_indexing.py similarity index 100% rename from datafusion/tests/test_indexing.py rename to python/datafusion/tests/test_indexing.py diff --git a/datafusion/tests/test_input.py b/python/datafusion/tests/test_input.py similarity index 100% rename from datafusion/tests/test_input.py rename to python/datafusion/tests/test_input.py diff --git a/datafusion/tests/test_sql.py b/python/datafusion/tests/test_sql.py similarity index 100% rename from datafusion/tests/test_sql.py rename to python/datafusion/tests/test_sql.py diff --git a/datafusion/tests/test_store.py b/python/datafusion/tests/test_store.py similarity index 100% rename from datafusion/tests/test_store.py rename to python/datafusion/tests/test_store.py diff --git a/datafusion/tests/test_substrait.py b/python/datafusion/tests/test_substrait.py similarity index 100% rename from datafusion/tests/test_substrait.py rename to python/datafusion/tests/test_substrait.py diff --git a/datafusion/tests/test_udaf.py b/python/datafusion/tests/test_udaf.py similarity index 100% rename from datafusion/tests/test_udaf.py rename to python/datafusion/tests/test_udaf.py