Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into py3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Aug 1, 2024
2 parents dc1ac9a + 7435e94 commit 29f0540
Show file tree
Hide file tree
Showing 30 changed files with 278 additions and 191 deletions.
14 changes: 13 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,24 @@
"test",
"maintenance"
]
},
{
"login": "yyang1234",
"name": "Ying Yang",
"avatar_url": "https://avatars.githubusercontent.com/u/59220868?v=4",
"profile": "https://github.com/yyang1234",
"contributions": [
"bug",
"userTesting"
]
}
],
"contributorsPerLine": 7,
"projectName": "bidsMReye",
"projectOwner": "cpp-lln-lab",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true
"skipCi": true,
"commitType": "docs",
"commitConvention": "angular"
}
8 changes: 2 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ jobs:
user_name=cpplab
repo_name=$(echo "${CIRCLE_PROJECT_REPONAME}" | tr '[:upper:]' '[:lower:]')
if [[ -n "${DOCKER_TOKEN}" ]]; then
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_USER}" --password-stdin
echo "${DOCKER_TOKEN}" | docker login -u remigau --password-stdin
: "Pushing to DockerHub ${user_name}/${repo_name}:unstable"
docker tag "${user_name}/${repo_name}" "${user_name}/${repo_name}:unstable"
docker push "${user_name}/${repo_name}:unstable"
if [[ -n "${CIRCLE_TAG}" ]]; then
: "Pushing to DockerHub ${user_name}/${repo_name}:${CIRCLE_TAG}"
docker tag "${user_name}/${repo_name}" "${user_name}/${repo_name}:latest"
docker push "${user_name}/${repo_name}:latest"
docker tag "${user_name}/${repo_name}" "${user_name}/${repo_name}:${CIRCLE_TAG}"
docker push "${user_name}/${repo_name}:${CIRCLE_TAG}"
Expand All @@ -141,21 +142,16 @@ workflows:
build-test-deploy:
jobs:
- build

- get_data
- test:
requires:
- build
- get_data

- deploy:
context:
- DOCKER_HUB
requires:
- test
filters:
tags:
only: /.*/



Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/new_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
path: ./suggest.md
- name: Suggest FAQ
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
issue-number: ${{ github.event.issue.number }}
body: ${{ steps.suggest.outputs.content }}
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
fetch-depth: 0

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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/system_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand Down
6 changes: 3 additions & 3 deletions .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', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']
exclude:
- os: macOS-latest # anstpyx install is messed up with macOS and python 3.9
python-version: '3.9'
Expand All @@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand All @@ -44,7 +44,7 @@ jobs:
run: pytest --cov bidsmreye --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: tests
Expand Down
46 changes: 34 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: end-of-file-fixer
- id: check-added-large-files
Expand All @@ -20,8 +20,14 @@ repos:
- id: yamlfmt
args: [--mapping, '4', --sequence, '4', --offset, '0']

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

- repo: https://github.com/asottile/pyupgrade
rev: v3.13.0
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand All @@ -31,42 +37,58 @@ repos:
hooks:
- id: flynt

- repo: https://github.com/asottile/reorder-python-imports
rev: v3.11.0
- 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: reorder-python-imports
args: [--py37-plus, --add-import, from __future__ import annotations]
- id: isort
args: [--profile, black]

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

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
args: [--config=pyproject.toml, --verbose]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.11.0
hooks:
- id: mypy
additional_dependencies: [types-all, pydantic]
files: bidsmreye
args: [--config-file, pyproject.toml]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.3.0
hooks:
- id: codespell
args: [--toml=pyproject.toml]
additional_dependencies: [tomli]

- repo: https://github.com/jendrikseipp/vulture
rev: v2.9.1
rev: v2.11
hooks:
- id: vulture

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.1.0
hooks:
- id: flake8
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'
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
# Required
version: 2

build:
os: ubuntu-22.04
tools:
python: '3.11'

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
Expand All @@ -14,7 +19,6 @@ sphinx:

# Optionally set the version of Python and requirements required to build your docs
python:
version: '3.8'
install:
- method: pip
path: .
Expand Down
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
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,13 @@ Thanks goes to these wonderful people
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://weexee.github.io/Portfolio/"><img src="https://avatars.githubusercontent.com/u/91776803?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Pauline Cabee</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/bidsMReye/commits?author=WeeXee" title="Code">💻</a> <a href="#ideas-WeeXee" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-WeeXee" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center"><a href="https://remi-gau.github.io/"><img src="https://avatars.githubusercontent.com/u/6961185?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/bidsMReye/commits?author=Remi-Gau" title="Code">💻</a> <a href="#ideas-Remi-Gau" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/cpp-lln-lab/bidsMReye/commits?author=Remi-Gau" title="Tests">⚠️</a> <a href="#maintenance-Remi-Gau" title="Maintenance">🚧</a></td>
</tr>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://weexee.github.io/Portfolio/"><img src="https://avatars.githubusercontent.com/u/91776803?v=4?s=100" width="100px;" alt="Pauline Cabee"/><br /><sub><b>Pauline Cabee</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/bidsMReye/commits?author=WeeXee" title="Code">💻</a> <a href="#ideas-WeeXee" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-WeeXee" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://remi-gau.github.io/"><img src="https://avatars.githubusercontent.com/u/6961185?v=4?s=100" width="100px;" alt="Remi Gau"/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/bidsMReye/commits?author=Remi-Gau" title="Code">💻</a> <a href="#ideas-Remi-Gau" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/cpp-lln-lab/bidsMReye/commits?author=Remi-Gau" title="Tests">⚠️</a> <a href="#maintenance-Remi-Gau" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yyang1234"><img src="https://avatars.githubusercontent.com/u/59220868?v=4?s=100" width="100px;" alt="Ying Yang"/><br /><sub><b>Ying Yang</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/bidsMReye/issues?q=author%3Ayyang1234" title="Bug reports">🐛</a> <a href="#userTesting-yyang1234" title="User Testing">📓</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
Expand Down
1 change: 1 addition & 0 deletions bidsmreye/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Bidsmreye package."""

from __future__ import annotations
15 changes: 8 additions & 7 deletions bidsmreye/bids_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
from bids import BIDSLayout # type: ignore

from bidsmreye._version import __version__
from bidsmreye.configuration import Config
from bidsmreye.configuration import config_to_dict
from bidsmreye.configuration import get_bids_filter_config
from bidsmreye.configuration import get_bidsname_config
from bidsmreye.configuration import get_pybids_config
from bidsmreye.configuration import (
Config,
config_to_dict,
get_bids_filter_config,
get_bidsname_config,
get_pybids_config,
)
from bidsmreye.logging import bidsmreye_log
from bidsmreye.methods import methods
from bidsmreye.utils import copy_license
from bidsmreye.utils import create_dir_if_absent
from bidsmreye.utils import copy_license, create_dir_if_absent

log = bidsmreye_log("bidsmreye")

Expand Down
15 changes: 8 additions & 7 deletions bidsmreye/bidsmreye.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
import json
import sys
from pathlib import Path
from typing import Any
from typing import IO
from typing import IO, Any

import rich

from bidsmreye._version import __version__
from bidsmreye.configuration import Config
from bidsmreye.defaults import allowed_actions
from bidsmreye.defaults import available_models
from bidsmreye.defaults import default_log_level
from bidsmreye.defaults import default_model
from bidsmreye.defaults import log_levels
from bidsmreye.defaults import (
allowed_actions,
available_models,
default_log_level,
default_model,
log_levels,
)
from bidsmreye.download import download
from bidsmreye.generalize import generalize
from bidsmreye.logging import bidsmreye_log
Expand Down
5 changes: 1 addition & 4 deletions bidsmreye/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
from pathlib import Path
from typing import Any

from attrs import asdict
from attrs import converters
from attrs import define
from attrs import field
from attrs import asdict, converters, define, field
from bids import BIDSLayout # type: ignore

from bidsmreye.logging import bidsmreye_log
Expand Down
1 change: 1 addition & 0 deletions bidsmreye/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Store defaults."""

from __future__ import annotations


Expand Down
15 changes: 8 additions & 7 deletions bidsmreye/download.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
"""Download the models from OSF."""

from __future__ import annotations

import argparse
import sys
import warnings
from importlib import resources
from pathlib import Path
from typing import Any
from typing import IO
from typing import IO, Any

import pkg_resources
import pooch
import rich

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

log = bidsmreye_log(name="bidsmreye")
Expand Down Expand Up @@ -99,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
Loading

0 comments on commit 29f0540

Please sign in to comment.