Hi I recently have set up the entire mne-python repo for starting to contribute in the same however even after going through the docs I don’t understand how do I run the project on my local machine?
Also, how do I test the individual module in it or run the entire project together
My apologies for such a rookie question
Hello,
When working on a project from source, you can install it in an environment in editable mode.
Step 1: Create a dedicated environment and activate it. Your console line should look like:
(env_name) $
Step 2: Install the repository in editable mode. From inside the cloned folder mne-python
, run pip install -e .
. The .
represents the path, in this case, the current directory.
With an editable install, all the changes to the code are live, i.e. you don’t need to reinstall the repository for them to apply.
Step 3: Install optional dependencies, e.g. for testing pip install -r requirements_testing.txt
and pip install -r requirements_testing_extra.txt
. (again, the arguments are path, so I assume you are inside the mne-python
folder).
You can also run the command mne sys_info
to figure out which extra dependencies you want to install.
Step 4: Run the test, from inside the cloned folder mne-python
, pytest mne
. Or if you want only one module, e.g. preprocessing
: pytest mne/preprocessing
.
Good luck!
Mathieu
thank you so much for your reply! actually i was trying to work on this issue Add anchors and / or tick labels to our QSlider and QFloatSlider instances · Issue #10254 · mne-tools/mne-python · GitHub
So I was looking at this issue to work out on and couldn’t understand where do I run the UI of it on my local machine so I could I add this feature as I did use the pytest
for testing however that just tested various modules like in the image I’ve attached. So thus I thought I am doing something wrong as I couldn’t get what should I do? Please help me out…
As mentionned on the GitHub issue, you should look at the mne/viz/_brain
code for this one, specifically to the _Slider
and QFloatSlider
objects defined here:
In the screenshot you shared, you most likely ran the test suit on the entire repository with pytest mne
.
Instead you can run it on the module you are modifying, in this case viz
, with pytest mne/viz
(assuming you run this command from the mne-python
cloned directory).
I’m not sure why you would clone the repository in /opt
(or is this an install from the MNE installers instead of an install in the editable mode of the cloned repo?).
Anyway, at the end of the test-run, pytest
writes a file junit-results.xml
with the results, and here it can not because of a permission error. A quick sudo chmod 777 -R /opt/mne-python
will fix it.
My apologies but I tried to follow the documentation and it says that I need to change my directory to the
$INSTALL_LOCATION
which is /opt
and clone repo there.I am not sure which step I skipped there or what was the issue?
First, edit these two variables for your situation:
[…]
Pick where to put your local copy of MNE-Python
This is an example location, for instance I prefer to put my cloned repository in ~/git
(under my user directory). It doesn’t really matter where you clone it, but I’m a bit surprised the git clone
command worked without a sudo
since you probably did not have permission to write in the /opt
directory.
On Linux, you can set the ownership of a directory/file with chown
and the permission of a directory/file with chmod
. More information here: https://www.cyberciti.biz/faq/how-to-use-chmod-and-chown-command/
EDIT: And no need to apologize, please ask all the questions you have
Got it! And thanks for the explanation. Just one last question, since the issue I am planning to work on is based on adding an Anchor so how do I check the changes made in the UI? like which command should I run for that?
Very good question… and actually I don’t know how to make a test that validates the presence of a UI element. A test can be used to validate interactive aspects of a GUI (e.g. that a button initiates the expected chain of events), but I don’t know to do it for visual aspects.
IMO, implementing the change, doing a visual inspection yourself, and checking that it did not break any of the existing unit tests will be good enough.