Registry / data / bidsschematools

bidsschematools

JSON →
library1.2.2pypypi✓ verified 80d ago

bidsschematools is a Python library providing utilities for programmatic interaction with the Brain Imaging Data Structure (BIDS) schema. It enables loading, parsing, and validating BIDS datasets against the official specification. The current version is 1.2.2, with releases typically coinciding with major BIDS specification updates or essential bug fixes and enhancements.

pip install bidsschematools
INSTALL
IMPORT
SIG · BIDSSCHEMATOOLS
B
bidsschematools
datapythonv1.2.2
Install
2.1s avg
Import
40ms
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.042s · 22.1MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.1s · import 0.039s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BIDS_SCHEMA
from bidsschematools import schema
from bidsschematools import schema

This quickstart demonstrates how to load the default BIDS schema, inspect its properties like version and entities, and perform a basic check for filename pattern validity. For full dataset validation, a more complete BIDS dataset structure would be required.

from bidsschematools import schema import pprint # Load the default, current BIDS schema bids_schema = schema.BIDS_SCHEMA print(f"BIDS Schema Version: {bids_schema.version}") print(f"Number of entities in schema: {len(bids_schema.entities)}") # Accessing a specific entity definition entity_sub = bids_schema.entities.get("subject") if entity_sub: print("\n'subject' entity definition:") pprint.pprint(entity_sub) # Example: Check if a filename pattern is valid according to schema rules # Note: Full file validation requires a dataset context. filename_pattern = "sub-<label>[_ses-<label>][_task-<label>]_bold.nii.gz" is_valid_pattern = bids_schema.validate_pattern_string(filename_pattern) print(f"\nIs example filename pattern valid according to schema? {is_valid_pattern}") # To load a specific schema from a path: # custom_schema = schema.BIDS_SCHEMA.from_path("path/to/your/custom_bids_schema_directory")
bids-schema --version
Debug
Known issues
breakingThe `bidsschematools.schema.load_schema()` function was removed and replaced by `BIDS_SCHEMA.from_path()` for loading custom or specific schema versions.
fix
Replace calls to `load_schema(path)` with `schema.BIDS_SCHEMA.from_path(path)`.
affects: >=1.2.0
breakingThe modules `bidsschematools.schema.rules` (previously `rules_schema`) and `bidsschematools.schema.objects` were removed as part of internal refactoring to simplify schema access.
fix
These internal modules are no longer exposed. Access schema components directly through the `bids_schema` object (e.g., `bids_schema.entities`, `bids_schema.datatypes`).
affects: >=1.1.0
gotchaThe library, by default, loads the latest stable version of the BIDS specification available at the time of its own release. If you need to validate against an older or a custom BIDS specification, you must explicitly load it using `BIDS_SCHEMA.from_path()`.
fix
Always confirm which BIDS specification version is loaded (`bids_schema.version`) and use `schema.BIDS_SCHEMA.from_path('/path/to/your/bids-specification')` if a specific version or custom schema is required.
affects: All versions
Upgrade
Version history
1.2.2latest on PyPI · released Mar 24, 2026
Audit
Dependencies
jsonschemarequiredRequired for JSON schema validation.
pydanticrequiredUsed for data validation and settings management.
pyyamlrequiredUsed for parsing YAML-based schema definitions.
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
bidsschematools — pip install bidsschematools · libregistry