Skip to content
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

build: moved to pyproject.toml/poetry #190

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,30 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - --preview

# Install wxPython wheels since they are distribution-specific and therefore not on PyPI
# See: https://wxpython.org/pages/downloads/index.html
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython

pip install .
poetry install

- name: Build docs
run: |
cd doc && make html

- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master' # TODO: Deploy seperate develop-version of docs?
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: doc/_build/html

51 changes: 24 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python_version: [3.7]
include:
- os: ubuntu-latest
python_version: 3.8
python_version: [3.8]
#include:
# - os: ubuntu-latest
# python_version: 3.8
# Experimental: Python 3.9
# Works fine, commented out because mostly covered (at least installing/building deps) by the typecheck job
# See issue: https://github.com/NeuroTechX/eeg-notebooks/issues/50
Expand All @@ -26,17 +26,20 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}

# Not needed if pywinhook is installed from wheels
#- name: Install swig
# if: "startsWith(runner.os, 'windows')"
# run: |
# (New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.0.1.zip","swigwin-4.0.1.zip");
# Expand-Archive .\swigwin-4.0.1.zip .;
# echo "$((Get-Item .).FullName)/swigwin-4.0.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
#
- name: Install APT dependencies
if: "startsWith(runner.os, 'Linux')"
run: |
Expand All @@ -46,22 +49,17 @@ jobs:
# libgtk-3-dev is a requirement for wxPython
# freeglut3-dev is a requirement for a wxPython dependency
sudo apt-get -y install xvfb libgtk-3-dev freeglut3-dev
- name: Install Linux dependencies
if: "startsWith(runner.os, 'Linux')"

- name: Install poetry
run: |
python -m pip install --upgrade pip wheel
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - --preview
poetry config virtualenvs.create false

# Install wxPython wheels since they are distribution-specific and therefore not on PyPI
# See: https://wxpython.org/pages/downloads/index.html
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython

pip install .
- name: Install MacOS/Windows dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install .
pip install -U psychtoolbox # JG_ADD
# EB: needed?
poetry install

- name: Run eegnb install test
shell: bash
run: |
Expand All @@ -71,6 +69,7 @@ jobs:
fi
eegnb --help
eegnb runexp --help

- name: Run examples with coverage
shell: bash
run: |
Expand All @@ -94,6 +93,7 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}

- name: Install APT dependencies
if: "startsWith(runner.os, 'Linux')"
run: |
Expand All @@ -103,21 +103,18 @@ jobs:
# libgtk-3-dev is a requirement for wxPython
# freeglut3-dev is a requirement for a wxPython dependency
sudo apt-get -y install xvfb libgtk-3-dev freeglut3-dev
- name: Install Linux dependencies
if: "startsWith(runner.os, 'Linux')"

- name: Install poetry
run: |
python -m pip install --upgrade pip wheel
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - --preview
poetry config virtualenvs.create false

# Install wxPython wheels since they are distribution-specific and therefore not on PyPI
# See: https://wxpython.org/pages/downloads/index.html
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython

pip install .
- name: Install MacOS/Windows dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install .
poetry install

- name: Typecheck
run: |
# Exclude visual_cueing due to errors
python -m mypy --exclude 'examples/visual_cueing'
mypy --exclude 'examples/visual_cueing'
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "GSOC-eeg-notebooks"]
path = GSOC-eeg-notebooks
url = https://github.com/Parvfect/GSOC-eeg-notebooks
1 change: 1 addition & 0 deletions GSOC-eeg-notebooks
Submodule GSOC-eeg-notebooks added at e0514d
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ EEG-Notebooks
.. image:: https://github.com/NeuroTechX/eeg-notebooks/raw/master/doc/img/eeg-notebooks_logo.png
:align: center

EEG-Notebooks is a collection of classic EEG experiments, implemented in Python 3 and Jupyter notebooks. The experimental protocols and analyses are quite generic, but are primarily taylored for low-budget / consumer EEG hardware such as the InteraXon MUSE and OpenBCI Cyton. The goal is to make cognitive neuroscience and neurotechnology more accessible, affordable, and scalable.
EEG-Notebooks is a collection of classic EEG experiments, implemented in Python 3 and Jupyter notebooks. The experimental protocols and analyses are quite generic, but are primarily tailored for low-budget / consumer EEG hardware such as the InteraXon MUSE and OpenBCI Cyton. The goal is to make cognitive neuroscience and neurotechnology more accessible, affordable, and scalable.

- **For an intro talk on the eeg-notebooks project see:** `JG's Brainhack Ontario 2020 presentation <https://www.crowdcast.io/e/brainhack-ontario/7>`_.
- **For documentation see:** `documentation site <https://neurotechx.github.io/eeg-notebooks/index.html>`_.
Expand Down Expand Up @@ -64,7 +64,7 @@ Check the `changelog <https://neurotechx.github.io/eeg-notebooks/changelog.html>
Acknowledgments
----------------

EEG-Notebooks was created by the `NeurotechX <https://neurotechx.com/>`_ hacker/developer/neuroscience community. The ininitial idea and majority of the groundwork was due to Alexandre Barachant - including the `muse-lsl <https://github.com/alexandrebarachant/muse-lsl/>`_ library, which is core dependency. Lead developer on the project is now `John Griffiths <www.grifflab.com>`_ .
EEG-Notebooks was created by the `NeurotechX <https://neurotechx.com/>`_ hacker/developer/neuroscience community. The initial idea and majority of the groundwork was due to Alexandre Barachant - including the `muse-lsl <https://github.com/alexandrebarachant/muse-lsl/>`_ library, which is core dependency. Lead developer on the project is now `John Griffiths <www.grifflab.com>`_ .

Key contributors include: Alexandre Barachant, Hubert Banville, Dano Morrison, Ben Shapiro, John Griffiths, Amanda Easson, Kyle Mathewson, Jadin Tredup, Erik Bjäreholt.

Expand Down
23 changes: 19 additions & 4 deletions doc/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Installation

EEG-Notebooks is a Python library. It runs on all major operating systems (Windows, Linux, Mac).

If you do not have Python installed, or are not particularly familiar with using it, then we highly recommend downloading and installing the Miniconda(3) Python(3) distribution. For users who prefer to use `VirtualEnv` (`venv`) than `conda` for Python environment management, we provide equivalent installation and usage instructions where relevant.
If you do not have Python installed, or are not particularly familiar with using it, then we highly recommend downloading and installing the Miniconda(3) Python(3) distribution. For users who prefer to use `VirtualEnv` (`venv`) or `poetry` instead of `conda` for Python environment management, we provide equivalent installation and usage instructions where relevant.


The principal purpose of EEG-Notebooks is to allow users to run and create cognitive neuroscience experiments using consumer-grade EEG systems. A secondary, complementary, purpose of the tool is to provide various functionalities for the organization, analysis and visualization of the data collected in these experiments.
Expand All @@ -31,11 +31,11 @@ As may be expected, the installation and setup steps for mode 2 are simpler than
Installing the Python library
===============================

We highly recommend making use of a virtual environment (either `conda` or `virtualenv`) when installing eeg-notebooks.
We highly recommend making use of a virtual environment (either `conda`, `poetry`, or `virtualenv`) when installing eeg-notebooks.

If you don't already have a Python installation, grab the latest `miniconda` version for your operating system from here (https://docs.conda.io/en/latest/miniconda.html).

Use the following commands to download the repo, create and activate a conda or virtualenv virtual environment:
Use the following commands to download the repo, create and activate a conda, poetry, or virtualenv virtual environment:


.. tabs::
Expand All @@ -48,12 +48,27 @@ Use the following commands to download the repo, create and activate a conda or

conda activate "eeg-notebooks"

conda install git

conda install pip

git clone https://github.com/NeuroTechX/eeg-notebooks

cd eeg-notebooks

pip install -e .

.. tab:: Poetry

.. code-block:: bash

git clone https://github.com/NeuroTechX/eeg-notebooks

cd eeg-notebooks

poetry install

poetry shell

.. tab:: Virtualenv

Expand Down
28 changes: 19 additions & 9 deletions eegnb/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@

from eegnb.devices.eeg import EEG

from eegnb.experiments.visual_n170 import n170
from eegnb.experiments.visual_p300 import p300
from eegnb.experiments.visual_ssvep import ssvep
from eegnb.experiments import VisualN170
from eegnb.experiments import VisualP300
from eegnb.experiments import VisualSSVEP
from eegnb.experiments import AuditoryOddball
from eegnb.experiments.visual_cueing import cueing
from eegnb.experiments.visual_codeprose import codeprose
from eegnb.experiments.auditory_oddball import aob, diaconescu
from eegnb.experiments.auditory_oddball import diaconescu
from eegnb.experiments.auditory_ssaep import ssaep, ssaep_onefreq


# New Experiment Class structure has a different initilization, to be noted
experiments = {
"visual-N170": n170,
"visual-P300": p300,
"visual-SSVEP": ssvep,
"visual-N170": VisualN170(),
"visual-P300": VisualP300(),
"visual-SSVEP": VisualSSVEP(),
"visual-cue": cueing,
"visual-codeprose": codeprose,
"auditory-SSAEP orig": ssaep,
"auditory-SSAEP onefreq": ssaep_onefreq,
"auditory-oddball orig": aob,
"auditory-oddball orig": AuditoryOddball(),
"auditory-oddball diaconescu": diaconescu,
}

Expand All @@ -42,7 +44,15 @@ def run_experiment(
):
if experiment in experiments:
module = experiments[experiment]
module.present(duration=record_duration, eeg=eeg_device, save_fn=save_fn) # type: ignore

# Condition added for different run types of old and new experiment class structure
if experiment == "visual-N170" or experiment == "visual-P300" or experiment == "visual-SSVEP" or experiment == "auditory-oddball orig":
module.duration = record_duration
module.eeg = eeg_device
module.save_fn = save_fn
module.run()
else:
module.present(duration=record_duration, eeg=eeg_device, save_fn=save_fn) # type: ignore
else:
print("\nError: Unknown experiment '{}'".format(experiment))
print("\nExperiment can be one of:")
Expand Down