Ask Your Question
2

SageMath code auto-formatting

asked 2021-06-15 15:19:12 +0100

Bakerbakura gravatar image

Hello there!

Are there any known code formatters for SageMath code, such as yapf and black are for Python code? If not, is it possible to make a fork of, say, yapf which recognises the special SageMath syntax? It makes sense that this would be possible since SageMath code is essentially an extension of Python; however I have no idea how one would go about actually doing so.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-06-15 15:29:20 +0100

tmonteil gravatar image

If you plan do write programs within a few files, you can use Python tools as such code will be pure Python. The "special Sagemath syntax" is made possible by the preparser, which is intended to be used in interactive mode (command line and notebooks), not within a serious program. Note that the source code of Sage itself is made of pure Python and Cython, it is not preparsed.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-06-15 15:19:12 +0100

Seen: 333 times

Last updated: Jun 15 '21