Skip to content

Commit ecb8a57

Browse files
authored
bids2table 2.0 (#48)
* Remove all old files * Initial commit (v2) * Add entities utilities - BIDS schema loaded from `bidschematools` following previous impl (thx @nx10). - Add Arrow schema construction - Otherwise, trying to make much simpler. No dataclass complexity. * Add back bids-examples submodule * Add initial impl of indexing New indexing uses just `Path` operations and string processing. Generates arrow tables directly with no other dependencies. ~400 LOC. Supports indexing cloud-hosted datasets via `cloudpathlib`. Thanks to @nx10 for these suggestions. * Update README.md * Move cloudpathlib stuff to another module * Add dataset and subject ID to progress bar * Minor changes - Don't raise error, just warn and return empty table if a dataset is empty. - Add package-level exports. * Add `batch_index_dataset` and other misc cleanup * Add initial CLI TODO: test * Accept list of globs in CLI and other misc cleanup Accepting unexpanded glob patterns in CLI is useful for cloud sources. May as well accept a list of them. Few other misc cleanup (simplify log messages, progress bar). * Logging improvements - Format large file counts in human readable units. - Change verbosity order: progress bar -> warnings. - Filter repeated logging messages. - Initialize logger state in each process when using `ProcessPoolExecutor`. * Add CI workflows * Remove `BIDSEntity` enum; add `get_column_names` A dynamically defined global enum for the column names is a bit awkward and not that useful. The column names are not available statically in the editor for example. Remove and replace with a `get_column_names` function which dynamically defines the column name enum. * Add docstrings and update README.md * Clone with submodules in CI * Add codecov.yaml * Update codecov.yaml Make informational, don't fail CI jobs * Minor change to logging behavior Disable progress bar by default in python index functions. Enable progress bar by default in CLI. Add a `--no-progress` flag. * Minor cleanup * Add tests to run CLI * Install with s3 extra in CI * Remove unnecessary `path.is_dir()` call * Update README.md before release
1 parent c944b15 commit ecb8a57

52 files changed

Lines changed: 3341 additions & 7544 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,33 @@ on:
66
pull_request:
77
branches: [ "main" ]
88

9+
env:
10+
UV_FROZEN: true
11+
912
jobs:
1013
test:
1114
runs-on: ubuntu-latest
1215
steps:
13-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1417
with:
1518
submodules: 'true'
16-
- name: Set up Python 3.8
17-
uses: actions/setup-python@v3
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
1821
with:
19-
python-version: "3.8"
20-
- name: Install
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install .[dev,test]
22+
pyproject-file: pyproject.toml
23+
- name: Install the project
24+
run: uv sync --all-extras
2425
- name: Check quality
2526
run: |
26-
black --check bids2table tests
27-
isort --check-only bids2table tests
28-
flake8 bids2table tests
29-
pylint --fail-under 9.0 bids2table
30-
mypy bids2table
27+
uv run ruff check bids2table tests
28+
uv run ruff format --check bids2table tests
3129
- name: Run tests
32-
run: pytest --cov=bids2table tests
30+
run: |
31+
uv run pytest \
32+
--junitxml=pytest.xml \
33+
--cov-report=xml:coverage.xml \
34+
--cov=bids2table tests
3335
- name: Upload coverage to Codecov
34-
uses: codecov/codecov-action@v3
36+
uses: codecov/codecov-action@v4
37+
with:
38+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/docs.yaml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
env:
9+
UV_FROZEN: true
10+
11+
jobs:
12+
pypi-publish:
13+
name: upload release to PyPI
14+
runs-on: ubuntu-latest
15+
# Specifying a GitHub environment is optional, but strongly encouraged
16+
environment: pypi
17+
permissions:
18+
# IMPORTANT: this permission is mandatory for Trusted Publishing
19+
id-token: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v5
24+
with:
25+
pyproject-file: pyproject.toml
26+
- name: Build project
27+
run: |
28+
uv sync --no-dev --no-install-project
29+
uv build
30+
- name: Publish package distributions to PyPI
31+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,10 @@ htmlcov
2525

2626
# Local data and scratch
2727
.scratch
28-
example/bids-examples.b2t
29-
docs
3028

31-
# Local environment
29+
# Local virtual environment
3230
.venv
31+
.python-version
3332

3433
# Jupyter
3534
.ipynb_checkpoints
36-
37-
# Example generated tables
38-
example/tables
39-
40-
# Benchmark data
41-
benchmark/**/envs
42-
benchmark/**/results
43-
benchmark/**/indexes
44-
slurm-*

.pre-commit-config.yaml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,26 @@ default_language_version:
55

66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.4.0
8+
rev: v5.0.0
99
hooks:
1010
- id: trailing-whitespace
1111
- id: check-ast
1212
- id: check-merge-conflict
13-
# - id: no-commit-to-branch
14-
# args: ['--branch=main']
1513
- id: end-of-file-fixer
1614

17-
- repo: https://github.com/psf/black
18-
rev: 23.3.0 # Replace by any tag/version: https://github.com/psf/black/tags
19-
hooks:
20-
- id: black
21-
language_version: python3 # Should be a command that runs python3.6+
22-
23-
- repo: https://github.com/pycqa/flake8
24-
rev: 7.1.1
25-
hooks:
26-
- id: flake8
27-
28-
- repo: https://github.com/pycqa/isort
29-
rev: 5.11.5
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
# Ruff version.
17+
rev: v0.9.10
3018
hooks:
31-
- id: isort
32-
name: isort (python)
19+
# Run the linter.
20+
- id: ruff
21+
args: [ --fix ]
22+
# Run the formatter.
23+
- id: ruff-format
3324

34-
- repo: https://github.com/pre-commit/mirrors-mypy
35-
rev: v1.2.0
36-
hooks:
37-
- id: mypy
25+
- repo: https://github.com/codespell-project/codespell
26+
rev: v2.4.1
27+
hooks:
28+
- id: codespell
29+
additional_dependencies:
30+
- tomli

0 commit comments

Comments
 (0)