Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

chore: test minimum dependencies in python 3.7#1269

Merged
parthea merged 2 commits intomainfrom
use-min-dependencies-in-3.7
Jun 6, 2022
Merged

chore: test minimum dependencies in python 3.7#1269
parthea merged 2 commits intomainfrom
use-min-dependencies-in-3.7

Conversation

@parthea
Copy link
Contributor

@parthea parthea commented Jun 3, 2022

Test the minimum supported dependencies in python 3.7 unit tests to prepare for dropping python 3.6

@parthea parthea requested a review from a team June 3, 2022 11:50
@parthea parthea requested a review from a team as a code owner June 3, 2022 11:50
@parthea parthea requested a review from stephaniewang526 June 3, 2022 11:50
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: bigquery Issues related to the googleapis/python-bigquery API. labels Jun 3, 2022
@parthea
Copy link
Contributor Author

parthea commented Jun 3, 2022

Shapely>=1.6.4.post2 or newer is needed to avoid the following error

Collecting Shapely<2.0dev,>=1.6.0
  Downloading Shapely-1.6.4.post1.tar.gz (224 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 224.3/224.3 KB 7.1 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Failed `CDLL(libgeos_c.so.1)`
      Failed `CDLL(libgeos_c.so)`
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-x28xvgab/shapely_d8b3175133c74e619cae086f1b38ab93/setup.py", line 80, in <module>
          from shapely._buildcfg import geos_version_string, geos_version, \
        File "/tmp/pip-install-x28xvgab/shapely_d8b3175133c74e619cae086f1b38ab93/shapely/_buildcfg.py", line 167, in <module>
          fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
        File "/tmp/pip-install-x28xvgab/shapely_d8b3175133c74e619cae086f1b38ab93/shapely/_buildcfg.py", line 161, in load_dll
          libname, fallbacks or []))
      OSError: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so']
      [end of output]

@parthea
Copy link
Contributor Author

parthea commented Jun 3, 2022

pandas>=1.0.5 is needed for python 3.7 to avoid the error in pandas-dev/pandas#39520

@parthea
Copy link
Contributor Author

parthea commented Jun 3, 2022

pandas>=1.1.0 and python-dateutil>=2.7.3 are required for the following unit test to pass

_______________________________________________________________________________________ TestRowIterator.test_to_dataframe_tqdm_error ________________________________________________________________________________________

self = <tests.unit.test_table.TestRowIterator testMethod=test_to_dataframe_tqdm_error>

    @unittest.skipIf(pandas is None, "Requires `pandas`")
    @unittest.skipIf(tqdm is None, "Requires `tqdm`")
    @mock.patch("tqdm.tqdm_gui", new=None)  # will raise TypeError on call
    @mock.patch("tqdm.tqdm_notebook", new=None)  # will raise TypeError on call
    @mock.patch("tqdm.tqdm", new=None)  # will raise TypeError on call
    def test_to_dataframe_tqdm_error(self):
        from google.cloud.bigquery.schema import SchemaField
    
        schema = [
            SchemaField("name", "STRING", mode="REQUIRED"),
            SchemaField("age", "INTEGER", mode="REQUIRED"),
        ]
        rows = [
            {"f": [{"v": "Phred Phlyntstone"}, {"v": "32"}]},
            {"f": [{"v": "Bharney Rhubble"}, {"v": "33"}]},
            {"f": [{"v": "Wylma Phlyntstone"}, {"v": "29"}]},
            {"f": [{"v": "Bhettye Rhubble"}, {"v": "27"}]},
        ]
        path = "/foo"
    
        for progress_bar_type in ("tqdm", "tqdm_notebook", "tqdm_gui"):
            api_request = mock.Mock(return_value={"rows": rows})
            row_iterator = self._make_one(_mock_client(), api_request, path, schema)
    
            with warnings.catch_warnings(record=True) as warned:
                df = row_iterator.to_dataframe(
                    progress_bar_type=progress_bar_type,
                    create_bqstorage_client=False,
                )
    
            self.assertEqual(len(df), 4)  # all should be well
    
            # Warn that a progress bar was requested, but creating the tqdm
            # progress bar failed.
            for warning in warned:
>               self.assertIs(warning.category, UserWarning)
E               AssertionError: <class 'DeprecationWarning'> is not <class 'UserWarning'>

tests/unit/test_table.py:3284: AssertionError

@Mariatta
Copy link

Mariatta commented Jun 3, 2022

Should the version of pandas be updated in setup.py?

@parthea
Copy link
Contributor Author

parthea commented Jun 3, 2022

Yes, I'd like to wait to update setup.py until we drop python 3.6 in a follow up PR and update python_requires here to specify >=3.7

python_requires=">=3.6, <3.11",

@parthea parthea merged commit ee3c16c into main Jun 6, 2022
@parthea parthea deleted the use-min-dependencies-in-3.7 branch June 6, 2022 15:27
waltaskew pushed a commit to waltaskew/python-bigquery that referenced this pull request Jul 20, 2022
* chore: test minimum dependencies in python 3.7

* update constraints
abdelmegahedgoogle pushed a commit to abdelmegahedgoogle/python-bigquery that referenced this pull request Apr 17, 2023
* chore: test minimum dependencies in python 3.7

* update constraints
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants