From 363492dae82c2f9b5e314bb72177d608c8cc45fb Mon Sep 17 00:00:00 2001 From: Daniel Mesejo Date: Thu, 22 Aug 2024 10:42:34 +0200 Subject: [PATCH] fix: issues with release to pypi (#228) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. The builds in `ubuntu` failed with the error: > The system library `openssl` required by crate `openssl-sys` was not found. 2. The builds for both `windows` and `macos` passed, but the workflows failed with the error: > Failed request: (409) Conflict: an artifact with this name already exists on the workflow run **Why?** The error for `ubuntu` was due to the library `hf-hub,` specified as a Rust dependency, but that was not being used. The errors in the builds of `windows` and `macos` were due to breaking changes in version v4 of the GitHub action upload artifact—more details are in [here](https://github.com/actions/upload-artifact/issues/478). **Solution** The library was removed, and the steps were modified; both changes are included in this PR. **How can we prevent this from happening in the future?** To prevent such failures in the future in the middle of the actual release, a pre-release workflow was created (and included in this PR). The idea is that this pre-release will try to upload to TestPyPI, and in case of any failures, we will modify both `.yaml` files (`ci-publish.yaml` and `ci-pre-release.yaml`) **Additionally** Refactor out ibis.datafusion/postgres/to_sql/pandas --- .github/workflows/ci-pre-release.yml | 121 ++++++ .github/workflows/ci-publish.yml | 12 +- Cargo.lock | 405 +----------------- Cargo.toml | 1 - README.md | 7 + python/letsql/backends/datafusion/__init__.py | 2 +- .../letsql/backends/let/tests/test_cache.py | 10 +- .../letsql/backends/let/tests/test_execute.py | 2 +- python/letsql/backends/postgres/hotfix.py | 3 +- python/letsql/backends/snowflake/hotfix.py | 3 +- .../common/utils/tests/test_dask_normalize.py | 6 +- python/letsql/expr/api.py | 4 +- 12 files changed, 163 insertions(+), 413 deletions(-) create mode 100644 .github/workflows/ci-pre-release.yml diff --git a/.github/workflows/ci-pre-release.yml b/.github/workflows/ci-pre-release.yml new file mode 100644 index 00000000..caf25584 --- /dev/null +++ b/.github/workflows/ci-pre-release.yml @@ -0,0 +1,121 @@ +# This file is autogenerated by maturin v1.2.3 +# To update, run +# +# maturin generate-ci github +# +name: ci-pre-release + +on: + workflow_dispatch: + +# we do not want more than one release workflow executing at the same time, ever +concurrency: + group: release + # cancelling in the middle of a release would create incomplete releases + # so cancel-in-progress is false + cancel-in-progress: false + +permissions: + contents: read + +jobs: + linux: + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheel-ubuntu-${{ matrix.target }} + path: dist + + windows: + runs-on: windows-latest + strategy: + matrix: + target: [x64, x86] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + architecture: ${{ matrix.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheel-windows-${{ matrix.target }} + path: dist + + macos: + runs-on: macos-latest + strategy: + matrix: + target: [x86_64, aarch64] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheel-macos-${{ matrix.target }} + path: dist + + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: wheels + path: dist + + release: + name: Release + runs-on: ubuntu-latest + needs: [linux, windows, macos, sdist] + steps: + - uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + - name: Publish to TestPyPI + uses: PyO3/maturin-action@v1 + env: + MATURIN_PYPI_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} + MATURIN_REPOSITORY: "testpypi" + with: + command: upload + args: --non-interactive --skip-existing ./dist/* diff --git a/.github/workflows/ci-publish.yml b/.github/workflows/ci-publish.yml index e436ea1a..a3f54fd2 100644 --- a/.github/workflows/ci-publish.yml +++ b/.github/workflows/ci-publish.yml @@ -6,6 +6,7 @@ name: ci-publish on: + workflow_dispatch: release: types: [ published ] @@ -40,7 +41,7 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels + name: wheel-ubuntu-${{ matrix.target }} path: dist windows: @@ -63,7 +64,7 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels + name: wheel-windows-${{ matrix.target }} path: dist macos: @@ -85,7 +86,7 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels + name: wheel-macos-${{ matrix.target }} path: dist sdist: @@ -110,11 +111,12 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - name: wheels + path: dist + merge-multiple: true - name: Publish to PyPI uses: PyO3/maturin-action@v1 env: MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} with: command: upload - args: --non-interactive --skip-existing * + args: --non-interactive --skip-existing ./dist/* diff --git a/Cargo.lock b/Cargo.lock index f336acc8..9af14959 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -765,7 +765,7 @@ dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -807,19 +807,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "console" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "unicode-width", - "windows-sys 0.52.0", -] - [[package]] name = "const-random" version = "0.1.18" @@ -846,16 +833,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -1332,27 +1309,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - [[package]] name = "displaydoc" version = "0.2.5" @@ -1386,12 +1342,6 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - [[package]] name = "enum-as-inner" version = "0.6.0" @@ -1511,21 +1461,6 @@ dependencies = [ "spin", ] -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1849,23 +1784,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hf-hub" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b780635574b3d92f036890d8373433d6f9fc7abb320ee42a5c25897fc8ed732" -dependencies = [ - "dirs", - "indicatif", - "log", - "native-tls", - "rand", - "serde", - "serde_json", - "thiserror", - "ureq", -] - [[package]] name = "humantime" version = "2.1.0" @@ -1972,19 +1890,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "indicatif" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" -dependencies = [ - "console", - "instant", - "number_prefix", - "portable-atomic", - "unicode-width", -] - [[package]] name = "indoc" version = "2.0.5" @@ -2100,7 +2005,6 @@ dependencies = [ "datafusion-sql", "futures", "gbdt", - "hf-hub", "image", "imageproc", "itertools 0.13.0", @@ -2221,16 +2125,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.6.0", - "libc", -] - [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -2367,23 +2261,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "native-tls" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -2523,12 +2400,6 @@ dependencies = [ "syn 2.0.74", ] -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - [[package]] name = "object" version = "0.36.3" @@ -2565,56 +2436,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "openssl" -version = "0.10.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.74", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "ordered-float" version = "2.10.1" @@ -2653,7 +2474,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -3135,17 +2956,6 @@ dependencies = [ "bitflags 2.6.0", ] -[[package]] -name = "redox_users" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - [[package]] name = "regex" version = "1.10.6" @@ -3190,21 +3000,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "ring" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" -dependencies = [ - "cc", - "cfg-if", - "getrandom", - "libc", - "spin", - "untrusted", - "windows-sys 0.52.0", -] - [[package]] name = "rle-decode-fast" version = "1.0.3" @@ -3239,38 +3034,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.23.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" -dependencies = [ - "log", - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-pki-types" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" - -[[package]] -name = "rustls-webpki" -version = "0.102.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - [[package]] name = "rustversion" version = "1.0.17" @@ -3311,44 +3074,12 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "schannel" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags 2.6.0", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "1.0.23" @@ -3944,31 +3675,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "ureq" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72139d247e5f97a3eff96229a7ae85ead5328a39efe76f8bf5a06313d505b6ea" -dependencies = [ - "base64", - "flate2", - "log", - "native-tls", - "once_cell", - "rustls", - "rustls-pki-types", - "serde", - "serde_json", - "url", - "webpki-roots", -] - [[package]] name = "url" version = "2.5.2" @@ -4001,12 +3707,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version-compare" version = "0.2.0" @@ -4100,15 +3800,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki-roots" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "weezl" version = "0.1.8" @@ -4140,16 +3831,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", + "windows-targets", ] [[package]] @@ -4158,7 +3840,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -4167,22 +3849,7 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets", ] [[package]] @@ -4191,46 +3858,28 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -4243,48 +3892,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -4384,12 +4009,6 @@ dependencies = [ "synstructure 0.13.1", ] -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" - [[package]] name = "zip" version = "1.1.4" diff --git a/Cargo.toml b/Cargo.toml index f5451630..70d9e135 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,6 @@ arrow_convert = "0.6.8" itertools = "0.13.0" candle-core = "0.6.0" image = "0.25.2" -hf-hub = "0.3.2" candle-nn = "0.6.0" candle-transformers = "0.6.0" imageproc = "0.25.0" diff --git a/README.md b/README.md index 3ea254c5..5ff49209 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,13 @@ res = ( ) ``` +for more examples on how to use letsql, check the [examples](https://github.com/letsql/letsql/tree/main/examples) directory, +note that in order to run some of the scripts in there, you need to install the library with `examples` extra: + +```shell +pip install 'letsql[extras]' +``` + ## Contributing Contributions are welcome and highly appreciated. To get started, check out the [contributing guidelines](https://github.com/letsql/letsql/blob/main/CONTRIBUTING.md). diff --git a/python/letsql/backends/datafusion/__init__.py b/python/letsql/backends/datafusion/__init__.py index 99f095c8..d430006d 100644 --- a/python/letsql/backends/datafusion/__init__.py +++ b/python/letsql/backends/datafusion/__init__.py @@ -764,7 +764,7 @@ def create_table( if obj is not None: if not isinstance(obj, ir.Expr): - table = ibis.memtable(obj) + table = letsql.memtable(obj) else: table = obj diff --git a/python/letsql/backends/let/tests/test_cache.py b/python/letsql/backends/let/tests/test_cache.py index 8c7ee727..ed8cadb9 100644 --- a/python/letsql/backends/let/tests/test_cache.py +++ b/python/letsql/backends/let/tests/test_cache.py @@ -153,7 +153,7 @@ def test_cache_to_sql(alltypes): ) cached = expr.cache() - assert ibis.to_sql(cached) == ibis.to_sql(expr) + assert letsql.to_sql(cached) == letsql.to_sql(expr) def test_op_after_cache(alltypes): @@ -180,7 +180,7 @@ def test_op_after_cache(alltypes): assert_frame_equal(actual, expected) - assert ibis.to_sql(cached) == ibis.to_sql(full_expr) + assert letsql.to_sql(cached) == letsql.to_sql(full_expr) def setup_backend(table, table_name): @@ -605,7 +605,7 @@ def test_register_with_different_name_and_cache(con, csv_dir, get_expr): batting_path = csv_dir.joinpath("batting.csv") table_name = "batting" - datafusion_con = ibis.datafusion.connect() + datafusion_con = letsql.datafusion.connect() letsql_table_name = f"{datafusion_con.name}_{table_name}" t = datafusion_con.register( batting_path, table_name=table_name, schema_infer_max_records=50_000 @@ -668,7 +668,7 @@ def test_pandas_snapshot(ls_con, alltypes_df): name = ibis.util.gen_name("tmp_table") # create a temp table we can mutate - pd_con = ibis.pandas.connect() + pd_con = letsql.pandas.connect() table = pd_con.create_table(name, alltypes_df) t = ls_con.register(table, f"let_{table.op().name}") cached_expr = ( @@ -743,7 +743,7 @@ def test_datafusion_snapshot(ls_con, alltypes_df): name = ibis.util.gen_name("tmp_table") # create a temp table we can mutate - df_con = ibis.datafusion.connect() + df_con = letsql.datafusion.connect() table = df_con.create_table(name, alltypes_df) t = ls_con.register(table, f"let_{table.op().name}") cached_expr = ( diff --git a/python/letsql/backends/let/tests/test_execute.py b/python/letsql/backends/let/tests/test_execute.py index cd06998e..0b1d840b 100644 --- a/python/letsql/backends/let/tests/test_execute.py +++ b/python/letsql/backends/let/tests/test_execute.py @@ -335,7 +335,7 @@ def test_sql_execution(con, duckdb_con, awards_players, batting): right = ddb_players[ddb_players.lgID == "NL"].drop("yearID", "lgID") expr = left.join(right, predicate, how="inner") - query = ibis.to_sql(expr, dialect="datafusion") + query = letsql.to_sql(expr) result = ( con.sql(query) diff --git a/python/letsql/backends/postgres/hotfix.py b/python/letsql/backends/postgres/hotfix.py index 9c771151..f91ef3fa 100644 --- a/python/letsql/backends/postgres/hotfix.py +++ b/python/letsql/backends/postgres/hotfix.py @@ -3,6 +3,7 @@ import sqlglot.expressions as sge import toolz +import letsql from letsql.common.utils.hotfix_utils import ( maybe_hotfix, none_tokenized, @@ -55,5 +56,5 @@ def clone(self, password=None, **kwargs): }, **kwargs, } - con = ibis.postgres.connect(**dct) + con = letsql.postgres.connect(**dct) return con diff --git a/python/letsql/backends/snowflake/hotfix.py b/python/letsql/backends/snowflake/hotfix.py index cd19d95f..9cfb8027 100644 --- a/python/letsql/backends/snowflake/hotfix.py +++ b/python/letsql/backends/snowflake/hotfix.py @@ -14,6 +14,7 @@ Namespace, ) +import letsql from letsql.common.utils.hotfix_utils import ( maybe_hotfix, ) @@ -169,7 +170,7 @@ def create_table( if obj is not None: if not isinstance(obj, ir.Expr): - table = ibis.memtable(obj) + table = letsql.memtable(obj) else: table = obj diff --git a/python/letsql/common/utils/tests/test_dask_normalize.py b/python/letsql/common/utils/tests/test_dask_normalize.py index 9575eb7a..8eabd9d6 100644 --- a/python/letsql/common/utils/tests/test_dask_normalize.py +++ b/python/letsql/common/utils/tests/test_dask_normalize.py @@ -29,7 +29,7 @@ class Unregistered: def test_tokenize_datafusion_memory_expr(alltypes_df, snapshot): - con = ibis.datafusion.connect() + con = letsql.datafusion.connect() typ = type(con) t = con.register(alltypes_df, "t") with patch_normalize_token(type(con)) as mocks: @@ -41,7 +41,7 @@ def test_tokenize_datafusion_memory_expr(alltypes_df, snapshot): def test_tokenize_datafusion_parquet_expr(alltypes_df, tmp_path, snapshot): path = pathlib.Path(tmp_path).joinpath("data.parquet") alltypes_df.to_parquet(path) - con = ibis.datafusion.connect() + con = letsql.datafusion.connect() t = con.register(path, "t") # work around tmp_path variation (prefix, suffix) = ( @@ -61,7 +61,7 @@ def test_tokenize_datafusion_parquet_expr(alltypes_df, tmp_path, snapshot): def test_tokenize_pandas_expr(alltypes_df, snapshot): - con = ibis.pandas.connect() + con = letsql.pandas.connect() typ = type(con) t = con.create_table("t", alltypes_df) with patch_normalize_token(type(t.op().source)) as mocks: diff --git a/python/letsql/expr/api.py b/python/letsql/expr/api.py index 05e7e2b0..08ed3ac1 100644 --- a/python/letsql/expr/api.py +++ b/python/letsql/expr/api.py @@ -1469,8 +1469,8 @@ def time(value_or_hour, minute=None, second=None, /): Create a time column from hour, minute, and second - >>> t = ibis.memtable({"h": [1, 4], "m": [2, 5], "s": [3, 6]}) - >>> ibis.time(t.h, t.m, t.s).name("time") + >>> t = letsql.memtable({"h": [1, 4], "m": [2, 5], "s": [3, 6]}) + >>> letsql.time(t.h, t.m, t.s).name("time") ┏━━━━━━━━━━┓ ┃ time ┃ ┡━━━━━━━━━━┩