GSoC 2023 Project Idea 22.3 Code editor support for Brian model equations (175h/350h)

Description:

Differential equations, defined in Python strings, are at the core of Brian’s model descriptions. They use a language familiar to computational neuroscientists, and closely follow the way that languages are described in scientific articles. Defining these equations in strings has the advantage that these descriptions are very concise, and can be read as mathematical equations, and not as programming code. The fact that equations are “just strings” does have disadvantages as well, though: from the point of view of a code editor, they are simply text and do not benefit from helpful features such as syntax highlighting, autocompletion, or syntax checks.

The aim of this project is to improve this situation by writing a Brian-specific “Language Server extension” and syntax highlighting rules, that provides these features for Brian equations embedded in a Python script. The Language Server Protocol (LSP) has been created by Microsoft and is used to provide advanced editing features to editors such as Visual Studio Code, but it is now supported by a large number of editors.

The concrete goals of this projects (details also depending on whether selected as a 175h or 350h project):

  • Syntax highlighting for equations via a custom TextMate grammar
  • Implementation of an LSP plugin for Visual Studio Code, and an LSP server implementation, to provide features such as autocompletion, hover information, jump to definition, etc.
  • The above plugin will first made to work on external files with a dedicated file extension, and then for strings within a Brian script (as an “embedded language”).

Note that the LSP client plugin has to be written as JavaScript/TypeScript code, whereas the server implementation can be written either using JavaScript/TypeScript as well, or in Python.

Skill level: intermediate

Required skills: JavaScript/TypeScript, JSON, asynchronous programming, basic knowledge of grammars/regular expressions.

Time commitment: Flexible, 175h or 350h depending on scope

Lead mentor: Marcel Stimberg (@mstimberg on neurostars), Ben Evans

Hello @arnab1896 and @mstimberg,
I’m Chandraprakash Darji, I am React developer working on Webapp and websites and exploring open source. I like the project I love to explore in this project.I am very eager to learn more and more, I am looking to contribute to this project.

I was wondering if you could provide me with access to the Git repository for the project. This would allow me to explore the codebase, see what work has been done so far, and get a better sense of what still needs to be accomplished.

Thank you for your time and consideration. I look forward to hearing from you soon.

Hi @Chandraprakash-Darji . Thanks for your interest in the project! Apologies for missing links to the repository and other information, we should definitely have included those…
Here’s the general website of the Brian simulator: https://briansimulator.org
The github repository is here: GitHub - brian-team/brian2: Brian is a free, open source simulator for spiking neural networks.

For this specific project, the most important thing is the equation syntax, and I’d suggest to have a look at the examples to get an idea of how these equation strings look in practice.

Don’t hesitate to ask any questions that might come up!

Hello @mstimberg,

Thank you for getting back to me and providing the links to the Brian simulator website and GitHub repository. I appreciate the information and will take a look at the examples to better understand the equation syntax.

If I have any questions, I will definitely reach out to you for guidance. Thanks again for your time and support.

Best regards,
Chandraprakash-Darji

@mstimberg Is the project is started? I would like to look on it

Hi @Chandraprakash-Darji. Do you mean whether we already started at working on code editor support for Brian equations? If that’s your question: no, no work has been done on this yet so far. It would be started in this GSoC project.

Hello @mstimberg @arnab1896 I’m Sachin Sharma. I am very interested in working on the project to improve the editing features for Brian equations in Python scripts using the Language Server Protocol (LSP). I believe this project will make a significant contribution to the field of computational neuroscience by improving the ease and efficiency of defining and working with differential equations in Brian.

I have experience with JavaScript, JSON, Regular Expressions, and other web technologies. I would love the opportunity to contribute to this project and help enhance the user experience.

Please let me know if there is any additional information I can provide. Also, is this project still available.

I look forward to discussing this project further with you.

Thank You

Hi @Sachin. Thanks for your interest in the project. For now, please have a look at the material that I provided in an earlier comment. I will get back to you (and everyone else) on Monday with further information about the application process. In the meantime, don’t hesitate to ask any questions about the project or the Brian simulator in general that you might have.

All candidates can apply for all projects they are interested in until the final application deadline (April 4th), i.e. all projects remain “available” until then.

Hi everyone :wave:
I just published a general document about GsoC applications for Brian projects which explains a bit more how the application process works, please have a look!

I will be back on Monday with more details for the code editor support project.

@mstimberg thanks for sharing the application process. I will look into it.

Here are some more guidelines, specific to the application for this project:
In your application, please pay attention to, both, what the final result should look like from the user’s perspective, and how this can be achieved with the LSP mechanisms. For the user perspective, please go into details into what syntax highlighting would do to Brian equations, and what kind of things could be auto-completed, annotated, etc. For this part, do not worry about whether this would be achievable in the time frame of the project. For the implementation part, please go into details into how this would be implemented in practice, describing for example what kind of files need to be created, what type of functionality each of these files would implement, and a rough outline of how things would be packaged together in the end. Finally, please show some kind of short code example that implements any of the required functionality – note that this isn’t supposed to be code that you can actually run, but just a few lines of code taken out of context to give an idea of how e.g. code completion for some part of Brian’s syntax would be implemented in practice.

@mstimberg I’ve started working on the project proposal and I plan to share a link to the proposal document with you. This will allow you to review it and give me your feedback as needed, ensuring that the proposal meets your expectations and includes all necessary information.

Please let me know if this approach works for you. I’m eager to get started on this project and grateful for your guidance.

Hi @Sachin. Yes, please share a link as soon as you have something that you need feedback for. Either via a direct message here, or to marcel(dot)stimberg(at)inserm.fr

Sure. I will send you the link to the draft as soon as I have it ready for review. If I have any questions, I will reach out to you.

@mstimberg I wanted to let you know that I have sent you an email with the link to my proposal for this project. I would greatly appreciate your feedback on the work that I have done so far