Skip to content

LIVY-1076: Python 3.12 to 3.14 compatibility fixes - #550

Merged
gyogal merged 1 commit into
apache:masterfrom
nileshrathi345:master_LIVY-1076
Aug 28, 2026
Merged

LIVY-1076: Python 3.12 to 3.14 compatibility fixes#550
gyogal merged 1 commit into
apache:masterfrom
nileshrathi345:master_LIVY-1076

Conversation

@nileshrathi345

@nileshrathi345 nileshrathi345 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR resolves LIVY-1076 by fixing Python 3.12+ compatibility issues in livy-python-api.

Changes:

  • client.py: Replace deprecated ConfigParser.readfp() with read_file() (removed in Python 3.12).
  • job_handle.py: Replace deprecated notifyAll() with notify_all().
  • job_context.py: Replace removed abc.abstractproperty with @property + @abstractmethod on all abstract properties (required for Python 3.12+).
  • setup.py: Add PyPI classifiers for Python 3.8 through 3.14 to reflect supported versions.

These changes address the deprecation warnings reported in the Jira ticket and ensure the Python client library runs cleanly through Python 3.14, aligning with Spark 4.1’s supported Python range.

Jira: https://issues.apache.org/jira/browse/LIVY-1076

How was this patch tested?

  • Ran livy-python-api unit tests locally:
    python -m pytest
  • Verified 12 tests passed with no deprecation warnings on Python 3.12.8:
============================= test session starts ==============================
platform darwin -- Python 3.12.8, pytest-9.1.1, pluggy-1.6.0 -- /Users/nilesh.rathi/Workspace/upstream/LIVY-1076/livy/python-api/.venv-test-3.12.8/bin/python
cachedir: target/.pytest_cache
rootdir: /Users/nilesh.rathi/Workspace/upstream/LIVY-1076/livy/python-api
configfile: setup.cfg
plugins: flaky-3.8.1
collecting ... collected 12 items
src/test/python/livy-tests/client_test.py::test_create_new_session_without_default_config PASSED [  8%]
src/test/python/livy-tests/client_test.py::test_create_new_session_with_default_config PASSED [ 16%]
src/test/python/livy-tests/client_test.py::test_connect_to_existing_session PASSED [ 25%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_running_state PASSED [ 33%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_queued_state PASSED [ 41%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_succeeded_state PASSED [ 50%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_failed_state PASSED [ 58%]
src/test/python/livy-tests/client_test.py::test_add_file PASSED          [ 66%]
src/test/python/livy-tests/client_test.py::test_upload_file PASSED       [ 75%]
src/test/python/livy-tests/client_test.py::test_add_pyfile PASSED        [ 83%]
src/test/python/livy-tests/client_test.py::test_upload_pyfile PASSED     [ 91%]
src/test/python/livy-tests/client_test.py::test_add_jar PASSED           [100%]
============================== 12 passed in 0.83s ==============================

  • Also verified on Python 3.8.19, 3.9.18, and 3.14.0 — all 12 tests passed.
  • Ran stricter check with deprecations treated as errors:
    python -m pytest -W error::DeprecationWarning

Was this patch authored or co-authored using generative AI tooling?

Yes. Cursor AI was used to run the local test verification.

@nileshrathi345

Copy link
Copy Markdown
Contributor Author

@gyogal and @roczei could please take a look when possible and review.
thanks..!!!

@roczei

roczei commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Thanks for the fix! This will be super helpful for Spark 4 support. Tested and verified across the following Python versions: 3.12.14, 3.13.15, 3.14.7

============================================================= test session starts ==============================================================
platform darwin -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /Users/user/.pyenv/versions/3.12.14/bin/python3.12
cachedir: target/.pytest_cache
rootdir: /Users/user/github/upstream/livy/python-api
configfile: setup.cfg
plugins: flaky-3.8.1
collected 12 items                                                                                                                             

src/test/python/livy-tests/client_test.py::test_create_new_session_without_default_config PASSED                                         [  8%]
src/test/python/livy-tests/client_test.py::test_create_new_session_with_default_config PASSED                                            [ 16%]
src/test/python/livy-tests/client_test.py::test_connect_to_existing_session PASSED                                                       [ 25%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_running_state PASSED                                                   [ 33%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_queued_state PASSED                                                    [ 41%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_succeeded_state PASSED                                                 [ 50%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_failed_state PASSED                                                    [ 58%]
src/test/python/livy-tests/client_test.py::test_add_file PASSED                                                                          [ 66%]
src/test/python/livy-tests/client_test.py::test_upload_file PASSED                                                                       [ 75%]
src/test/python/livy-tests/client_test.py::test_add_pyfile PASSED                                                                        [ 83%]
src/test/python/livy-tests/client_test.py::test_upload_pyfile PASSED                                                                     [ 91%]
src/test/python/livy-tests/client_test.py::test_add_jar PASSED                                                                           [100%]

============================================================== 12 passed in 0.62s ==============================================================


============================================================= test session starts ==============================================================
platform darwin -- Python 3.13.15, pytest-9.1.1, pluggy-1.6.0 -- /Users/user/.pyenv/versions/3.13.15/bin/python3.13
cachedir: target/.pytest_cache
rootdir: /Users/user/github/upstream/livy/python-api
configfile: setup.cfg
plugins: flaky-3.8.1
collected 12 items                                                                                                                             

src/test/python/livy-tests/client_test.py::test_create_new_session_without_default_config PASSED                                         [  8%]
src/test/python/livy-tests/client_test.py::test_create_new_session_with_default_config PASSED                                            [ 16%]
src/test/python/livy-tests/client_test.py::test_connect_to_existing_session PASSED                                                       [ 25%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_running_state PASSED                                                   [ 33%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_queued_state PASSED                                                    [ 41%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_succeeded_state PASSED                                                 [ 50%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_failed_state PASSED                                                    [ 58%]
src/test/python/livy-tests/client_test.py::test_add_file PASSED                                                                          [ 66%]
src/test/python/livy-tests/client_test.py::test_upload_file PASSED                                                                       [ 75%]
src/test/python/livy-tests/client_test.py::test_add_pyfile PASSED                                                                        [ 83%]
src/test/python/livy-tests/client_test.py::test_upload_pyfile PASSED                                                                     [ 91%]
src/test/python/livy-tests/client_test.py::test_add_jar PASSED                                                                           [100%]

============================================================== 12 passed in 0.62s ==============================================================


============================================================= test session starts ==============================================================
platform darwin -- Python 3.14.7, pytest-9.1.1, pluggy-1.6.0 -- /Users/user/.pyenv/versions/3.14.7/bin/python3.14
cachedir: target/.pytest_cache
rootdir: /Users/user/github/upstream/livy/python-api
configfile: setup.cfg
plugins: flaky-3.8.1
collected 12 items                                                                                                                             

src/test/python/livy-tests/client_test.py::test_create_new_session_without_default_config PASSED                                         [  8%]
src/test/python/livy-tests/client_test.py::test_create_new_session_with_default_config PASSED                                            [ 16%]
src/test/python/livy-tests/client_test.py::test_connect_to_existing_session PASSED                                                       [ 25%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_running_state PASSED                                                   [ 33%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_queued_state PASSED                                                    [ 41%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_succeeded_state PASSED                                                 [ 50%]
src/test/python/livy-tests/client_test.py::test_submit_job_verify_failed_state PASSED                                                    [ 58%]
src/test/python/livy-tests/client_test.py::test_add_file PASSED                                                                          [ 66%]
src/test/python/livy-tests/client_test.py::test_upload_file PASSED                                                                       [ 75%]
src/test/python/livy-tests/client_test.py::test_add_pyfile PASSED                                                                        [ 83%]
src/test/python/livy-tests/client_test.py::test_upload_pyfile PASSED                                                                     [ 91%]
src/test/python/livy-tests/client_test.py::test_add_jar PASSED                                                                           [100%]

============================================================== 12 passed in 0.87s ==============================================================

@gyogal

gyogal commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Thank you for submitting a fix for LIVY-1076 @nileshrathi345 ! It is another important step towards Spark 4 support. Also thanks @roczei for the review and testing!

@gyogal
gyogal merged commit e958c45 into apache:master Aug 28, 2026
4 checks passed
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.

3 participants