Skip to content

Commit

Permalink
feat(native): Support Python 3.12 (#7550)
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed Dec 18, 2023
1 parent 7a01dcd commit 618a81e
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 41 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/publish.yml
Expand Up @@ -69,7 +69,7 @@ jobs:
strategy:
matrix:
node-version: [16]
python-version: ["3.9", "3.10", "3.11", "fallback"]
python-version: ["3.9", "3.10", "3.11", "3.12", "fallback"]
target: ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]
include:
- target: x86_64-unknown-linux-gnu
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
node-version: [16.x]
os-version: ["macos-11"]
target: ["x86_64-apple-darwin", "aarch64-apple-darwin"]
python-version: ["3.9", "3.10", "3.11", "fallback"]
python-version: ["3.9", "3.10", "3.11", "3.12", "fallback"]
include:
- target: x86_64-apple-darwin
package_target_arch: x64
Expand All @@ -190,6 +190,8 @@ jobs:
python-version: "3.10"
- target: "aarch64-apple-darwin"
python-version: "3.11"
- target: "aarch64-apple-darwin"
python-version: "3.12"
fail-fast: false

steps:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/rust-cubesql.yml
Expand Up @@ -130,14 +130,16 @@ jobs:
matrix:
# Current used version + 1 LTS
node-version: [16, 18]
python-version: ["3.9", "3.10", "3.11", "fallback"]
python-version: ["3.9", "3.10", "3.11", "3.12", "fallback"]
target: ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]
# minimize number of jobs
exclude:
- node-version: 18
target: "aarch64-unknown-linux-gnu"
- python-version: 3.10
target: "aarch64-unknown-linux-gnu"
- python-version: 3.11
target: "aarch64-unknown-linux-gnu"
fail-fast: false
container:
image: cubejs/rust-cross:${{ matrix.target }}-30052023
Expand Down Expand Up @@ -238,6 +240,8 @@ jobs:
python-version: "3.10"
- target: x86_64-apple-darwin
python-version: "3.11"
- target: x86_64-apple-darwin
python-version: "3.12"
- target: x86_64-apple-darwin
python-version: "fallback"
- target: aarch64-apple-darwin
Expand Down
41 changes: 21 additions & 20 deletions packages/cubejs-backend-native/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/cubejs-backend-native/Cargo.toml
Expand Up @@ -31,8 +31,8 @@ convert_case = "0.6.0"
minijinja = { version = "1", features = ["json", "loader"] }
log-reroute = "0.1"
# python
pyo3 = { version = "0.19", features = [], optional = true }
pyo3-asyncio = { version = "0.19", features = ["tokio-runtime", "attributes"], optional = true }
pyo3 = { version = "0.20.0", features = [], optional = true }
pyo3-asyncio = { version = "0.20.0", features = ["tokio-runtime", "attributes"], optional = true }

[dependencies.neon]
version = "=0.10.1"
Expand Down
22 changes: 11 additions & 11 deletions packages/cubejs-backend-native/README.md
Expand Up @@ -21,21 +21,21 @@ If Cube cannot detect a `libpython` library or your system is not supported, it

### With python

Supported python versions: `3.11`, `3.10`, `3.9`.
Supported python versions: `3.12`, `3.11`, `3.10`, `3.9`.

| | `linux-gnu` | `linux-musl` | `darwin` | `win32` |
| -------- |:---------------:|:----------------:|:-----------:|:-------------:|
| `x86` | N/A | N/A | N/A | N/A |
| `x86_64` | | N/A | N/A | N/A |
| `arm64` | N/A | N/A | N/A | N/A |
| | `linux-gnu` | `linux-musl` | `darwin` | `win32` |
|----------|:-----------:|:------------:|:--------:|:-------:|
| `x86` | N/A | N/A | N/A | N/A |
| `x86_64` || N/A | N/A | N/A |
| `arm64` | | N/A | N/A | N/A |

### Fallback (without python)

| | `linux-gnu` | `linux-musl` | `darwin` | `win32` |
| -------- | :---------: |:-------------:|:--------:| :-----: |
| `x86` | N/A | N/A | N/A | N/A |
| `x86_64` || N/A |||
| `arm64` || N/A || |
| | `linux-gnu` | `linux-musl` | `darwin` | `win32` |
|----------|:-----------:|:------------:|:--------:|:-------:|
| `x86` | N/A | N/A | N/A | N/A |
| `x86_64` | | N/A || |
| `arm64` | | N/A || |

### License

Expand Down
1 change: 1 addition & 0 deletions packages/cubejs-backend-native/package.json
Expand Up @@ -53,6 +53,7 @@
"value": [
"libpython",
[
"3.12",
"3.11",
"3.10",
"3.9"
Expand Down
2 changes: 1 addition & 1 deletion packages/cubejs-backend-native/src/cross/clrepr_python.rs
Expand Up @@ -5,7 +5,7 @@ use pyo3::types::{
PyBool, PyComplex, PyDate, PyDict, PyFloat, PyFrame, PyFunction, PyInt, PyList, PySequence,
PySet, PyString, PyTraceback, PyTuple,
};
use pyo3::{AsPyPointer, Py, PyAny, PyErr, PyObject, Python, ToPyObject};
use pyo3::{Py, PyAny, PyErr, PyObject, Python, ToPyObject};

#[derive(Debug, Clone)]
pub enum PythonRef {
Expand Down
2 changes: 0 additions & 2 deletions packages/cubejs-backend-native/src/cross/mod.rs
Expand Up @@ -8,5 +8,3 @@ pub use clrepr::{CLRepr, CLReprKind, CLReprObject, StringType};

#[cfg(feature = "python")]
pub use clrepr_python::{CLReprPython, PythonRef};
#[cfg(feature = "python")]
pub use py_in_js::{BoxedJsPyFunctionWrapper, JsPyFunctionWrapper};
1 change: 0 additions & 1 deletion packages/cubejs-backend-native/src/python/runtime.rs
Expand Up @@ -8,7 +8,6 @@ use neon::types::Deferred;
use once_cell::sync::OnceCell;
use pyo3::prelude::*;
use pyo3::types::{PyFunction, PyTuple};
use pyo3::AsPyPointer;
use std::fmt::Formatter;
use std::future::Future;
use std::pin::Pin;
Expand Down
1 change: 0 additions & 1 deletion packages/cubejs-backend-native/src/python/utils.rs
Expand Up @@ -2,7 +2,6 @@ use crate::cross::*;
use pyo3::exceptions::PyNotImplementedError;
use pyo3::prelude::*;
use pyo3::types::{PyFunction, PyString, PyTuple};
use pyo3::AsPyPointer;

pub fn python_fn_call_sync(py_fun: &Py<PyFunction>, arguments: Vec<CLRepr>) -> PyResult<CLRepr> {
Python::with_gil(|py| {
Expand Down

0 comments on commit 618a81e

Please sign in to comment.