Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

Supporting python 3.8 in motor

Python 3.8 support was released in October, so I’m looking into upgrading to it.

I upgraded my system and found some DeprecationWarnings in python 3.8.

  /usr/local/lib/python3.8/site-packages/motor/metaprogramming.py:316: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    coro = framework.coroutine(attr)

-- Docs: https://docs.pytest.org/en/latest/warnings.html

This deprecation is documented here: https://docs.python.org/3/library/asyncio-task.html#asyncio.coroutine

Welcome to the community @Tom_Wright!

Support for Python 3.8 was added for the Motor 2.1 release last December (per MOTOR-458).

What version of Motor are you using?

Regards,
Stennie

This is a known issue that we are planning to address soon. See https://jira.mongodb.org/browse/MOTOR-484.

Hi Tom. I understand that this can be a bit confusing - allow me to explain. The current version of Motor supports Python runtimes all the way back to 2.7 (using Tornado for async). Consequently, there are several places in the code where we use the old coroutine syntax. In the next release, we will drop support for older Python runtimes and also switch over to exclusively using async/await (see https://jira.mongodb.org/browse/MOTOR-373)

1 Like

Thanks for your quick reply.

Hmm, looks like your jira was the place to look for this! I posted this message here after visiting your github page which stated that:

"Issues with, questions about, or feedback for Motor should be sent to the MongoDB Community Forums.

For confirmed issues or feature requests, open a case in Jira in the “MOTOR” project."

which lead me to believe (incorrectly) that all issues were discussed here prior to the creation of a ticket.

It looks like you are on it though!

Thanks,
Tom

Hi Tom,

The general suggestion is correct: discussion in our community forums will help clarify issues and we can provide advice if there is a more targeted destination for a feature request or bug. Our community forums reach the broadest audience and include members of the MongoDB engineering and product teams, so you are likely to get a faster response here than adding an issue for the development team to triage. Discussion here also benefits others in the community who can learn and share their experience.

Our JIRA issue tracker is focused on development tasks, so is worth searching for context on issues that have been reported and possibly addressed in (or planned for) a release. Before diving into JIRA, I would check the driver release notes / changelog to see if there are newer releases available than your current version. The changelogs in driver documentation will usually link to more information in JIRA.

There is also a MongoDB Feedback Engine site for product and feature suggestions. These suggestions are generally focused on use cases rather than very specific bugs or implementation tasks.

Note: for future driver questions, it would be helpful to include your specific driver version for context and faster response. I know that Motor added support for Python 3.8 but didn’t look into the warning because you hadn’t mentioned a version yet (upgrading to the latest release is the most likely suggestion to start with).

Regards,
Stennie