Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python release script #533

Merged
merged 18 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
conda install -c conda-forge --yes --file python/requirements-dev.txt
conda list
cd python
cd delta-kernel-python
cd delta-kernel-rust-sharing-wrapper
maturin develop
- name: Build Server
run: ./build/sbt package
Expand Down
42 changes: 42 additions & 0 deletions dev/python_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash -e -pipe

# Switch to the project root directory
cd $( dirname $0 )
cd ..

# Clean up uncommitted files
#git clean -fdx

cd python
cd delta-kernel-rust-sharing-wrapper
rm -Rf .venv
python3 -m venv .venv
source .venv/bin/activate
pip install maturin
maturin build


cd python
python3 setup.py clean --all
rm -rf delta_sharing.egg-info dist
cd ..

printf "Please type the python release version: "
read VERSION
echo $VERSION

# Update the Python connector version
sed -i '' "s/__version__ = \".*\"/__version__ = \"$VERSION\"/g" python/delta_sharing/version.py
git add python/delta_sharing/version.py
# Use --allow-empty so that we can re-run this script even if the Python connector version has been updated
git commit -m "Update Python connector version to $VERSION" --allow-empty

# Switch to the release commit
git checkout v$VERSION

# Generate Python artifacts
cd python/
python3 setup.py sdist bdist_wheel
cd ..

echo "=== Generated all release artifacts ==="
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "delta-kernel-python"
name = "delta-kernel-rust-sharing-wrapper"
edition = "2021"
license = "Apache-2.0"
version = "0.0.0"
version = "0.0.1"

[lib]
name = "delta_kernel_python"
name = "delta_kernel_rust_sharing_wrapper"
# "cdylib" is necessary to produce a shared library for Python to import from.
crate-type = ["cdylib"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ impl PythonInterface {
}
}

/// Define the delta_kernel_python module. The name of this function _must_ be
/// `delta_kernel_python`, and _must_ the `lib.name` setting in the `Cargo.toml`, otherwise Python
/// Define the delta_kernel_rust_sharing_wrapper module. The name of this function _must_ be
/// `delta_kernel_rust_sharing_wrapper`, and _must_ the `lib.name` setting in the `Cargo.toml`, otherwise Python
/// will not be able to import the module.
#[pymodule]
fn delta_kernel_python(m: &Bound<'_, PyModule>) -> PyResult<()> {
fn delta_kernel_rust_sharing_wrapper(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<Table>()?;
m.add_class::<PythonInterface>()?;
m.add_class::<Snapshot>()?;
Expand Down
8 changes: 4 additions & 4 deletions python/delta_sharing/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from json import loads, dump
from urllib.request import getproxies

import delta_kernel_python
import delta_kernel_rust_sharing_wrapper
import fsspec
import os
import pandas as pd
Expand Down Expand Up @@ -147,10 +147,10 @@ def __to_pandas_kernel(self):
json_file.close()

# Invoke delta-kernel-rust to return the pandas dataframe
interface = delta_kernel_python.PythonInterface(table_path)
table = delta_kernel_python.Table(table_path)
interface = delta_kernel_rust_sharing_wrapper.PythonInterface(table_path)
table = delta_kernel_rust_sharing_wrapper.Table(table_path)
snapshot = table.snapshot(interface)
scan = delta_kernel_python.ScanBuilder(snapshot).build()
scan = delta_kernel_rust_sharing_wrapper.ScanBuilder(snapshot).build()
table = pa.Table.from_batches(scan.execute(interface))
result = table.to_pandas()

Expand Down
2 changes: 1 addition & 1 deletion python/delta_sharing/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.
#

__version__ = "1.1.0"
__version__ = "1.0.7"
14 changes: 7 additions & 7 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,16 @@
packages=[
'delta_sharing',
],
python_requires='>=3.7',
python_requires='>=3.8',
install_requires=[
'delta_kernel_rust_sharing_wrapper',
'pandas',
'pyarrow>=4.0.0',
'pyarrow>=16.1.0',
'fsspec>=0.7.4',
'requests',
'aiohttp',
'dataclasses;python_version<"3.7"',
'dataclasses;python_version<"3.8"',
'yarl>=1.6.0',
'maturin',
'pyarrow',
],
extras_require={
's3': ['s3fs'],
Expand All @@ -78,11 +77,12 @@
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add 3.10 and 3.11 here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
)

chdir('delta-kernel-python')
chdir('delta-kernel-rust-sharing-wrapper')
subprocess.check_call([sys.executable, "-m", "maturin", "develop"])
Loading