Skip to content

Commit

Permalink
Rename _rust module to submodule-specific name (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron authored Jul 29, 2024
1 parent eac16fe commit c0f68c4
Show file tree
Hide file tree
Showing 25 changed files with 25 additions and 24 deletions.
3 changes: 2 additions & 1 deletion DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arro3-compute/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion arro3-compute/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions arro3-compute/python/arro3/compute/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._rust import *
from ._rust import ___version
from ._compute import *
from ._compute import ___version

__version__: str = ___version()
2 changes: 1 addition & 1 deletion arro3-compute/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn ___version() -> &'static str {
}

#[pymodule]
fn _rust(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
fn _compute(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
m.add_wrapped(wrap_pyfunction!(___version))?;

m.add_wrapped(wrap_pyfunction!(cast::cast))?;
Expand Down
2 changes: 1 addition & 1 deletion arro3-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion arro3-core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion arro3-core/python/arro3/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._rust import (
from ._core import (
Array,
ArrayReader,
ChunkedArray,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion arro3-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn ___version() -> &'static str {

/// A Python module implemented in Rust.
#[pymodule]
fn _rust(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
fn _core(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
m.add_wrapped(wrap_pyfunction!(___version))?;

m.add_class::<pyo3_arrow::PyArray>()?;
Expand Down
2 changes: 1 addition & 1 deletion arro3-io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion arro3-io/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions arro3-io/python/arro3/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._rust import *
from ._rust import ___version
from ._io import *
from ._io import ___version

__version__: str = ___version()
File renamed without changes.
2 changes: 1 addition & 1 deletion arro3-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn ___version() -> &'static str {
}

#[pymodule]
fn _rust(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
fn _io(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
m.add_wrapped(wrap_pyfunction!(___version))?;

m.add_wrapped(wrap_pyfunction!(csv::infer_csv_schema))?;
Expand Down
2 changes: 1 addition & 1 deletion pyo3-arrow/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pyo3-arrow/src/array_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Box<dyn ArrayReader + Send>>);

impl PyArrayReader {
Expand Down
2 changes: 1 addition & 1 deletion pyo3-arrow/src/chunked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ArrayRef>,
field: FieldRef,
Expand Down
2 changes: 1 addition & 1 deletion pyo3-arrow/src/datatypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pyo3-arrow/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pyo3-arrow/src/record_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion pyo3-arrow/src/record_batch_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Box<dyn RecordBatchReader + Send>>);

impl PyRecordBatchReader {
Expand Down
2 changes: 1 addition & 1 deletion pyo3-arrow/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pyo3-arrow/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<RecordBatch>,
Expand Down

0 comments on commit c0f68c4

Please sign in to comment.