diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a68a1bd2..1036425c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,6 +159,8 @@ jobs: run: make python-docs-build go-sdk: + # The fork consumes only the Rust crate and Python package. + if: github.repository == 'tobilg/polyglot' needs: rust-test runs-on: ubuntu-latest env: @@ -188,6 +190,8 @@ jobs: run: cd packages/go && POLYGLOT_SQL_FFI_PATH="../../target/ffi_release/libpolyglot_sql_ffi.so" go test ./... sdk-build: + # The fork consumes only the Rust crate and Python package. + if: github.repository == 'tobilg/polyglot' needs: rust-test runs-on: ubuntu-latest env: diff --git a/.github/workflows/python-fork-release.yml b/.github/workflows/python-fork-release.yml index bedab979..697a855d 100644 --- a/.github/workflows/python-fork-release.yml +++ b/.github/workflows/python-fork-release.yml @@ -3,6 +3,13 @@ name: Python fork release on: push: tags: ['python-v*'] + # Build and smoke-test every wheel without publishing. + workflow_dispatch: + pull_request: + paths: + - '.github/workflows/python-fork-release.yml' + - 'crates/polyglot-sql-python/Cargo.toml' + - 'crates/polyglot-sql-python/pyproject.toml' permissions: contents: read @@ -30,19 +37,23 @@ jobs: steps: - uses: actions/checkout@v7 + - uses: actions/setup-python@v6 + with: + python-version: '3.12' + - name: Build wheel uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} manylinux: '2014' - args: --profile python_release --out dist --find-interpreter --manifest-path crates/polyglot-sql-python/Cargo.toml + args: --profile python_release --out dist --features abi3 --manifest-path crates/polyglot-sql-python/Cargo.toml sccache: true - name: Smoke test wheel if: matrix.target == 'x86_64' run: | - version="${GITHUB_REF_NAME#python-v}" - python -m pip install --no-index --find-links dist "polyglot-sql-chio==${version}" + ls dist/*-abi3-*.whl + python -m pip install --no-index --find-links dist polyglot-sql-chio python -c "import polyglot_sql; assert polyglot_sql.parse_one('SELECT 1', dialect='postgres')" - name: Upload wheel @@ -65,17 +76,21 @@ jobs: steps: - uses: actions/checkout@v7 + - uses: actions/setup-python@v6 + with: + python-version: '3.12' + - name: Build wheel uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --profile python_release --out dist --find-interpreter --manifest-path crates/polyglot-sql-python/Cargo.toml + args: --profile python_release --out dist --features abi3 --manifest-path crates/polyglot-sql-python/Cargo.toml sccache: true - name: Smoke test wheel run: | - version="${GITHUB_REF_NAME#python-v}" - python -m pip install --no-index --find-links dist "polyglot-sql-chio==${version}" + ls dist/*-abi3-*.whl + python -m pip install --no-index --find-links dist polyglot-sql-chio python -c "import polyglot_sql; assert polyglot_sql.parse_one('SELECT 1', dialect='postgres')" - name: Upload wheel @@ -90,20 +105,23 @@ jobs: steps: - uses: actions/checkout@v7 + - uses: actions/setup-python@v6 + with: + python-version: '3.12' + - name: Build wheel uses: PyO3/maturin-action@v1 env: SCCACHE_IGNORE_SERVER_IO_ERROR: '1' with: target: x86_64-pc-windows-msvc - args: --profile python_release --out dist --find-interpreter --manifest-path crates/polyglot-sql-python/Cargo.toml + args: --profile python_release --out dist --features abi3 --manifest-path crates/polyglot-sql-python/Cargo.toml sccache: true - name: Smoke test wheel shell: pwsh run: | - $version = $env:GITHUB_REF_NAME.Substring('python-v'.Length) - python -m pip install --no-index --find-links dist "polyglot-sql-chio==$version" + python -m pip install --no-index --find-links dist polyglot-sql-chio python -c "import polyglot_sql; assert polyglot_sql.parse_one('SELECT 1', dialect='postgres')" - name: Upload wheel @@ -131,6 +149,7 @@ jobs: path: dist publish: + if: github.event_name == 'push' needs: [wheels-linux, wheels-macos, wheels-windows, sdist] runs-on: ubuntu-latest permissions: diff --git a/crates/polyglot-sql-python/Cargo.toml b/crates/polyglot-sql-python/Cargo.toml index 90896ab1..23ab0f3d 100644 --- a/crates/polyglot-sql-python/Cargo.toml +++ b/crates/polyglot-sql-python/Cargo.toml @@ -18,6 +18,7 @@ default = [] function-catalog-clickhouse = ["polyglot-sql/function-catalog-clickhouse"] function-catalog-duckdb = ["polyglot-sql/function-catalog-duckdb"] function-catalog-all-dialects = ["polyglot-sql/function-catalog-all-dialects"] +abi3 = ["pyo3/abi3-py312"] [dependencies] polyglot-sql = { path = "../polyglot-sql" } diff --git a/crates/polyglot-sql-python/pyproject.toml b/crates/polyglot-sql-python/pyproject.toml index 89337398..25828f0f 100644 --- a/crates/polyglot-sql-python/pyproject.toml +++ b/crates/polyglot-sql-python/pyproject.toml @@ -8,7 +8,7 @@ dynamic = ["version"] description = "Rust-powered SQL transpiler for more than 30 SQL dialects. Parse, generate, transpile, format, and validate SQL." readme = "README.md" license = { text = "MIT" } -requires-python = ">=3.9" +requires-python = ">=3.12" keywords = ["sql", "transpiler", "parser", "dialect", "database"] classifiers = [ "Development Status :: 4 - Beta", @@ -17,9 +17,6 @@ classifiers = [ "Programming Language :: Rust", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Topic :: Database",