Repository: ibis-project/ibis-bigquery (language: python)

Issue:
enable usage of BigQuery backend through `ibis`
I think the first usage example in the [readme](https://github.com/ibis-project/ibis-bigquery#connecting-to-bigquery) (using BigQuery backend through `import ibis`) doesn't work quite yet (I think this would require entrypoints being set up in this repo)


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 6392b34..b57275a 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -46,6 +46,10 @@ jobs:
   unit-tests:
     name: Unit Tests
     runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        python_version: ["3.7", "3.8", "3.9"]
     steps:
 
     - name: checkout
@@ -57,10 +61,10 @@ jobs:
         repository: ibis-project/ibis
         path: ibis
 
-    - name: setup python
+    - name: set up python ${{ matrix.python-version }}
       uses: actions/setup-python@v2
       with:
-        python-version: "3.7"
+        python-version: ${{ matrix.python-version }}
 
     - name: install dependencies
       run: ./ci/install_deps.sh
diff --git a/ci/install_deps.sh b/ci/install_deps.sh
index ff231ca..6ddfa3e 100755
--- a/ci/install_deps.sh
+++ b/ci/install_deps.sh
@@ -3,7 +3,13 @@
 set -e
 set -x
 
+# See https://github.com/pypa/pip/issues/7953
+echo "import site
+import sys
+site.ENABLE_USER_SITE = '--user' in sys.argv[1:]
+$(cat ./ibis/setup.py)" > ./ibis/setup.py
+
 python -m pip install --upgrade pip
-python -m pip install ./ibis
-python -m pip install .
-python -m pip install pytest
+python -m pip install --user -e ./ibis
+python -m pip install --user -e .
+python -m pip install --user pytest
diff --git a/setup.py b/setup.py
index 94f94ee..ab57783 100644
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,15 @@
 """Ibis BigQuery backend."""
 
 import pathlib
+import site
+import sys
 from typing import Dict
 
 import setuptools
 
+# See https://github.com/pypa/pip/issues/7953
+site.ENABLE_USER_SITE = "--user" in sys.argv[1:]
+
 # Package metadata.
 
 name = "ibis-bigquery"
@@ -32,23 +37,26 @@
     version=version,
     description=description,
     long_description=readme,
-    url='https://github.com/ibis-project/ibis-bigquery',
+    url="https://github.com/ibis-project/ibis-bigquery",
     packages=setuptools.find_packages(),
-    python_requires='>=3.7',
+    python_requires=">=3.7",
     install_requires=[
-        'ibis-framework',  # TODO require ibis 2.0 when it's released
-        'google-cloud-bigquery >=1.12.0,<3.0.0dev',
-        'google-cloud-bigquery-storage >=1.0.0,<3.0.0dev',
-        'pyarrow >=1.0.0,<4.0.0dev',
-        'pydata-google-auth',
+        "ibis-framework",  # TODO require ibis 2.0 when it's released
+        "google-cloud-bigquery >=1.12.0,<3.0.0dev",
+        "google-cloud-bigquery-storage >=1.0.0,<3.0.0dev",
+        "pyarrow >=1.0.0,<4.0.0dev",
+        "pydata-google-auth",
     ],
     classifiers=[
         release_status,
-        'Operating System :: OS Independent',
-        'Intended Audience :: Science/Research',
-        'Programming Language :: Python',
-        'Programming Language :: Python :: 3',
-        'Topic :: Scientific/Engineering',
+        "Operating System :: OS Independent",
+        "Intended Audience :: Science/Research",
+        "Programming Language :: Python",
+        "Programming Language :: Python :: 3",
+        "Topic :: Scientific/Engineering",
     ],
-    license='Apache 2.0',
+    license="Apache 2.0",
+    entry_points={
+        "ibis.backends": ["bigquery = ibis_bigquery"],
+    },
 )


Test patch:
diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py
index 1808710..e87463c 100644
--- a/tests/unit/test_client.py
+++ b/tests/unit/test_client.py
@@ -1,3 +1,4 @@
+import ibis  # noqa: F401
 import pytest
 
 import ibis_bigquery.client
diff --git a/tests/unit/test_entry_points.py b/tests/unit/test_entry_points.py
new file mode 100644
index 0000000..6c2aff4
--- /dev/null
+++ b/tests/unit/test_entry_points.py
@@ -0,0 +1,14 @@
+"""Test to verify that the package is discoverable from Ibis v2."""
+
+import ibis
+
+
+def test_has_bigquery():
+    assert hasattr(ibis, "bigquery")
+
+
+def test_compile():
+    expr = ibis.literal(1)
+    result = ibis.bigquery.compile(expr)
+    expected = "SELECT 1"
+    assert expected in result