EEGPrep is a Python package that reproduces the EEGLAB default preprocessing pipeline with numerical accuracy down to 1e-5 uV, including clean_rawdata and ICLabel, enabling MATLAB-to-Python equivalence for EEG analysis. It takes BIDS data as input and produces BIDS derivative dataset as output, which can then be reimported into other packages as needed (EEGLAB, Fieldtrip, Brainstorm, MNE). It does produce plots. The package will be fully documented for conversion, packaging, and testing workflows, with installation available via PyPI.
EEGPrep is currently in a pre-release phase. It functions end-to-end (bids branch) but has not yet been tested with multiple BIDS datasets. The documentation is incomplete, and use is at your own risk. The planned release is scheduled for the end of 2025.
To install the complete EEGPrep including the ICLabel classifier (which can pull in ~7GB of binaries on Linux), use the following line:
pip install eegprep[all]
To install the lean version:
pip install eegprep
You can then manually install a lightweight CPU-only version of PyTorch if desired by your operating system.
The MATLAB and Python implementations were compared using the first two subjects from the BIDS datasets ds003061 and ds002680 available on NEMAR. The observed differences were extremely small, with the largest (during HighpassFilter) below 0.002, indicating excellent numerical consistency between the two implementations.
 
docker run --rm -it -v $(pwd):/usr/src/project dtyoung/eegprep /bin/bash
docker run -u root --rm -it -v $(pwd):/usr/src/project dtyoung/eegprep /bin/bash
docker rmi dtyoung/eegprep
Mounted folder in /usr/src/project
Use the release script for streamlined releases:
python scripts/make_release.pyThe script will:
- Check prerequisites (build, twine, git status)
- Confirm the version from pyproject.toml
- Let you choose: test release, production release, or both
- Build and upload the package (automatically uses eegprep_testname for TestPyPI)
- Create and push git tags for production releases
Note: The script automatically handles a TestPyPI naming conflict by building a package with the name
eegprep_testfor test releases.
Install build tools:
pip install build twine- Get API token for PyPI and TestPyPI (both maintainers should have these)
- Twine will prompt for them during upload
- Store them in ~/.pypircfor convenience
Recommended: Use scripts/make_release.py instead to avoid manual errors with package naming.
If you need to release manually:
1. Update version in pyproject.toml
2. Test release (staging):
Note: A former maintainer owns the
eegpreppackage name on TestPyPI, so you will not be able to post a package namedeegprepthere at this time. To work around this when performing the build manually (note themake_release.pyscript handles this for you), temporarily change the package name toeegprep_testinpyproject.tomlbefore building. Remember to change it back toeegprepafter uploading!
# In pyproject.toml, temporarily change: name = "eegprep" to name = "eegprep_test"
python -m build
python -m twine upload --repository testpypi dist/*
# Change name back to "eegprep" in pyproject.toml
# Test the installation:
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ eegprep_test==X.Y.Z
# (imports still work as 'import eegprep')3. Production release:
python -m twine upload dist/*
git tag -a vX.Y.Z -m "Release version X.Y.Z"
git push origin vX.Y.Z
pip install eegprep==X.Y.Zhttps://packaging.python.org/en/latest/tutorials/packaging-projects/
Packaging was done following the tutorial: https://packaging.python.org/en/latest/tutorials/packaging-projects/ with setuptools
To install the package with all optional dependencies, run:
pip install eegprep[all]
Install MATLAB interface pip install /your/path/to/matlab/extern/engines/python
Use tests/main_compare.m
This project uses unittest. You can run tests from the project root via the command:
python -m unittest discover -s tests
...or use the unittest integration in your IDE (e.g., PyCharm, VS Code, or Cursor).
- Arnaud Delorme, UCSD, CA, USA
- Christian Kothe, Intheon, CA, USA
- Bruno Aristimunha Pinto, Inria, France