From 7309536dd8546d9d3337dad980d6bc977e1faac7 Mon Sep 17 00:00:00 2001 From: Fede Raimondo Date: Thu, 5 Dec 2024 13:47:19 +0100 Subject: [PATCH 1/5] [SCHEMA] Configure only the bst logger instead of the root logger (#1996) * Configure only the bst logger instead of the root logger * Add a logging handler if there are none * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix flake8 --- .../src/bidsschematools/render/tables.py | 7 +------ .../schemacode/src/bidsschematools/render/text.py | 8 +------- tools/schemacode/src/bidsschematools/schema.py | 4 ---- tools/schemacode/src/bidsschematools/utils.py | 15 ++++++++++++++- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/tools/schemacode/src/bidsschematools/render/tables.py b/tools/schemacode/src/bidsschematools/render/tables.py index 8eb6b386a4..4b91b223e5 100644 --- a/tools/schemacode/src/bidsschematools/render/tables.py +++ b/tools/schemacode/src/bidsschematools/render/tables.py @@ -2,8 +2,6 @@ from __future__ import annotations -import logging -import os import typing as ty import pandas as pd @@ -11,12 +9,9 @@ from bidsschematools.render import utils from bidsschematools.schema import BIDSSchemaError, Namespace, filter_schema -from bidsschematools.utils import get_logger, set_logger_level +from bidsschematools.utils import get_logger lgr = get_logger() -# Basic settings for output, for now just basic -set_logger_level(lgr, os.environ.get("BIDS_SCHEMA_LOG_LEVEL", logging.INFO)) -logging.basicConfig(format="%(asctime)-15s [%(levelname)8s] %(message)s") # Remember to add extension (.html or .md) to the paths when using them. ENTITIES_PATH = "SPEC_ROOT/appendices/entities" diff --git a/tools/schemacode/src/bidsschematools/render/text.py b/tools/schemacode/src/bidsschematools/render/text.py index ce70ae0ded..226b1d408b 100644 --- a/tools/schemacode/src/bidsschematools/render/text.py +++ b/tools/schemacode/src/bidsschematools/render/text.py @@ -1,19 +1,13 @@ """Functions for rendering portions of the schema as text.""" -import logging -import os - import yaml from markdown_it import MarkdownIt from bidsschematools.render import utils from bidsschematools.schema import Namespace, filter_schema, load_schema -from bidsschematools.utils import get_logger, set_logger_level +from bidsschematools.utils import get_logger lgr = get_logger() -# Basic settings for output, for now just basic -set_logger_level(lgr, os.environ.get("BIDS_SCHEMA_LOG_LEVEL", logging.INFO)) -logging.basicConfig(format="%(asctime)-15s [%(levelname)8s] %(message)s") # Remember to add extension (.html or .md) to the paths when using them. ENTITIES_PATH = "SPEC_ROOT/appendices/entities" diff --git a/tools/schemacode/src/bidsschematools/schema.py b/tools/schemacode/src/bidsschematools/schema.py index a00eaddac9..ad6462f32c 100644 --- a/tools/schemacode/src/bidsschematools/schema.py +++ b/tools/schemacode/src/bidsschematools/schema.py @@ -1,7 +1,6 @@ """Schema loading- and processing-related functions.""" import json -import logging import os import re import sys @@ -21,9 +20,6 @@ from .types import Namespace lgr = utils.get_logger() -# Basic settings for output, for now just basic -utils.set_logger_level(lgr, os.environ.get("BIDS_SCHEMA_LOG_LEVEL", logging.INFO)) -logging.basicConfig(format="%(asctime)-15s [%(levelname)8s] %(message)s") class BIDSSchemaError(Exception): diff --git a/tools/schemacode/src/bidsschematools/utils.py b/tools/schemacode/src/bidsschematools/utils.py index 6f9850edb0..441e8986eb 100644 --- a/tools/schemacode/src/bidsschematools/utils.py +++ b/tools/schemacode/src/bidsschematools/utils.py @@ -1,6 +1,7 @@ """Utility functions for the bids-specification schema.""" import logging +import os from . import data @@ -29,7 +30,19 @@ def get_logger(name=None): logging.Logger logger object. """ - return logging.getLogger("bidsschematools" + (".%s" % name if name else "")) + logger = logging.getLogger("bidsschematools" + (".%s" % name if name else "")) + # Basic settings for output, for now just basic + set_logger_level(logger, os.environ.get("BIDS_SCHEMA_LOG_LEVEL", logging.INFO)) + format = "%(asctime)-15s [%(levelname)8s] %(message)s" + if len(logger.handlers) == 0: + # add a handler if there isn't one + ch = logging.StreamHandler() + logger.addHandler(ch) + # Set the formatter for the handlers + for lh in logger.handlers: + lh.setFormatter(logging.Formatter(format)) + + return logger def set_logger_level(lgr, level): From 188da09c356c5c6b11875e2e78c21097741f45f7 Mon Sep 17 00:00:00 2001 From: jeffersoncasimir <15801528+jeffersoncasimir@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:51:16 -0500 Subject: [PATCH 2/5] FIX: Add 1.10.0 to known versions list (#1994) --- src/schema/meta/versions.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/schema/meta/versions.yaml b/src/schema/meta/versions.yaml index 06285c7e30..728785fb7e 100644 --- a/src/schema/meta/versions.yaml +++ b/src/schema/meta/versions.yaml @@ -1,5 +1,6 @@ --- # A list of released BIDS versions as of the next schema release +- '1.10.0' - '1.9.0' - '1.8.0' - '1.7.0' From df41df44a16c84e1e0a76cd9187e0174f5a37536 Mon Sep 17 00:00:00 2001 From: Ross Blair Date: Thu, 17 Oct 2024 11:55:42 -0500 Subject: [PATCH 3/5] [SCHEMA] Allow physio files for anat datatype (#1961) * add anat to datatypes field for timeseries no task in schema/rules/files/raw/task * Update src/schema/rules/files/raw/task.yaml Co-authored-by: Chris Markiewicz * Update src/schema/rules/files/raw/task.yaml Co-authored-by: Chris Markiewicz * Update src/schema/rules/files/raw/task.yaml Co-authored-by: Chris Markiewicz * Update src/schema/rules/files/raw/task.yaml --------- Co-authored-by: Chris Markiewicz --- src/schema/rules/files/raw/task.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/schema/rules/files/raw/task.yaml b/src/schema/rules/files/raw/task.yaml index 812765a063..1fe1712915 100644 --- a/src/schema/rules/files/raw/task.yaml +++ b/src/schema/rules/files/raw/task.yaml @@ -101,6 +101,18 @@ events__mrs: nucleus: optional volume: optional +timeseries__anat: + $ref: rules.files.raw.task.timeseries + datatypes: + - anat + entities: + $ref: rules.files.raw.task.timeseries.entities + ceagent: optional + reconstruction: optional + echo: optional + part: optional + chunk: optional + timeseries__func: $ref: rules.files.raw.task.timeseries datatypes: From b1c0400514418a27aa6a7d71d749994631c1988c Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 5 Dec 2024 16:44:11 -0500 Subject: [PATCH 4/5] schema-1.0.0 --- src/schema/SCHEMA_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/SCHEMA_VERSION b/src/schema/SCHEMA_VERSION index 4fd02b3796..3eefcb9dd5 100644 --- a/src/schema/SCHEMA_VERSION +++ b/src/schema/SCHEMA_VERSION @@ -1 +1 @@ -0.11.3.post4-dev +1.0.0 From c17b7f37363f34dbd1df08917f69d6e3bade26db Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 5 Dec 2024 16:46:09 -0500 Subject: [PATCH 5/5] schema-1.0.1-dev --- src/schema/SCHEMA_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/SCHEMA_VERSION b/src/schema/SCHEMA_VERSION index 3eefcb9dd5..3f60217db9 100644 --- a/src/schema/SCHEMA_VERSION +++ b/src/schema/SCHEMA_VERSION @@ -1 +1 @@ -1.0.0 +1.0.1-dev