-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge 'Initial pass on Python API' from Jean Arhancet
This pull request introduces the initial setup for the Python bindings (#248). - Setup Configuration: Added the Python binding stack, including the `pyo3 `crates, `pyproject.toml`, `build.rs`, and other necessary files. - Database Class: Implemented the Database class with a constructor to establish a connection and a query function to execute SQL queries. - Testing: Created `database.db` with a sample users table and two entries, as outlined in README.md, and added three pytest functions to validate the Python output. Closes #276
- Loading branch information
Showing
16 changed files
with
861 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
/target | ||
/.idea | ||
/.idea | ||
|
||
*.so | ||
*.ipynb | ||
|
||
# Python | ||
.mypy_cache/ | ||
.pytest_cache/ | ||
.ruff_cache/ | ||
.venv*/ | ||
__pycache__/ | ||
.coverage | ||
venv | ||
env | ||
.env | ||
.venv | ||
|
||
# OS | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
[workspace] | ||
resolver = "2" | ||
members = [ | ||
"bindings/python", | ||
"bindings/wasm", | ||
"cli", | ||
"sqlite3", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[package] | ||
name = "py-limbo" | ||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
|
||
[lib] | ||
name = "_limbo" | ||
crate-type = ["cdylib"] | ||
|
||
[features] | ||
# must be enabled when building with `cargo build`, maturin enables this automatically | ||
extension-module = ["pyo3/extension-module"] | ||
|
||
[dependencies] | ||
anyhow = "1.0" | ||
limbo_core = { path = "../../core" } | ||
pyo3 = { version = "0.22.2", features = ["anyhow", "auto-initialize"] } | ||
|
||
[build-dependencies] | ||
version_check = "0.9.5" | ||
# used where logic has to be version/distribution specific, e.g. pypy | ||
pyo3-build-config = { version = "0.22.0" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fn main() { | ||
pyo3_build_config::use_pyo3_cfgs(); | ||
println!("cargo::rustc-check-cfg=cfg(allocator, values(\"default\", \"mimalloc\"))"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from _limbo import ( | ||
Connection, | ||
Cursor, | ||
DatabaseError, | ||
DataError, | ||
IntegrityError, | ||
InterfaceError, | ||
InternalError, | ||
NotSupportedError, | ||
OperationalError, | ||
ProgrammingError, | ||
__version__, | ||
connect, | ||
) | ||
|
||
__all__ = [ | ||
"__version__", | ||
"Connection", | ||
"Cursor", | ||
"InterfaceError", | ||
"DatabaseError", | ||
"DataError", | ||
"OperationalError", | ||
"IntegrityError", | ||
"InternalError", | ||
"ProgrammingError", | ||
"NotSupportedError", | ||
"connect", | ||
] |
Oops, something went wrong.