fix(rpc): add support for Python 3.12 and later #2055
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
In Python 3.12 (and later), the
distutilsmodule has been removed. This causes the rpc environment to fail. By installingsetuptoolsas a third-party dependency for Python 3.12 and later, the currently missing dependencies will be added and theelpyPython code will work as expected.Output from
elpy-configfor anrpc-venvcreated with Python 3.12:As an alternative to the changes, there are workarounds such as:
fixes #2051
fixes #2039
fixes #2033
PR checklist
Please make sure that the following things have been addressed (and check the relevant checkboxes):
NOTE: several tests are failing, also when running them from the master branch (where there are no changes). I have installed
cask, created an empty virtual environment, and run the/test/setupscript before running the tests.However, I have run the new unit test I added in this feature branch and verified that it passes.
These tests fails for me in the
masterbranch:Ran 482 tests in 311.138 seconds 20 unexpected results: FAILED elpy-company-backend-should-add-shell-candidates FAILED elpy-company-backend-should-find-full-prefix-string FAILED elpy-company-backend-should-find-simple-prefix-string FAILED elpy-eldoc-documentation-should-show-object-onelinedoc FAILED elpy-fold-at-point-should-NOT-fold-and-unfold-functions-from-after FAILED elpy-pdb-break-at-point-should-break-at-point FAILED elpy-pdb-debug-buffer-and-break-at-point-should-ignore-breakpoints FAILED elpy-pdb-debug-buffer-from-beginning-should-enter-pdb FAILED elpy-pdb-debug-buffer-should-always-begin-at-first-line FAILED elpy-pdb-debug-buffer-should-continue-with-second-breakpoint FAILED elpy-pdb-debug-buffer-should-enter-pdb FAILED elpy-pdb-debug-buffer-should-forget-previous-breakpoints FAILED elpy-pdb-debug-buffer-should-stop-at-the-first-breakpoint FAILED elpy-pdb-debug-last-exception-should-debug-last-exception FAILED elpy-pdb-debug-last-exception-should-ignore-breakpoints FAILED elpy-pdb-toggle-breakpoint-at-point-should-add-breakpoints FAILED elpy-shell-get-or-create-process-should-add-project-root-to-path FAILED elpy-shell-send-file-should-accept-large-strings FAILED elpy-shell-should-echo-outputs FAILED elpy-should-format-code-with-default-formatterFrom the feature branch (same failed tests):
Ran 483 tests in 311.680 seconds 20 unexpected results: FAILED elpy-company-backend-should-add-shell-candidates FAILED elpy-company-backend-should-find-full-prefix-string FAILED elpy-company-backend-should-find-simple-prefix-string FAILED elpy-eldoc-documentation-should-show-object-onelinedoc FAILED elpy-fold-at-point-should-NOT-fold-and-unfold-functions-from-after FAILED elpy-pdb-break-at-point-should-break-at-point FAILED elpy-pdb-debug-buffer-and-break-at-point-should-ignore-breakpoints FAILED elpy-pdb-debug-buffer-from-beginning-should-enter-pdb FAILED elpy-pdb-debug-buffer-should-always-begin-at-first-line FAILED elpy-pdb-debug-buffer-should-continue-with-second-breakpoint FAILED elpy-pdb-debug-buffer-should-enter-pdb FAILED elpy-pdb-debug-buffer-should-forget-previous-breakpoints FAILED elpy-pdb-debug-buffer-should-stop-at-the-first-breakpoint FAILED elpy-pdb-debug-last-exception-should-debug-last-exception FAILED elpy-pdb-debug-last-exception-should-ignore-breakpoints FAILED elpy-pdb-toggle-breakpoint-at-point-should-add-breakpoints FAILED elpy-shell-get-or-create-process-should-add-project-root-to-path FAILED elpy-shell-send-file-should-accept-large-strings FAILED elpy-shell-should-echo-outputs FAILED elpy-should-format-code-with-default-formatterFor new features only: