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

Python 3.7 support #1451

Closed
mikmatko opened this issue Mar 22, 2018 · 8 comments
Closed

Python 3.7 support #1451

mikmatko opened this issue Mar 22, 2018 · 8 comments
Assignees

Comments

@mikmatko
Copy link

async is a reserved keyword in Python 3.7.
async is used a bit in kafka-python, so this currently breaks Python 3.7 compatibility. See e.g. producer/base.py

Using something like async_ would be fine though, so quickest way to resolve this would be just to rename a few things from async to async_ or something like that.

Thanks!

@dpkp dpkp self-assigned this Mar 22, 2018
@dpkp
Copy link
Owner

dpkp commented Mar 22, 2018

This requires a breaking change to the SimpleProducer interface (renaming the public async=True kwarg to something else). So we will need to be careful about how we roll this out.

@tvoinarovskyi
Copy link
Collaborator

Just use kwargs...

@dpkp
Copy link
Owner

dpkp commented Mar 22, 2018

We wont be able to keep the async kwarg:

Python 3.7.0b2 (default, Mar 22 2018, 10:48:35)
[Clang 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo(async=True):
  File "<stdin>", line 1
    def foo(async=True):
                ^
SyntaxError: invalid syntax
>>>

Which means we are going to have to break the current interface...

@tvoinarovskyi
Copy link
Collaborator

tvoinarovskyi commented Mar 22, 2018

I meant something like:

>>> def send(self, **kwargs):
...     if 'async' in kwargs:
...         print(kwargs['async'])
... 
>>> send(1)
>>> send(1, async=True)
True

@dpkp
Copy link
Owner

dpkp commented Mar 22, 2018

Nice! So passing async=True would still work on older pythons. Great call.

@dpkp
Copy link
Owner

dpkp commented May 25, 2018

Fixed in #1454

@ATajadod94
Copy link

Issue persists on pip install as of today

@ghost
Copy link

ghost commented Dec 5, 2019

Issue persists on pip install as of today

You need to pip uninstall kafka and then pip install kafka-python
The package named kafka is still with an older version without the fix, but the package kafka-python is up to date...

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

No branches or pull requests

4 participants