jorgenschaefer/elpy

Support Python 3.10 new case/match syntax

Closed this issue · 2 comments

Summary

It appears the case/match syntax introduced with Python 3.10 hasn't been absorbed by Elpy yet.

Steps to reproduce

Write the following in a test.py buffer:

variable = 'Test'
match variable:
    case 'Test': 
        print('match!')
    case _:
        print('no match')

Play around with the indentation. Realize there's no support for properly indenting that snippet.

My configuration

OS

Guix System

Result of (elpy-config)

Elpy Configuration

Emacs.............: 28.2
Elpy..............: 1.35.0
Virtualenv........: None
Interactive Python: ipython 8.5.0 (/gnu/store/3i76fh888ah2nzxyhkpfaazlx4x1pga6-profile/bin/ipython)
RPC virtualenv....: system (/home/maxim/.guix-profile)
 Python...........: python 3.10.7 (/home/maxim/.guix-profile/bin/python)
 Jedi.............: 0.18.2
 Autopep8.........: 1.5.3 (2.0.2 available)
 Yapf.............: 0.29.0 (0.33.0 available)
 Black............: 22.3.0 (23.3.0 available)
Syntax checker....: flake8 (/gnu/store/3i76fh888ah2nzxyhkpfaazlx4x1pga6-profile/bin/flake8)

Elpy configuration in my init.el

(setq python-indent-offset 4)
(elpy-enable)
(put 'scroll-left 'disabled nil)
(setq python-shell-interpreter "ipython"
      python-shell-interpreter-args "-i --simple-prompt")
gopar commented

Elpy is simply a collection of other tools to make python editing experience better. It's not in charge of syntax :)

The python.el which is in core emacs is in charge of this, and should be filled there. Alternatively, you can use tree-sitter which will also be in emacs core in the coming future :)

Ah, thanks for pointing that. I'll look into the Emacs bug to see if the problem has been reported or even fixed already, thanks!