-
Notifications
You must be signed in to change notification settings - Fork 186
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
Fixes for 3.11 #1087
Fixes for 3.11 #1087
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1087 +/- ##
==========================================
- Coverage 88.64% 88.62% -0.02%
==========================================
Files 112 111 -1
Lines 10247 10207 -40
Branches 4012 4014 +2
==========================================
- Hits 9083 9046 -37
+ Misses 705 701 -4
- Partials 459 460 +1 ☔ View full report in Codecov by Sentry. |
We still have compile errors:
Perhaps worth enabling CI for Python 3.11 (you might have to use the Python available on the manylinux image, rather than what Azure provide). I note that currently a release of JPype would fail because it would try to build a Python 3.11 wheel (since we glob the Python versions available on manylinux), even though that isn't tested (something we could try to address another time). |
|
Thanks @rapgro, but the problem is that we are setting the frame, not getting the frame in this case. I appreciate that this hasn't been public API in any Python version from Python 2.7. Some interesting context on the motivation at #1071 (comment). |
@pelson I found the issue with the broken test. So I have a fully working copy for 3.11. Now we just need to get the multi version going and we should be good to go. |
@marscher Some background on this. Python 3.11 removed a number of internal methods that we were using. These methods were used because the Python API is completely deficient in some areas like handling stack frames or using custom allocators with GC objects. They are planning replacements for what we need but none of the replacements are in 3.11. So they gutted the interface we are standing on, and there is no replacement. Meaning unless I do something drastic we won't support 3.11 at all. So I had to come up with a few creative kludges. The biggest danger is these kludges will introduce reference leaks as they are doing things like initializing an object twice and swapping the memory layout. They are safer in the sense that I managed to get them to use the public API, but in horrible ways (basically creating using side effects of the public implementations). Hopefully these last until the replacement API is released. |
That's bad news, lets hope that 3.12 will add support for what is needed.
I wonder how bullet proof our leakage testing is. This could be the time to check and eventually improve this. I know this is hard to achieve, but would safe us lots of troubles some day. |
Our testing matrix checks common leak paths in objects. This particular spot is on types not general objects, so it only really leaks after the JVM is shutdown which is less of an issue than an object leak. Thus unless you were adding lots and lots of dynamically allocated types form Java then the leak may be a problem. But as we always cache types they are never freed in normal situations anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few change proposals in Thrameos#56.
In general: I propose that this is merged, and that we have a special v1.4.0.post0
Python3.11 wheel be uploaded to PyPI before the 2022-10-24 (Python 3.11 release day).
current = StrictVersion(platform.mac_ver()[0][:4]) | ||
if current >= StrictVersion('10.6') and current < StrictVersion('10.9'): | ||
current = Version(platform.mac_ver()[0][:4]) | ||
if current >= Version('10.6') and current < Version('10.9'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is part of your distutils handling. I suggest that this can be a separate PR, or alternatively, you should add packaging
as an explicit dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. This was required to get Python 3.11 to work for me so I think it is same theme. I will look at dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I dont see where it goes in setup.py. we never listed distutils as a requirement. Can you suggest the required line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. It is install_requires https://github.com/jpype-project/jpype/blob/master/setup.py#L81.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it was supposed to have distutils there before.
https://packaging.python.org/en/latest/discussions/install-requires-vs-requirements/
I don't see the same format we have so I am guessing we want...
install_requires=['typing_extensions ; python_version< "3.8"',
'packaging ; python_version< "3.10"'],
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
distutils is a standard library, which has been deprecated for a while now and will be removed in Python 3.12.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'packaging ; python_version< "3.10"'
Should just be
'packaging'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The minor point about adding packaging
as a dependency aside, looks good to me. Much better than what was there before in fact. Excellent work @Thrameos!
@Thrameos & @marscher - I'm unavailable for a bit now, and won't be back before the Python 3.11 release. Do you agree that we should merge and release a |
@marscher I wpuld look to you regarding this decision. I would be fine with releasing a new patch or new minor with the fixes. I can start the build process once you decide which. |
Python 3.11 has been released as scheduled on October 25, 2022 and this is the first attempt to see how far Airflow (mostly dependencies) are from being ready to officially support 3.11. So far we had to exclude the following dependencies: - [ ] Pyarrow dependency: apache/arrow#14499 - [ ] Google Provider: #27292 and googleapis/python-bigquery#1386 - [ ] Databricks Provider: databricks/databricks-sql-python#59 - [ ] Papermill Provider: nteract/papermill#700 - [ ] Azure Provider: Azure/azure-uamqp-python#334 and Azure/azure-sdk-for-python#27066 - [ ] Apache Beam Provider: apache/beam#23848 - [ ] Snowflake Provider: snowflakedb/snowflake-connector-python#1294 - [ ] JDBC Provider: jpype-project/jpype#1087 - [ ] Hive Provider: cloudera/python-sasl#30 We might decide to release Airflow in 3.11 with those providers disabled in case they are lagging behind eventually, but for the moment we want to work with all the projects in concert to be able to release all providers (Google Provider requires quite a lot of work and likely Google Team stepping up and community helping with migration to latest Goofle cloud libraries)
I'm also fine with a micro patch release for this kind of change. Sorry for the delay! |
Will do. Thanks. |
Python 3.11 has been released as scheduled on October 25, 2022 and this is the first attempt to see how far Airflow (mostly dependencies) are from being ready to officially support 3.11. So far we had to exclude the following dependencies: - [ ] Pyarrow dependency: apache/arrow#14499 - [ ] Google Provider: #27292 and googleapis/python-bigquery#1386 - [ ] Databricks Provider: databricks/databricks-sql-python#59 - [ ] Papermill Provider: nteract/papermill#700 - [ ] Azure Provider: Azure/azure-uamqp-python#334 and Azure/azure-sdk-for-python#27066 - [ ] Apache Beam Provider: apache/beam#23848 - [ ] Snowflake Provider: snowflakedb/snowflake-connector-python#1294 - [ ] JDBC Provider: jpype-project/jpype#1087 - [ ] Hive Provider: cloudera/python-sasl#30 We might decide to release Airflow in 3.11 with those providers disabled in case they are lagging behind eventually, but for the moment we want to work with all the projects in concert to be able to release all providers (Google Provider requires quite a lot of work and likely Google Team stepping up and community helping with migration to latest Goofle cloud libraries)
Python 3.11 has been released as scheduled on October 25, 2022 and this is the first attempt to see how far Airflow (mostly dependencies) are from being ready to officially support 3.11. So far we had to exclude the following dependencies: - [ ] Pyarrow dependency: apache/arrow#14499 - [ ] Google Provider: #27292 and googleapis/python-bigquery#1386 - [ ] Databricks Provider: databricks/databricks-sql-python#59 - [ ] Papermill Provider: nteract/papermill#700 - [ ] Azure Provider: Azure/azure-uamqp-python#334 and Azure/azure-sdk-for-python#27066 - [ ] Apache Beam Provider: apache/beam#23848 - [ ] Snowflake Provider: snowflakedb/snowflake-connector-python#1294 - [ ] JDBC Provider: jpype-project/jpype#1087 - [ ] Hive Provider: cloudera/python-sasl#30 We might decide to release Airflow in 3.11 with those providers disabled in case they are lagging behind eventually, but for the moment we want to work with all the projects in concert to be able to release all providers (Google Provider requires quite a lot of work and likely Google Team stepping up and community helping with migration to latest Goofle cloud libraries)
Python 3.11 has been released as scheduled on October 25, 2022 and this is the first attempt to see how far Airflow (mostly dependencies) are from being ready to officially support 3.11. So far we had to exclude the following dependencies: - [ ] Pyarrow dependency: apache/arrow#14499 - [ ] Google Provider: #27292 and googleapis/python-bigquery#1386 - [ ] Databricks Provider: databricks/databricks-sql-python#59 - [ ] Papermill Provider: nteract/papermill#700 - [ ] Azure Provider: Azure/azure-uamqp-python#334 and Azure/azure-sdk-for-python#27066 - [ ] Apache Beam Provider: apache/beam#23848 - [ ] Snowflake Provider: snowflakedb/snowflake-connector-python#1294 - [ ] JDBC Provider: jpype-project/jpype#1087 - [ ] Hive Provider: cloudera/python-sasl#30 We might decide to release Airflow in 3.11 with those providers disabled in case they are lagging behind eventually, but for the moment we want to work with all the projects in concert to be able to release all providers (Google Provider requires quite a lot of work and likely Google Team stepping up and community helping with migration to latest Goofle cloud libraries)
native/python/pyjp_value.cpp:
FYI @encukou is working on a Python API for that. |
Yep. Have looked at that API, but it doesn't exist for Py 3.11 so we are stuck because our old method using private functions doesn't work. Worse it appears this kludge may break something in the garbage collector at least in one projects testing. So I need to investigate further this weekend. |
Thanks for taking the shot! Should we try to pin JPype to use Python<3.11 in the meantime, if we run into such horrible subtle errors like garbage collection issues? |
IMO, if we can engage with the Python RC process, there should be enough time to avoid nasty surprises. If we find that we absolutely can't be compatible with Python 3.12, we can always release something then which has that constraint. In general, upper pins are discouraged (long read). I think some more dialogue between the C API team and JPype should come out of this 🤞, so I truly hope things will get better, not worse, in the future. |
A first step could be testing against unreleased versions of Python, right? I'm sure they provide a nightly build, which we can integrate into our CI process on a regular basis. @pelson Thanks for the reference about version pinning. I wasn't aware, that is becoming a disease in the eco system :) |
The first Alpha of CPython 3.12 is already out. I think the alphas/betas would work bit better for you than nightly builds, since they're proper releases that pass the full test suite (i.e. stable buildbots) & have release blockers sorted out. There's no formal “C API” team, but to get in touch with the relevant people, use the |
Thanks a lot @encukou for these useful hints! |
Python 3.11 has been released as scheduled on October 25, 2022 and this is the first attempt to see how far Airflow (mostly dependencies) are from being ready to officially support 3.11. So far we had to exclude the following dependencies: - [ ] Pyarrow dependency: apache/arrow#14499 - [ ] Google Provider: #27292 and googleapis/python-bigquery#1386 - [ ] Databricks Provider: databricks/databricks-sql-python#59 - [ ] Papermill Provider: nteract/papermill#700 - [ ] Azure Provider: Azure/azure-uamqp-python#334 and Azure/azure-sdk-for-python#27066 - [ ] Apache Beam Provider: apache/beam#23848 - [ ] Snowflake Provider: snowflakedb/snowflake-connector-python#1294 - [ ] JDBC Provider: jpype-project/jpype#1087 - [ ] Hive Provider: cloudera/python-sasl#30 We might decide to release Airflow in 3.11 with those providers disabled in case they are lagging behind eventually, but for the moment we want to work with all the projects in concert to be able to release all providers (Google Provider requires quite a lot of work and likely Google Team stepping up and community helping with migration to latest Goofle cloud libraries)
Python 3.11 has been released as scheduled on October 25, 2022 and this is the first attempt to see how far Airflow (mostly dependencies) are from being ready to officially support 3.11. So far we had to exclude the following dependencies: - [ ] Pyarrow dependency: apache/arrow#14499 - [ ] Google Provider: apache#27292 and googleapis/python-bigquery#1386 - [ ] Databricks Provider: databricks/databricks-sql-python#59 - [ ] Papermill Provider: nteract/papermill#700 - [ ] Azure Provider: Azure/azure-uamqp-python#334 and Azure/azure-sdk-for-python#27066 - [ ] Apache Beam Provider: apache/beam#23848 - [ ] Snowflake Provider: snowflakedb/snowflake-connector-python#1294 - [ ] JDBC Provider: jpype-project/jpype#1087 - [ ] Hive Provider: cloudera/python-sasl#30 We might decide to release Airflow in 3.11 with those providers disabled in case they are lagging behind eventually, but for the moment we want to work with all the projects in concert to be able to release all providers (Google Provider requires quite a lot of work and likely Google Team stepping up and community helping with migration to latest Goofle cloud libraries)
Fixes #1086