Skip to content

Commit

Permalink
Remove unnecessary dependencies (#325)
Browse files Browse the repository at this point in the history
* Bump to Python 3.9.

* Remove unused dependencies.

* Update lint.yml

* Update asl.py

* Copy some stuff from fMRIPrep.

* Drop database dir.

* Update base.py

* Try out new regex.

* Require nipy dependencies for nipype.

* Update .readthedocs.yaml
  • Loading branch information
tsalo authored Sep 27, 2023
1 parent c0fa24e commit 9437ba8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ jobs:
run: python -m pip install \
flake8 flake8-absolute-import flake8-black flake8-docstrings \
flake8-isort flake8-pyproject flake8-unused-arguments \
flake8-use-fstring flake8-warnings pep8-naming
flake8-use-fstring pep8-naming
- name: Check aslprep
run: python -m flake8 aslprep
10 changes: 1 addition & 9 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.8"
python: "3.9"

sphinx:
configuration: docs/conf.py

build:
os: ubuntu-22.04
tools:
python: "3.8"
jobs:
post_checkout:
- git fetch --unshallow

python:
install:
- method: pip
Expand Down
28 changes: 21 additions & 7 deletions aslprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,23 +390,37 @@ def init(cls):
import re

from bids.layout import BIDSLayout
from bids.layout.index import BIDSLayoutIndexer

work_dir = cls.work_dir / "bids.db"
work_dir.mkdir(exist_ok=True, parents=True)
cls._layout = BIDSLayout(
str(cls.bids_dir),
# Recommended after PyBIDS 12.1
_indexer = BIDSLayoutIndexer(
validate=False,
# database_path=str(work_dir),
ignore=(
"code",
"stimuli",
"sourcedata",
"models",
"derivatives",
re.compile(r"^\."),
re.compile(r"\/\.\w+|^\.\w+"),
re.compile(
r"sub-[a-zA-Z0-9]+(/ses-[a-zA-Z0-9]+)?/(beh|dwi|eeg|ieeg|meg|func)"
),
),
)
cls._layout = BIDSLayout(
str(cls.bids_dir),
indexer=_indexer,
)

cls.layout = cls._layout
if cls.bids_filters:
from bids.layout import Query

# unserialize pybids Query enum values
for acq, filters in cls.bids_filters.items():
cls.bids_filters[acq] = {
k: getattr(Query, v[7:-4]) if not isinstance(v, Query) and "Query" in v else v
for k, v in filters.items()
}


# These variables are not necessary anymore
Expand Down
6 changes: 5 additions & 1 deletion aslprep/utils/asl.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ def select_processing_target(aslcontext):
"""Determine how to handle ASL and M0 data based on dataset configuration."""
import pandas as pd

aslcontext_df = pd.read_table(aslcontext)
try:
aslcontext_df = pd.read_table(aslcontext)
except:
raise ValueError(aslcontext)

voltypes = aslcontext_df["volume_type"].tolist()

if "control" in voltypes and "label" in voltypes:
Expand Down
2 changes: 1 addition & 1 deletion aslprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def init_single_subject_wf(subject_id):
"""
name = f"single_subject_{subject_id}_wf"
subject_data, layout = collect_data(
config.execution.bids_dir,
config.execution._layout,
subject_id,
bids_filters=config.execution.bids_filters,
)
Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,27 @@ classifiers = [
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Image Recognition",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
]
license = {file = "LICENSE.md"}
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
'importlib_resources; python_version < "3.9"',
'importlib_resources; python_version < "3.10"',
"indexed_gzip >= 0.8.8",
"jinja2 < 3.1",
"looseversion == 1.0.3",
"networkx ~= 2.8.8", # nipype needs networkx, but 3+ isn"t compatible with nipype 1.8.5
"nibabel >= 3.0",
"niflow-nipype1-workflows",
"nilearn == 0.10.0",
"nipype >= 1.8.5",
"nitime",
"nipype[nipy] >= 1.8.5",
"nitransforms >= 21.0.0",
"niworkflows ~= 1.7.3",
"numpy >= 1.17.3",
"pandas >= 0.24.0",
"patsy",
"psutil >= 5.4",
"pybids >= 0.13.2",
"pyslim",
"pyyaml",
"sdcflows",
"sentry-sdk >= 0.6.9",
Expand Down

0 comments on commit 9437ba8

Please sign in to comment.