Skip to content

Commit

Permalink
MNT: Rename schemacode -> bidsschematools
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Jul 14, 2022
1 parent 0d542ea commit f84cd85
Show file tree
Hide file tree
Showing 20 changed files with 33 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/schemacode_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: "Run tests"
shell: bash {0}
run: |
python -m pytest --pyargs schemacode --cov=schemacode ./tools/schemacode/
python -m pytest --pyargs bidsschematools --cov=schemacode
- name: "Upload coverage to CodeCov"
uses: codecov/codecov-action@v1
Expand Down
2 changes: 1 addition & 1 deletion tools/mkdocs_macros_bids/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import sys

from schemacode import render, schema, utils
from bidsschematools import render, schema, utils

code_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(code_path)
Expand Down
2 changes: 1 addition & 1 deletion tools/schemacode/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# schemacode
# BIDS Schema Tools

A Python library for working with the BIDS schema.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"utils",
]

version_file = files("schemacode.data") / "schema" / "SCHEMA_VERSION"
version_file = files("bidsschematools.data") / "schema" / "SCHEMA_VERSION"
with as_file(version_file) as path:
__version__ = path.read_text().strip()
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

from schemacode import schema, utils
from bidsschematools import schema, utils

lgr = logging.getLogger()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tests for the schemacode package."""
"""Tests for the bidsschematools package."""
import os

from schemacode import render
from bidsschematools import render


def test_make_entity_definitions(schema_obj):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Tests for the schemacode package."""
"""Tests for the bidsschematools package."""
import pytest

from schemacode import schema
from bidsschematools import schema


def test_load_schema(schema_dir):
"""Smoke test for schemacode.schema.load_schema."""
"""Smoke test for bidsschematools.schema.load_schema."""
# Pointing to a nonexistent directory should raise a ValueError
bad_path = "/path/to/nowhere"
with pytest.raises(ValueError):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from schemacode import utils
from bidsschematools import utils


def test_combine_extensions():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def test__add_entity():
from schemacode.validator import _add_entity
from bidsschematools.validator import _add_entity

# Test empty input and directory creation and required entity
regex_entities = ""
Expand Down Expand Up @@ -54,7 +54,7 @@ def test__add_entity():


def test__add_extensions():
from schemacode.validator import _add_extensions
from bidsschematools.validator import _add_extensions

# Test single extension
regex_string = (
Expand Down Expand Up @@ -107,7 +107,7 @@ def test__add_extensions():


def test__add_subdirs():
from schemacode.validator import _add_subdirs
from bidsschematools.validator import _add_subdirs

regex_string = "sub-(?P=subject)_sessions\\.(tsv|json)"
variant = {
Expand Down Expand Up @@ -165,7 +165,7 @@ def test__add_subdirs():


def test__add_suffixes():
from schemacode.validator import _add_suffixes
from bidsschematools.validator import _add_suffixes

# Test single expansion
regex_entities = "sub-(?P=subject)"
Expand Down Expand Up @@ -225,7 +225,7 @@ def test__add_suffixes():


def test_load_all():
from schemacode.validator import load_all
from bidsschematools.validator import load_all

# schema_path = "/usr/share/bids-schema/1.7.0/"
schema_path = os.path.join(
Expand All @@ -241,7 +241,7 @@ def test_load_all():


def test_write_report(tmp_path):
from schemacode.validator import write_report
from bidsschematools.validator import write_report

validation_result = {}

Expand Down Expand Up @@ -303,7 +303,7 @@ def test_write_report(tmp_path):
reason="no network",
)
def test_bids_datasets(bids_examples, tmp_path):
from schemacode.validator import validate_bids
from bidsschematools.validator import validate_bids

whitelist = [
"asl003",
Expand Down Expand Up @@ -354,7 +354,7 @@ def test_bids_datasets(bids_examples, tmp_path):


def test_broken_json_dataset(bids_examples, tmp_path):
from schemacode.validator import validate_bids
from bidsschematools.validator import validate_bids

dataset = "asl003"
dataset_path = os.path.join(bids_examples, dataset)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def load_top_level(
Parameters
----------
my_schema : dict
A nested dictionary, as returned by `schemacode.schema.load_schema()`.
A nested dictionary, as returned by `bidsschematools.schema.load_schema()`.
Returns
-------
Expand Down Expand Up @@ -236,7 +236,7 @@ def load_entities(
Parameters
----------
my_schema : dict
A nested dictionary, as returned by `schemacode.schema.load_schema()`.
A nested dictionary, as returned by `bidsschematools.schema.load_schema()`.
Notes
-----
Expand Down Expand Up @@ -653,7 +653,7 @@ def select_schema_dir(
raise ValueError(
f"The expected schema directory {schema_dir} does not exist on the system. "
"Please ensure the file exists or manually specify a schema version for "
"which the schemacode files are available on your system."
"which the bidsschematools files are available on your system."
)


Expand Down Expand Up @@ -689,7 +689,7 @@ def _get_directory_suffixes(my_schema):
Parameters
----------
my_schema : dict
Nested directory as produced by `schemacode.schema.load_schema()`.
Nested directory as produced by `bidsschematools.schema.load_schema()`.
Returns
-------
Expand Down Expand Up @@ -745,8 +745,8 @@ def validate_bids(
If string, the string will be used as the output path.
If the variable evaluates as False, no log will be written.
schema_min_version : str, optional
Minimal working schema version, used by the `schemacode.select_schema_dir()` function only
if no schema version is found or a lower schema version is specified by the dataset.
Minimal working schema version, used by the `bidsschematools.select_schema_dir()` function
only if no schema version is found or a lower schema version is specified by the dataset.
Returns
-------
Expand All @@ -758,7 +758,7 @@ def validate_bids(
Examples
--------
>>> from schemacode import validator
>>> from bidsschematools import validator
>>> bids_paths = '~/.data2/datalad/000026/rawdata'
>>> schema_version='{module_path}/data/schema/'
>>> validator.validate_bids(bids_paths, schema_version=schema_version, debug=False)"
Expand Down
5 changes: 2 additions & 3 deletions tools/schemacode/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[build-system]
requires = ["setuptools", "wheel"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 99
Expand All @@ -17,8 +18,6 @@ exclude = '''
| build
| dist
)/
| versioneer.py
| schemacode/_version.py
)
'''

Expand Down
19 changes: 5 additions & 14 deletions tools/schemacode/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
[metadata]
name = schemacode
version = file:schemacode/data/schema/SCHEMA_VERSION
url = https://github.com/bids-standard/schemacode
name = bidsschematools
version = file:bidsschematools/data/schema/SCHEMA_VERSION
url = https://github.com/bids-standard/bids-specification
author = bids-standard developers
author_email = [email protected]
description = Python tools for working with the BIDS schema.
long_description = file:README.md
long_description_content_type = text/markdown; charset=UTF-8; variant=GFM
license = MIT
classifiers =
Development Status :: 2 - Pre-Alpha
Development Status :: 3 - Alpha
Intended Audience :: Science/Research
Topic :: Scientific/Engineering :: Information Analysis
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Expand Down Expand Up @@ -48,18 +47,10 @@ all =
%(tests)s

[options.package_data]
schemacode =
bidsschematools =
data/schema/SCHEMA_VERSION
data/schema/**/*.yaml

[versioneer]
VCS = git
style = pep440
versionfile_source = schemacode/_version.py
versionfile_build = schemacode/_version.py
tag_prefix = v
parentdir_prefix =

[flake8]
max-line-length = 99
exclude = *build/
Expand Down

0 comments on commit f84cd85

Please sign in to comment.