From c0f68c462a3655aa070f08f6b93fa874a7413f9d Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Mon, 29 Jul 2024 15:41:50 -0400 Subject: [PATCH] Rename `_rust` module to submodule-specific name (#76) --- DEVELOP.md | 3 ++- arro3-compute/Cargo.toml | 2 +- arro3-compute/pyproject.toml | 2 +- arro3-compute/python/arro3/compute/__init__.py | 4 ++-- .../python/arro3/compute/{_rust.pyi => _compute.pyi} | 0 arro3-compute/src/lib.rs | 2 +- arro3-core/Cargo.toml | 2 +- arro3-core/pyproject.toml | 2 +- arro3-core/python/arro3/core/__init__.py | 2 +- arro3-core/python/arro3/core/{_rust.pyi => _core.pyi} | 0 arro3-core/src/lib.rs | 2 +- arro3-io/Cargo.toml | 2 +- arro3-io/pyproject.toml | 2 +- arro3-io/python/arro3/io/__init__.py | 4 ++-- arro3-io/python/arro3/io/{_rust.pyi => _io.pyi} | 0 arro3-io/src/lib.rs | 2 +- pyo3-arrow/src/array.rs | 2 +- pyo3-arrow/src/array_reader.rs | 2 +- pyo3-arrow/src/chunked.rs | 2 +- pyo3-arrow/src/datatypes.rs | 2 +- pyo3-arrow/src/field.rs | 2 +- pyo3-arrow/src/record_batch.rs | 2 +- pyo3-arrow/src/record_batch_reader.rs | 2 +- pyo3-arrow/src/schema.rs | 2 +- pyo3-arrow/src/table.rs | 2 +- 25 files changed, 25 insertions(+), 24 deletions(-) rename arro3-compute/python/arro3/compute/{_rust.pyi => _compute.pyi} (100%) rename arro3-core/python/arro3/core/{_rust.pyi => _core.pyi} (100%) rename arro3-io/python/arro3/io/{_rust.pyi => _io.pyi} (100%) diff --git a/DEVELOP.md b/DEVELOP.md index 14fb4f4..c681f62 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -4,8 +4,9 @@ ```bash rm -rf .venv poetry install -poetry run maturin build -m arro3-compute/Cargo.toml -o dist +# Note: need to install core first because others depend on core poetry run maturin build -m arro3-core/Cargo.toml -o dist +poetry run maturin build -m arro3-compute/Cargo.toml -o dist poetry run maturin build -m arro3-io/Cargo.toml -o dist poetry run pip install dist/* poetry run mkdocs serve diff --git a/arro3-compute/Cargo.toml b/arro3-compute/Cargo.toml index 7c7c197..97fb509 100644 --- a/arro3-compute/Cargo.toml +++ b/arro3-compute/Cargo.toml @@ -13,7 +13,7 @@ rust-version = "1.75" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -name = "_rust" +name = "_compute" crate-type = ["cdylib"] [dependencies] diff --git a/arro3-compute/pyproject.toml b/arro3-compute/pyproject.toml index 0c1c646..640a983 100644 --- a/arro3-compute/pyproject.toml +++ b/arro3-compute/pyproject.toml @@ -14,7 +14,7 @@ classifiers = [ [tool.maturin] features = ["pyo3/extension-module"] -module-name = "arro3.compute._rust" +module-name = "arro3.compute._compute" python-source = "python" [tool.poetry] diff --git a/arro3-compute/python/arro3/compute/__init__.py b/arro3-compute/python/arro3/compute/__init__.py index 69bf76d..4621194 100644 --- a/arro3-compute/python/arro3/compute/__init__.py +++ b/arro3-compute/python/arro3/compute/__init__.py @@ -1,4 +1,4 @@ -from ._rust import * -from ._rust import ___version +from ._compute import * +from ._compute import ___version __version__: str = ___version() diff --git a/arro3-compute/python/arro3/compute/_rust.pyi b/arro3-compute/python/arro3/compute/_compute.pyi similarity index 100% rename from arro3-compute/python/arro3/compute/_rust.pyi rename to arro3-compute/python/arro3/compute/_compute.pyi diff --git a/arro3-compute/src/lib.rs b/arro3-compute/src/lib.rs index 54823b4..63da22f 100644 --- a/arro3-compute/src/lib.rs +++ b/arro3-compute/src/lib.rs @@ -14,7 +14,7 @@ fn ___version() -> &'static str { } #[pymodule] -fn _rust(_py: Python, m: &Bound) -> PyResult<()> { +fn _compute(_py: Python, m: &Bound) -> PyResult<()> { m.add_wrapped(wrap_pyfunction!(___version))?; m.add_wrapped(wrap_pyfunction!(cast::cast))?; diff --git a/arro3-core/Cargo.toml b/arro3-core/Cargo.toml index 5fcc595..48d5be8 100644 --- a/arro3-core/Cargo.toml +++ b/arro3-core/Cargo.toml @@ -13,7 +13,7 @@ rust-version = "1.75" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -name = "_rust" +name = "_core" crate-type = ["cdylib"] [dependencies] diff --git a/arro3-core/pyproject.toml b/arro3-core/pyproject.toml index 4513614..8d3017c 100644 --- a/arro3-core/pyproject.toml +++ b/arro3-core/pyproject.toml @@ -14,7 +14,7 @@ classifiers = [ [tool.maturin] features = ["pyo3/extension-module"] -module-name = "arro3.core._rust" +module-name = "arro3.core._core" python-source = "python" [tool.poetry] diff --git a/arro3-core/python/arro3/core/__init__.py b/arro3-core/python/arro3/core/__init__.py index 354dda4..15f81e2 100644 --- a/arro3-core/python/arro3/core/__init__.py +++ b/arro3-core/python/arro3/core/__init__.py @@ -1,4 +1,4 @@ -from ._rust import ( +from ._core import ( Array, ArrayReader, ChunkedArray, diff --git a/arro3-core/python/arro3/core/_rust.pyi b/arro3-core/python/arro3/core/_core.pyi similarity index 100% rename from arro3-core/python/arro3/core/_rust.pyi rename to arro3-core/python/arro3/core/_core.pyi diff --git a/arro3-core/src/lib.rs b/arro3-core/src/lib.rs index 3e7c6e5..07b1330 100644 --- a/arro3-core/src/lib.rs +++ b/arro3-core/src/lib.rs @@ -11,7 +11,7 @@ fn ___version() -> &'static str { /// A Python module implemented in Rust. #[pymodule] -fn _rust(_py: Python, m: &Bound) -> PyResult<()> { +fn _core(_py: Python, m: &Bound) -> PyResult<()> { m.add_wrapped(wrap_pyfunction!(___version))?; m.add_class::()?; diff --git a/arro3-io/Cargo.toml b/arro3-io/Cargo.toml index 00f0a07..bff36f4 100644 --- a/arro3-io/Cargo.toml +++ b/arro3-io/Cargo.toml @@ -13,7 +13,7 @@ rust-version = "1.75" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -name = "_rust" +name = "_io" crate-type = ["cdylib"] [dependencies] diff --git a/arro3-io/pyproject.toml b/arro3-io/pyproject.toml index 1b9501f..38b3bf4 100644 --- a/arro3-io/pyproject.toml +++ b/arro3-io/pyproject.toml @@ -14,7 +14,7 @@ classifiers = [ [tool.maturin] features = ["pyo3/extension-module"] -module-name = "arro3.io._rust" +module-name = "arro3.io._io" python-source = "python" [tool.poetry] diff --git a/arro3-io/python/arro3/io/__init__.py b/arro3-io/python/arro3/io/__init__.py index 69bf76d..86c3c8e 100644 --- a/arro3-io/python/arro3/io/__init__.py +++ b/arro3-io/python/arro3/io/__init__.py @@ -1,4 +1,4 @@ -from ._rust import * -from ._rust import ___version +from ._io import * +from ._io import ___version __version__: str = ___version() diff --git a/arro3-io/python/arro3/io/_rust.pyi b/arro3-io/python/arro3/io/_io.pyi similarity index 100% rename from arro3-io/python/arro3/io/_rust.pyi rename to arro3-io/python/arro3/io/_io.pyi diff --git a/arro3-io/src/lib.rs b/arro3-io/src/lib.rs index 97d2a83..e1ce9d0 100644 --- a/arro3-io/src/lib.rs +++ b/arro3-io/src/lib.rs @@ -14,7 +14,7 @@ fn ___version() -> &'static str { } #[pymodule] -fn _rust(_py: Python, m: &Bound) -> PyResult<()> { +fn _io(_py: Python, m: &Bound) -> PyResult<()> { m.add_wrapped(wrap_pyfunction!(___version))?; m.add_wrapped(wrap_pyfunction!(csv::infer_csv_schema))?; diff --git a/pyo3-arrow/src/array.rs b/pyo3-arrow/src/array.rs index 581511c..d4d350a 100644 --- a/pyo3-arrow/src/array.rs +++ b/pyo3-arrow/src/array.rs @@ -19,7 +19,7 @@ use crate::PyDataType; /// A Python-facing Arrow array. /// /// This is a wrapper around an [ArrayRef] and a [FieldRef]. -#[pyclass(module = "arro3.core._rust", name = "Array", subclass)] +#[pyclass(module = "arro3.core._core", name = "Array", subclass)] pub struct PyArray { array: ArrayRef, field: FieldRef, diff --git a/pyo3-arrow/src/array_reader.rs b/pyo3-arrow/src/array_reader.rs index 8ca4f47..18b925d 100644 --- a/pyo3-arrow/src/array_reader.rs +++ b/pyo3-arrow/src/array_reader.rs @@ -17,7 +17,7 @@ use crate::{PyArray, PyChunkedArray, PyField}; /// A Python-facing Arrow array reader. /// /// This is a wrapper around a [ArrayReader]. -#[pyclass(module = "arro3.core._rust", name = "ArrayReader", subclass)] +#[pyclass(module = "arro3.core._core", name = "ArrayReader", subclass)] pub struct PyArrayReader(pub(crate) Option>); impl PyArrayReader { diff --git a/pyo3-arrow/src/chunked.rs b/pyo3-arrow/src/chunked.rs index d12b635..68f9e4e 100644 --- a/pyo3-arrow/src/chunked.rs +++ b/pyo3-arrow/src/chunked.rs @@ -21,7 +21,7 @@ use crate::{PyArray, PyDataType}; /// A Python-facing Arrow chunked array. /// /// This is a wrapper around a [FieldRef] and a `Vec` of [ArrayRef]. -#[pyclass(module = "arro3.core._rust", name = "ChunkedArray", subclass)] +#[pyclass(module = "arro3.core._core", name = "ChunkedArray", subclass)] pub struct PyChunkedArray { chunks: Vec, field: FieldRef, diff --git a/pyo3-arrow/src/datatypes.rs b/pyo3-arrow/src/datatypes.rs index dae109d..bab97b2 100644 --- a/pyo3-arrow/src/datatypes.rs +++ b/pyo3-arrow/src/datatypes.rs @@ -29,7 +29,7 @@ impl<'a> FromPyObject<'a> for PyTimeUnit { } #[derive(PartialEq, Eq, Debug)] -#[pyclass(module = "arro3.core._rust", name = "DataType", subclass)] +#[pyclass(module = "arro3.core._core", name = "DataType", subclass)] pub struct PyDataType(DataType); impl PyDataType { diff --git a/pyo3-arrow/src/field.rs b/pyo3-arrow/src/field.rs index bc5c692..6b1a60e 100644 --- a/pyo3-arrow/src/field.rs +++ b/pyo3-arrow/src/field.rs @@ -18,7 +18,7 @@ use crate::PyDataType; /// A Python-facing Arrow field. /// /// This is a wrapper around a [FieldRef]. -#[pyclass(module = "arro3.core._rust", name = "Field", subclass)] +#[pyclass(module = "arro3.core._core", name = "Field", subclass)] pub struct PyField(FieldRef); impl PyField { diff --git a/pyo3-arrow/src/record_batch.rs b/pyo3-arrow/src/record_batch.rs index e97c194..88a2dab 100644 --- a/pyo3-arrow/src/record_batch.rs +++ b/pyo3-arrow/src/record_batch.rs @@ -21,7 +21,7 @@ use crate::{PyArray, PyField, PySchema}; /// A Python-facing Arrow record batch. /// /// This is a wrapper around a [RecordBatch]. -#[pyclass(module = "arro3.core._rust", name = "RecordBatch", subclass)] +#[pyclass(module = "arro3.core._core", name = "RecordBatch", subclass)] #[derive(Debug)] pub struct PyRecordBatch(RecordBatch); diff --git a/pyo3-arrow/src/record_batch_reader.rs b/pyo3-arrow/src/record_batch_reader.rs index c2bf9c0..fb6a590 100644 --- a/pyo3-arrow/src/record_batch_reader.rs +++ b/pyo3-arrow/src/record_batch_reader.rs @@ -19,7 +19,7 @@ use crate::{PyRecordBatch, PySchema, PyTable}; /// A Python-facing Arrow record batch reader. /// /// This is a wrapper around a [RecordBatchReader]. -#[pyclass(module = "arro3.core._rust", name = "RecordBatchReader", subclass)] +#[pyclass(module = "arro3.core._core", name = "RecordBatchReader", subclass)] pub struct PyRecordBatchReader(pub(crate) Option>); impl PyRecordBatchReader { diff --git a/pyo3-arrow/src/schema.rs b/pyo3-arrow/src/schema.rs index 4b82251..a3cccd6 100644 --- a/pyo3-arrow/src/schema.rs +++ b/pyo3-arrow/src/schema.rs @@ -18,7 +18,7 @@ use crate::{PyDataType, PyField, PyTable}; /// A Python-facing Arrow schema. /// /// This is a wrapper around a [SchemaRef]. -#[pyclass(module = "arro3.core._rust", name = "Schema", subclass)] +#[pyclass(module = "arro3.core._core", name = "Schema", subclass)] pub struct PySchema(SchemaRef); impl PySchema { diff --git a/pyo3-arrow/src/table.rs b/pyo3-arrow/src/table.rs index eb63cef..55a4d69 100644 --- a/pyo3-arrow/src/table.rs +++ b/pyo3-arrow/src/table.rs @@ -23,7 +23,7 @@ use crate::{PyChunkedArray, PyField, PyRecordBatch, PyRecordBatchReader, PySchem /// A Python-facing Arrow table. /// /// This is a wrapper around a [SchemaRef] and a `Vec` of [RecordBatch]. -#[pyclass(module = "arro3.core._rust", name = "Table", subclass)] +#[pyclass(module = "arro3.core._core", name = "Table", subclass)] #[derive(Debug)] pub struct PyTable { batches: Vec,