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

SUPP: Add support to Python 3.8 #2066

Merged
merged 3 commits into from
Feb 27, 2020

Conversation

xmnlab
Copy link
Contributor

@xmnlab xmnlab commented Feb 1, 2020

Resolves #2036

this PR:

  • adds support to Python 3.8 without pyspark and pymapd*
  • adds a udf pytest mark for bigquery.udf tests
  • improves ci/azure/linux variables
  • skip a doctest check on ibis.bigquery.udf for Python 3.8

* package conflicts:

@xmnlab xmnlab force-pushed the add-support-to-python38 branch 2 times, most recently from c9669d7 to b7d7d57 Compare February 1, 2020 01:40
ci/azure/linux.yml Show resolved Hide resolved
- lz4
- multipledispatch>=0.6.0
- mypy
- numpy>=1.11
Copy link
Contributor

Choose a reason for hiding this comment

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

you should bump numpy / pandas to the min for 3.8, I think 1.15 and 0.25.3; they don't really matter as that's what conda will install anyhow, but better to reflect in this file. also pyarrow >=0.15

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks @jreback for the review. I will work on these changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pinned pyarrow>=0.13 because pymapd has some restrictions pyarrow >=0.12,<0.14

@jreback jreback added this to the Next Feature Release milestone Feb 2, 2020
@jreback
Copy link
Contributor

jreback commented Feb 11, 2020

@xmnlab can you merge master and we see if we can get this in

@xmnlab
Copy link
Contributor Author

xmnlab commented Feb 11, 2020

I need to move back to the previous pre-commit isort hook .. because it was conflicting with black.

@xmnlab
Copy link
Contributor Author

xmnlab commented Feb 18, 2020

it seems pyspark 2.* doesn't work properly with python3.8 ... it should work when pyspark 3 is released (apache/spark#26194 (comment))

Traceback (most recent call last):
  File "/ibis/ci/impalamgr.py", line 14, in <module>
    import ibis
  File "/ibis/ibis/__init__.py", line 60, in <module>
    import ibis.spark.api as spark  # noqa: F401
  File "/ibis/ibis/spark/api.py", line 2, in <module>
    from ibis.spark.client import SparkClient
  File "/ibis/ibis/spark/client.py", line 2, in <module>
    import pyspark as ps
  File "/opt/conda/envs/ibis-env/lib/python3.8/site-packages/pyspark/__init__.py", line 51, in <module>
    from pyspark.context import SparkContext
  File "/opt/conda/envs/ibis-env/lib/python3.8/site-packages/pyspark/context.py", line 31, in <module>
    from pyspark import accumulators
  File "/opt/conda/envs/ibis-env/lib/python3.8/site-packages/pyspark/accumulators.py", line 97, in <module>
    from pyspark.serializers import read_int, PickleSerializer
  File "/opt/conda/envs/ibis-env/lib/python3.8/site-packages/pyspark/serializers.py", line 71, in <module>
    from pyspark import cloudpickle
  File "/opt/conda/envs/ibis-env/lib/python3.8/site-packages/pyspark/cloudpickle.py", line 145, in <module>
    _cell_set_template_code = _make_cell_set_template_code()
  File "/opt/conda/envs/ibis-env/lib/python3.8/site-packages/pyspark/cloudpickle.py", line 126, in _make_cell_set_template_code
    return types.CodeType(
TypeError: an integer is required (got type bytes)
Makefile:101: recipe for target 'load' failed
make: *** [load] Error 1

@xmnlab
Copy link
Contributor Author

xmnlab commented Feb 21, 2020

for some reason a doctest in ibis.bigquery.udf.api is failing. for now I am just skipping doctest for python3.8

============================================= FAILURES =============================================
_______________________________ [doctest] ibis.bigquery.udf.api.udf ________________________________
070     `the BigQuery documentation
071     <https://cloud.google.com/bigquery/docs/reference/standard-sql/user-defined-functions#sql-type-encodings-in-javascript>`_.
072 
073     Examples
074     --------
075     >>> from ibis.bigquery import udf
076     >>> import ibis.expr.datatypes as dt
077     >>> @udf(input_type=[dt.double], output_type=dt.double)
UNEXPECTED EXCEPTION: NotImplementedError("'visit_Constant' nodes not yet implemented")
Traceback (most recent call last):

  File "/home/xmn/miniconda3/envs/ibis-py38/lib/python3.8/doctest.py", line 1329, in __run
    exec(compile(example.source, filename, "single",

  File "<doctest ibis.bigquery.udf.api.udf[3]>", line 2, in <module>

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/api.py", line 215, in wrapper
    source = PythonToJavaScriptTranslator(f).compile()

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 133, in compile
    return self.visit(self.ast)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 146, in visit
    result = method(node)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 413, in visit_Module
    return '\n\n'.join(map(self.visit, node.body))

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 146, in visit
    result = method(node)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 211, in visit_FunctionDef
    body = indent(map(self.visit, node.body))

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 49, in indent
    text = '\n'.join(lines)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 146, in visit
    result = method(node)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 63, in wrapper
    return f(*args, **kwargs) + ';'

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 232, in visit_Return
    return 'return {}'.format(self.visit(node.value))

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 146, in visit
    result = method(node)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 273, in visit_BinOp
    self.visit(left), self.visit(op), self.visit(right)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 141, in visit
    raise NotImplementedError(

NotImplementedError: 'visit_Constant' nodes not yet implemented

@jreback
Copy link
Contributor

jreback commented Feb 21, 2020

@xmnlab pls open an issue for the skip

@xmnlab
Copy link
Contributor Author

xmnlab commented Feb 21, 2020

thanks @jreback! issue created: https://github.com/ibis-project/ibis/issues/2085

@xmnlab xmnlab marked this pull request as ready for review February 21, 2020 01:47
@xmnlab
Copy link
Contributor Author

xmnlab commented Feb 21, 2020

it is done for review! thanks!

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

ok passing is good, some style items. ping when green.

ci/azure/linux.yml Show resolved Hide resolved
@@ -12,6 +13,13 @@

__all__ = ('udf',)

# NOTE: used for skip doctest for Python 3.8
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have an issue for this?

define these constants in ibis/compat.py instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, thanks!

@@ -64,6 +72,8 @@ def udf(input_type, output_type, strict=True, libraries=None):

Examples
--------
>>> if PY38:
... import pytest; pytest.skip("")
Copy link
Contributor

Choose a reason for hiding this comment

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

put the issue number here, use pytest.xfail instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good. thanks!

@@ -6,7 +6,7 @@

from ibis.bigquery.udf.core import PythonToJavaScriptTranslator, SymbolTable

pytestmark = pytest.mark.bigquery
pytestmark = [pytest.mark.bigquery, pytest.mark.udf]
Copy link
Contributor

Choose a reason for hiding this comment

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

can you put a TODO and issue ref's for why skipping these tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good. I will work on that.

@@ -5,7 +5,7 @@
from ibis.bigquery.udf.find import find_names
from ibis.util import is_iterable

pytestmark = pytest.mark.bigquery
pytestmark = [pytest.mark.bigquery, pytest.mark.udf]
Copy link
Contributor

Choose a reason for hiding this comment

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

same

@@ -11,7 +11,7 @@

pytest.importorskip('google.cloud.bigquery')

pytestmark = pytest.mark.bigquery
pytestmark = [pytest.mark.bigquery, pytest.mark.udf]
Copy link
Contributor

Choose a reason for hiding this comment

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

same

ibis/expr/datatypes.py Show resolved Hide resolved
@@ -1,5 +1,5 @@
[tool.black]
line-length = 79
skip-string-normalization = true
target-version = ["py35", "py36", "py37"]
target-version = ["py36", "py37", "py38"]
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need a change in setup.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

setup.py already has python_requires='>=3.6'. do you have another property in mind that should be changed?

Copy link
Contributor

Choose a reason for hiding this comment

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

    classifiers=[
        'Development Status :: 4 - Beta',
        'Operating System :: OS Independent',
        'Intended Audience :: Science/Research',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3',
        'Topic :: Scientific/Engineering',

we usually list explicity versions here. but can be a followup (as i guess wasn't before)

Copy link
Contributor Author

@xmnlab xmnlab left a comment

Choose a reason for hiding this comment

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

@jreback thanks for the review! I am working on that.

ci/azure/linux.yml Show resolved Hide resolved
@@ -12,6 +13,13 @@

__all__ = ('udf',)

# NOTE: used for skip doctest for Python 3.8
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, thanks!

@@ -64,6 +72,8 @@ def udf(input_type, output_type, strict=True, libraries=None):

Examples
--------
>>> if PY38:
... import pytest; pytest.skip("")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good. thanks!

ibis/expr/datatypes.py Show resolved Hide resolved
@@ -1,5 +1,5 @@
[tool.black]
line-length = 79
skip-string-normalization = true
target-version = ["py35", "py36", "py37"]
target-version = ["py36", "py37", "py38"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

setup.py already has python_requires='>=3.6'. do you have another property in mind that should be changed?

@@ -6,7 +6,7 @@

from ibis.bigquery.udf.core import PythonToJavaScriptTranslator, SymbolTable

pytestmark = pytest.mark.bigquery
pytestmark = [pytest.mark.bigquery, pytest.mark.udf]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good. I will work on that.

@jreback
Copy link
Contributor

jreback commented Feb 26, 2020

@xmnlab this is blocking PR for the release @xmnlab ping on green.

@xmnlab
Copy link
Contributor Author

xmnlab commented Feb 26, 2020

@jreback I added the changes you requested. it seems CI is very slow today.

@xmnlab
Copy link
Contributor Author

xmnlab commented Feb 26, 2020

it seems pytest.xfail() will break the doctest: pytest-dev/pytest#310

@xmnlab
Copy link
Contributor Author

xmnlab commented Feb 27, 2020

green :)

from ibis.util import is_iterable

pytestmark = pytest.mark.bigquery
if PY38:
Copy link
Contributor

Choose a reason for hiding this comment

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

so as a followup, I'd like to change this to use the class based features rather than skips, e.g. e.g. in ibis/tests/backends, UDF can be modeled like for example RoundConvention (we explicitly add these tests to the backends that work with it).

please create an issue for this. thanks.

cc @icexelloss

@jreback jreback merged commit 2d6dfa4 into ibis-project:master Feb 27, 2020
@jreback
Copy link
Contributor

jreback commented Feb 27, 2020

thanks @xmnlab

@xmnlab xmnlab deleted the add-support-to-python38 branch December 21, 2020 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SUPP: Add support for Python 3.8
2 participants