Skip to content

Configure ide #11615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Configure ide #11615

wants to merge 9 commits into from

Conversation

th3linja
Copy link

Reference issue

Fixes #9112

What does this implement/fix?

Creating a page that steps through the various IDE settings that are helpful when contributing to MNE-Python.

Additional information

Picking up and resolving an idle ticket. Tried implementing some of the changes as suggested. Not sure if :menuselection: by Sphinx is working as rst is not displaying correctly for me when installing MNE right out of the box. May require additional setup to view it correctly.

**Fixed duplicate label

@larsoner
Copy link
Member

@th3linja you don't need to open a new PR for each new change, just push commits to your branch and they should show up on GitHub. cc @britta-wstnr this is why #11613 was closed I think

@larsoner larsoner added this to the 1.4 milestone Mar 31, 2023
@th3linja
Copy link
Author

@larsoner Sorry, I accidentally made a conflict when playing around with the code and couldn't find a way to revert it so I had to start anew.

Copy link
Member

@britta-wstnr britta-wstnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some changes to the text - @th3linja you can accept those changes right here on GitHub if you want (then you'd have to pull the changes to your local copy via git).

As mentioned in a comment to @mscheltienne's review: I wonder if the how to's for the different IDE's will be very hard to keep up-to-date. Things will be moved around in the Settings, I assume, and then we'd have to remember our list and compare periodically. Maybe we could only keep the list of things that is good to add to any IDE, but not mention how this should be done?
Thoughts?

Comment on lines 9 to 10
Thanks for taking the time to contribute! This guide steps through various IDE settings that are helpful when
contributing to MNE-Python.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Thanks for taking the time to contribute! This guide steps through various IDE settings that are helpful when
contributing to MNE-Python.
This guide steps through various IDE settings that are helpful when contributing to MNE-Python.

Given that this will land somewhere within the contributor's guide, I don't think we will need to add the thank you again.


Some of the basic settings include enabling linting, setting line margins, introspection, and docstring type:

* Linting - is the automated checking of your source code for programmatic and stylistic errors. Most of the time basic linting is already enabled but let's double check.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Linting - is the automated checking of your source code for programmatic and stylistic errors. Most of the time basic linting is already enabled but let's double check.
* Linting is the automated checking of your source code for programmatic and stylistic errors. Most of the time, basic linting is already enabled but it is a good idea to double check.


* Line margins - we have code style rules that forbid lines longer than 79 characters, so having a ruler at 79 characters helps coders adhere to that rule.

* Introspection - this helps removes trailing whitespaces that could be problematic when compiling or building
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Introspection - this helps removes trailing whitespaces that could be problematic when compiling or building
* Introspection helps by removing trailing whitespaces that can be problematic when compiling or building.

Comment on lines 16 to 20
* Line margins - we have code style rules that forbid lines longer than 79 characters, so having a ruler at 79 characters helps coders adhere to that rule.

* Introspection - this helps removes trailing whitespaces that could be problematic when compiling or building

* Docstring - we use NumPy because it supports a combination of reStructured and GoogleDocstrings and supported by Sphinx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Line margins - we have code style rules that forbid lines longer than 79 characters, so having a ruler at 79 characters helps coders adhere to that rule.
* Introspection - this helps removes trailing whitespaces that could be problematic when compiling or building
* Docstring - we use NumPy because it supports a combination of reStructured and GoogleDocstrings and supported by Sphinx
* Line margins - we have code style rules that forbid lines longer than 79 characters, so having a ruler at 79 characters helps coders adhere to that rule.
* Introspection - this helps removes trailing whitespaces that could be problematic when compiling or building
* Docstring - we use NumPy because it supports a combination of reStructured and GoogleDocstrings and is supported by Sphinx

I think this bullet point also could have a bit more information.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the last one on "Docstring" that is - just seeing now GitHub shows the previous ones in the view here too 🙃 )

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will get to it as soon as I can.

------

* :menuselection:`Command Palette (Ctrl + Shift + P) --> Lint --> Python: Enable/Disable Linting (click on Enable)`
* :menuselection:`Use ``python.autoComplete.preloadModules": ["numpy", "pandas", "matplotlib", "mne"]```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really still a thing with Pylance?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just continuing off from the work that was left unattended for a while. Not sure what versioning was in place when the instructions were last created. Let me know if there needs to be a change.

@th3linja
Copy link
Author

th3linja commented Apr 4, 2023

I've made some changes to reflect the suggestions made. Let me know what you think. Also if someone using VSCode could double down on the steps with their IDE version, that would be great.

@britta-wstnr
Copy link
Member

Given @hoechenberger's latest comment and before we venture further, can I raise the point again that I raised above and that @mscheltienne seemed to agree with?
I think giving such specific settings for IDEs will be very hard to keep up-to-date - so, do we want to do that? Or do we want to keep this more general, i.e. mention what settings are useful but not give directions on how to set them in different IDE's.

Pinging @larsoner @hoechenberger and @drammock who opened the original issue.

@drammock
Copy link
Member

drammock commented Apr 4, 2023

mention what settings are useful but not give directions on how to set them in different IDE's

+1. I imagine something like this would be more future-proof:

With the right configuration, using an Integrated Development Environment (IDE) can make contributing to MNE-Python much easier.
This page describes the most common IDE settings that are recommended for MNE-Python contributors.

## syntax highlighting
<most users find it helpful, usually enabled by default, if not search "python syntax highlight [name of IDE]" to learn how to do it.>

## Linting
<describe what linting is, mention what linter we use.>

### Rulers
<describe what & why of rulers>

### Line endings and whitespace
<4 spaces (not tabs), LF not CRLF (also mention relevant git setting), trailing whitespace,
 trailing newlines at EOF, whitespace around classes/functions/methods, whitespace in docstrings.>

### code completion / introspection
<what & how; should probably mention at least jedi and pylance>

## Configuring Specific IDEs

### Spyder
<general comments about which config sections to look in for things (tools -> preferences -> { completion and linting | source code | advanced settings } ) but don't try to say exactly what is found where.>

### VSCode
<which extensions should be installed, general comments about how to configure this IDE (GUI dialog vs config JSON file)>

### Pycharm
<similar advice to Spyder / VSCode>

@britta-wstnr
Copy link
Member

Hi @th3linja, I agree with @drammock's suggestion to update this - are you able to work on this? 🙂

@th3linja
Copy link
Author

For sure! I'll send an update as soon as I get the chance.

@larsoner larsoner modified the milestones: 1.4, 1.5 Apr 21, 2023
@th3linja
Copy link
Author

Hi all, I made some revisions. Let me know how it looks!


Rulers
^^^^^^
We have code style rules that forbid lines longer than 79 characters, so having a ruler at 79 characters helps coders
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We have code style rules that forbid lines longer than 79 characters, so having a ruler at 79 characters helps coders
We have code style rules that forbid lines longer than 88 characters, so having a ruler at 88 characters helps coders

I would mention that MNE uses black for enforcing a code style.

Syntax Highlighting
^^^^^^^^^^^^^^^^^^^
Syntax highlighting is a feature that determines the color and style of source code displayed in the IDE. Most users
find it helpful and is usually enabled by default. If not, search "python syntax highlight [name of IDE]" to learn how
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find it helpful and is usually enabled by default. If not, search "python syntax highlight [name of IDE]" to learn how
find it helpful and it is usually enabled by default. If not, search "python syntax highlight [name of IDE]" to learn how

Comment on lines +25 to +29
Linting
^^^^^^^
Linting is the automated checking of your source code for programmatic and stylistic errors. Most of the time, basic
linting is already enabled but it is a good idea to double-check. Search "python [name of IDE] linting" to learn how to
configure it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would mention black here.

Comment on lines +68 to +70
.. note:: The IDE configurations recommended below are not catered towards specified versions of the IDE, but rather a
general guide of where these settings may be found regardless of versioning.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this now that there are no details below.

@larsoner larsoner modified the milestones: 1.5, 1.6 Jul 31, 2023
@wmvanvliet
Copy link
Contributor

Should I add Vim to this list or would that be overly archaic?

@larsoner larsoner modified the milestones: 1.6, 1.7 Nov 16, 2023
@larsoner larsoner modified the milestones: 1.7, 1.8 Apr 9, 2024
@larsoner larsoner modified the milestones: 1.8, 1.9 Jul 15, 2024
@larsoner larsoner modified the milestones: 1.9, 1.10 Dec 9, 2024
@larsoner larsoner modified the milestones: 1.10, 1.11 Jun 26, 2025
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.

ENH: IDE configuration docs
7 participants