Skip to content

Commit

Permalink
[FIX] pin keras and fix make file (#197)
Browse files Browse the repository at this point in the history
* fix some bugs

* use import linter

* do not use pkg resource

* do not treat warnings as errors

* drop python 3.8

* fix import linter
  • Loading branch information
Remi-Gau authored Mar 15, 2024
1 parent 170a3c3 commit e7e4028
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_and_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest] # windows-latest: do not work. antspyx is not available for windows
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11']
exclude:
- os: macOS-latest # anstpyx install is messed up with macOS and python 3.9
python-version: '3.9'
Expand Down
24 changes: 23 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ repos:
- id: yamlfmt
args: [--mapping, '4', --sequence, '4', --offset, '0']

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-toml
args: [--autofix, --indent, '4']

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
hooks:
Expand All @@ -31,13 +37,25 @@ repos:
hooks:
- id: flynt

- repo: https://github.com/seddonym/import-linter
rev: v2.0
hooks:
- id: import-linter

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile, black]

- repo: https://github.com/psf/black
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==24.2.0

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0
hooks:
- id: black
Expand Down Expand Up @@ -70,3 +88,7 @@ repos:
exclude: tests_.*.py|version.*.py|setup.py # ignore tests and versioneer related code
args: [--verbose]
additional_dependencies: [flake8-docstrings]


ci:
autoupdate_commit_msg: 'chore: update pre-commit hooks'
11 changes: 8 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,25 @@ identifiers:
value: "10.5281/zenodo.7493322"

contact:
- affiliation: "Université catholique de Louvain"
email: remi.gau@uclouvain.be
- affiliation: "McGill university"
email: remi.gau2@mcgill.ca
family-names: Gau
given-names: Rémi

authors:
- family-names: "Gau"
given-names: "Rémi"
orcid: "https://orcid.org/0000-0002-1535-9767"
affiliation: "Université catholique de Louvain"
affiliation: "McGill university"

- family-names: "Cabee"
given-names: "Pauline"

- family-names: "Yang"
given-names: "Ying"
orcid: "https://orcid.org/0000-0002-4157-2975"
affiliation: "Université catholique de Louvain"

license: GPL-3.0

keywords:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ dist: clean ## builds source and wheel package
clean-models: ## remove pretrained models
rm -fr models/

models: ## gets all pretrained models from OSF
bidsmreye_model --model_name all
models:
bidsmreye_model --model_name 1to6
models/dataset1_guided_fixations.h5:
bidsmreye_model
models/dataset2_pursuit.h5:
Expand Down
8 changes: 5 additions & 3 deletions bidsmreye/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import argparse
import sys
import warnings
from importlib import resources
from pathlib import Path
from typing import IO, Any

import pkg_resources
import pooch
import rich

import bidsmreye
from bidsmreye.defaults import available_models, default_model
from bidsmreye.logging import bidsmreye_log

Expand Down Expand Up @@ -98,8 +99,9 @@ def download(
base_url="https://osf.io/download/",
registry=None,
)
registry_file = pkg_resources.resource_stream("bidsmreye", "models/registry.txt")
POOCH.load_registry(registry_file)
source = resources.files(bidsmreye).joinpath("models/registry.txt")
with resources.as_file(source) as registry_file:
POOCH.load_registry(registry_file)

output_file = output_dir.joinpath(f"dataset_{model_name}")

Expand Down
135 changes: 82 additions & 53 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,51 @@ build-backend = "hatchling.build"
requires = ["hatchling", "hatch-vcs"]

[project]
name = "bidsmreye"
description = "bids app using deepMReye to decode eye motion for fMRI time series data"
readme = "README.md"
requires-python = ">=3.8.0"
license = { file="LICENSE" }
authors = [
{ name = "Remi Gau", email = "remi.gau@gmail.com" },
{name = "Remi Gau", email = "remi.gau@gmail.com"}
]
keywords = [
"BIDS",
"brain imaging data structure",
"neuroimaging",
"automated pipeline",
"MRI",
"Eyetracking",
"Machine learning",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Image Processing",
"Topic :: Scientific/Engineering :: Image Processing"
]
dependencies = [
"attrs",
"chevron",
"deepmreye",
"chevron>=0.14.0",
"deepmreye>=0.2.1",
"kaleido",
"pooch>=1.6.0",
"pybids",
"rich",
"tqdm",
"tomli; python_version < '3.11'"
"tomli; python_version < '3.11'",
"keras<3.0.0"
]
description = "bids app using deepMReye to decode eye motion for fMRI time series data"
dynamic = ["version"]
keywords = [
"BIDS",
"brain imaging data structure",
"neuroimaging",
"automated pipeline",
"MRI",
"Eyetracking",
"Machine learning"
]
license = {file = "LICENSE"}
name = "bidsmreye"
readme = "README.md"
requires-python = ">=3.9.0"

[project.optional-dependencies]
dev = ["bidsmreye[doc,test,style]"]
# also stored in docs/requirements.txt
# to speed up readthedocs build
doc = [
Expand All @@ -56,9 +57,10 @@ doc = [
"sphinx",
"sphinx-argparse",
"sphinx-copybutton",
"sphinx-rtd-theme",
"sphinx-rtd-theme"
]
style =[
docs = ["bidsmreye[doc]"]
style = [
"black",
"codespell",
"flake8",
Expand All @@ -67,24 +69,30 @@ style =[
'types-all',
'pandas-stubs',
"pre-commit",
"sourcery",
"sourcery"
]
test = [
"pytest",
"pytest-cov",
"pytest-cov"
]
dev = ["bidsmreye[doc,test,style]"]
docs = ["bidsmreye[doc]"]
tests = ["bidsmreye[test]"]

[project.urls]
Homepage = "https://github.com/cpp-lln-lab/bidsMReye"
"Bug Tracker" = "https://github.com/cpp-lln-lab/bidsMReye/issues"

[project.scripts]
bidsmreye = "bidsmreye.bidsmreye:cli"
bidsmreye_model = "bidsmreye.download:cli"

[project.urls]
"Bug Tracker" = "https://github.com/cpp-lln-lab/bidsMReye/issues"
Homepage = "https://github.com/cpp-lln-lab/bidsMReye"

[tool.black]
line-length = 90

[tool.codespell]
builtin = "clear,rare"
ignore-words-list = "fo,slite"
skip = "*.svg,*.eps,.git,env,*build,.mypy*,outputs,.mypy_cache,moae_fmriprep,bidsmreye/templates/CITATION.bib"

[tool.hatch.build.hooks.vcs]
version-file = "bidsmreye/_version.py"

Expand All @@ -94,44 +102,49 @@ packages = ["bidsmreye"]
[tool.hatch.version]
source = "vcs"

[tool.black]
line-length = 90

[tool.codespell]
skip = "*.svg,*.eps,.git,env,*build,.mypy*,outputs,.mypy_cache,moae_fmriprep,bidsmreye/templates/CITATION.bib"
builtin = "clear,rare"
ignore-words-list = "fo,slite"
[tool.importlinter]
ignore_imports = [
"bidsmreye._version"
]
root_package = "bidsmreye"

[tool.vulture]
min_confidence = 70
paths = ["bidsmreye"]
sort_by_size = true
[[tool.importlinter.contracts]]
containers = "bidsmreye"
layers = [
"bidsmreye",
"prepare_data | generalize | download",
"quality_control",
"visualize",
"bids_utils",
"methods",
"utils",
"configuration",
"logging",
"defaults"
]
name = "Layered architecture"
type = "layers"

[tool.mypy]
exclude = ['tests/']
plugins = "pydantic.mypy"
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
exclude = ['tests/']
no_implicit_optional = true
plugins = "pydantic.mypy"
warn_redundant_casts = true
warn_unused_ignores = true

[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true

[[tool.mypy.overrides]]
ignore_errors = true
module = [
'bids.*',
"bidsmreye._version"
]
ignore_errors = true

[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
'attrs.*',
"bidsmreye._version",
Expand All @@ -142,9 +155,25 @@ module = [
'plotly.*',
'pooch.*',
'rich.*',
'scipy.*',
'scipy.*'
]
ignore_missing_imports = true

[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true

[tool.pytest.ini_options]
addopts = "--cov bidsmreye -ra -vv"
addopts = "--cov bidsmreye -ra --strict-config --strict-markers --doctest-modules --showlocals -s -vv --durations=0"
doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS"
junit_family = "xunit2"
log_cli_level = "INFO"
minversion = "6.0"
testpaths = ["tests"]
xfail_strict = true

[tool.vulture]
min_confidence = 70
paths = ["bidsmreye"]
sort_by_size = true

0 comments on commit e7e4028

Please sign in to comment.