Skip to content

Commit 852391b

Browse files
committed
[MAINT] Optional imports (#42)
* [MAINT] Optional imports * try optional deps * try again * try again * Update setup.cfg * try again * try again * try again * Update README.md
1 parent 143ed14 commit 852391b

File tree

7 files changed

+31
-15
lines changed

7 files changed

+31
-15
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,19 @@ jobs:
1414
strategy:
1515
max-parallel: 4
1616
matrix:
17-
python-version: [3.6, 3.7, 3.8]
17+
python-version: [3.6, 3.7, 3.8, 3.9]
1818

1919
steps:
2020
- uses: actions/checkout@v1
2121
- name: Set up Python ${{ matrix.python-version }}
2222
uses: actions/setup-python@v1
2323
with:
2424
python-version: ${{ matrix.python-version }}
25-
- name: Install dependencies
25+
- name: Install meegkit and dependencies
2626
run: |
2727
python -m pip install --upgrade pip
2828
pip install -r requirements.txt
29-
pip install git+https://github.com/pymanopt/pymanopt
30-
- name: Install meegkit
31-
run: |
32-
pip install -e .
29+
pip install -e ".[extra]"
3330
- name: Lint with flake8
3431
run: |
3532
make pep

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ python:
1212
install:
1313
- sudo apt-get update
1414
- pip install -r requirements.txt
15-
- pip install -e .
16-
- pip install git+https://github.com/pymanopt/pymanopt
15+
- pip install -e ".[extra]"
1716
script:
1817
- mkdir docs
1918
- cd doc

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,29 @@ This package can be installed easily using `pip+git`:
2424
pip install git+https://github.com/nbara/python-meegkit.git
2525
```
2626

27-
Or you can clone this repository and run the following command inside the `python-meegkit` directory:
27+
Or you can clone this repository and run the following commands inside the `python-meegkit` directory:
2828

2929
```bash
30+
pip install -r requirements.txt
3031
pip install .
3132
```
3233

3334
*Note* : Use developer mode with the `-e` flag (`pip install -e .`) to be able to modify the sources even after install.
3435

36+
### Advanced installation instructions
37+
38+
Some ASR variants require additional dependencies such as `pymanopt`. To install meegkit with these optional packages, use:
39+
40+
```bash
41+
pip install -e '.[extra]'
42+
```
43+
44+
or:
45+
46+
```bash
47+
pip install git+https://github.com/nbara/python-meegkit.git#egg=meegkit[extra]
48+
```
49+
3550
## References
3651

3752
### 1. CCA, STAR, SNS, DSS, ZapLine, and robust detrending

meegkit/utils/covariances.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
"""Covariance calculation."""
22
import numpy as np
3-
import pymanopt
4-
from pymanopt import Problem
5-
from pymanopt.manifolds import Grassmann
6-
from pymanopt.solvers import TrustRegions
73
from scipy import linalg
84

95
from .base import mldivide
@@ -445,6 +441,11 @@ def nonlinear_eigenspace(L, k, alpha=1):
445441
Analysis and Applications, 36(2), 752-774, 2015.
446442
447443
"""
444+
import pymanopt
445+
from pymanopt import Problem
446+
from pymanopt.manifolds import Grassmann
447+
from pymanopt.solvers import TrustRegions
448+
448449
n = L.shape[0]
449450
assert L.shape[1] == n, 'L must be square.'
450451

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ codespell
1212
pydocstyle
1313
tqdm
1414
statsmodels
15-
git+git://github.com/alexandrebarachant/pyRiemann
15+
pyriemann @ git+https://github.com/alexandrebarachant/pyRiemann

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ all_files = 1
1717

1818
[upload_sphinx]
1919
upload-dir = doc/_build/html
20+
21+
[options.extras_require]
22+
extra = pymanopt @ git+https://github.com/pymanopt/pymanopt@master
23+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
description='M/EEG denoising in Python',
88
url='http://github.com/nbara/python-meegkit/',
99
author='N Barascud',
10-
author_email='nicolas.barascud@ens.fr',
10+
author_email='nicolas.barascud@gmail.com',
1111
license='UNLICENSED',
1212
version='0.1.1',
1313
packages=find_packages(exclude=['doc', 'tests']),

0 commit comments

Comments
 (0)