Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
joocer committed Sep 25, 2024
1 parent 4b7120c commit 0520f91
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 50 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.20.3", features = ["extension-module", "abi3-py39"] }
numpy = "0.20"
ndarray = "0.16.1"
pythonize = "0.20"
serde = "1.0.171"

Expand Down
1 change: 0 additions & 1 deletion opteryx/compiled/cross_join/cython_cross_join.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# distutils: language = c++
# cython: language_level=3
# cython: nonecheck=False
# cython: cdivision=True
Expand Down
25 changes: 22 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import platform
from typing import Any
from typing import Dict
Expand All @@ -8,6 +9,8 @@
from setuptools import find_packages
from setuptools import setup
from setuptools_rust import RustExtension
from distutils.sysconfig import get_config_var


LIBRARY = "opteryx"

Expand All @@ -18,6 +21,22 @@ def is_mac(): # pragma: no cover

COMPILE_FLAGS = ["-O2"] if is_mac() else ["-O2", "-march=native"]

# Dynamically get the default include paths
include_dirs = []

# Get the C++ include directory
includedir = get_config_var('INCLUDEDIR')
if includedir:
include_dirs.append(os.path.join(includedir, 'c++', 'v1')) # C++ headers path

# Get the Python include directory
includepy = get_config_var('INCLUDEPY')
if includepy:
include_dirs.append(includepy)

# Check if paths exist
include_dirs = [p for p in include_dirs if os.path.exists(p)]

def rust_build(setup_kwargs: Dict[str, Any]) -> None:
setup_kwargs.update(
{
Expand Down Expand Up @@ -77,16 +96,16 @@ def rust_build(setup_kwargs: Dict[str, Any]) -> None:
Extension(
name="opteryx.compiled.structures.hash_table",
sources=["opteryx/compiled/structures/hash_table.pyx"],
include_dirs=[numpy.get_include()],
include_dirs=include_dirs,
language="c++",
extra_compile_args=COMPILE_FLAGS + ["-std=c++11"],
extra_compile_args=COMPILE_FLAGS + ["-std=c++17"],
),
Extension(
name="opteryx.compiled.functions.vectors",
sources=["opteryx/compiled/functions/vectors.pyx"],
include_dirs=[numpy.get_include()],
language="c++",
extra_compile_args=COMPILE_FLAGS + ["-std=c++11"],
extra_compile_args=COMPILE_FLAGS + ["-std=c++17"],
),
Extension(
name="opteryx.compiled.structures.node",
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ use pyo3::wrap_pyfunction;
mod sqloxide;
use sqloxide::{restore_ast, parse_sql};

mod list_ops;
use list_ops::{anyop_eq_numeric, anyop_eq_string};

#[pymodule]
fn compute(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(parse_sql, m)?)?;
m.add_function(wrap_pyfunction!(restore_ast, m)?)?;

m.add_function(wrap_pyfunction!(anyop_eq_numeric, m)?)?;
m.add_function(wrap_pyfunction!(anyop_eq_string, m)?)?;
Ok(())
}
40 changes: 0 additions & 40 deletions src/list_ops.rs

This file was deleted.

0 comments on commit 0520f91

Please sign in to comment.