Skip to content

Commit 1b946f4

Browse files
committed
Used uvx in some actions
1 parent 1e3c12d commit 1b946f4

9 files changed

Lines changed: 457 additions & 168 deletions

File tree

.github/workflows/black.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,5 @@ jobs:
2222
enable-cache: true
2323
cache-dependency-glob: "**/pyproject.toml"
2424

25-
- name: Create virtual environment
26-
run: |
27-
uv venv --clear .venv
28-
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
29-
30-
- name: Install Black
31-
run: uv pip install "black>=24.0.0"
32-
33-
- name: Check code formatting with Black
34-
run: black --check --diff --workers 1 .
25+
- name: Run Black formatter (check only)
26+
run: uvx black --check --diff .

.github/workflows/codespell.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,8 @@ jobs:
2222
- name: Install uv
2323
uses: astral-sh/setup-uv@v5
2424
with:
25-
python-version: '3.10'
2625
enable-cache: true
2726
cache-dependency-glob: "**/pyproject.toml"
2827

29-
- name: Create virtual environment
30-
run: |
31-
uv venv --clear .venv
32-
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
33-
34-
- name: Install dependencies
35-
run: uv pip install codespell tomli
36-
3728
- name: Run Codespell
38-
run: codespell .
29+
run: uvx --with tomli codespell .

.github/workflows/mdformat.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ jobs:
2626
enable-cache: true
2727
cache-dependency-glob: "**/pyproject.toml"
2828

29-
- name: Create virtual environment
30-
run: |
31-
uv venv --clear .venv
32-
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
33-
34-
- name: Install dependencies
35-
run: uv pip install "mdformat>=0.7.0" "mdformat-myst>=0.1.5"
36-
3729
- name: Run mdformat (check only)
3830
run: |
39-
mdformat --check --wrap no --number docs/
40-
mdformat --check --wrap no --number *.md
31+
run: uvx --with "mdformat-myst>=0.1.5" mdformat --check --wrap no --number docs/ *.md

.github/workflows/ruff.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,5 @@ jobs:
2424
enable-cache: true
2525
cache-dependency-glob: "**/pyproject.toml"
2626

27-
- name: Create virtual environment
28-
run: |
29-
uv venv --clear .venv
30-
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
31-
32-
- name: Install Ruff
33-
run: uv pip install "ruff>=0.8.0"
34-
35-
- name: Run Ruff linter
36-
run: ruff check .
27+
- name: Run Ruff linter and formatter check
28+
run: uvx ruff check . && uvx ruff format --check .

hed/schema/schema_attribute_validators.py

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

hed/schema/schema_comparer.py

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ class SchemaComparer:
4343
MISC_SECTION: "Misc Metadata",
4444
HED_ID_SECTION: "Modified Hed Ids",
4545
EXTRAS_SECTION: "Extras",
46+
SOURCES: "Sources",
47+
PREFIXES: "Prefixes",
48+
ANNOTATION_PROPERTY_EXTERNAL: "AnnotationPropertyExternal",
4649
}
4750

48-
# TODO: Check that the cases of these are correct.
49-
DF_EXTRAS = {SOURCES, PREFIXES, ANNOTATION_PROPERTY_EXTERNAL}
50-
5151
def __init__(self, schema1, schema2):
5252
"""Initialize the SchemaComparer with two schemas.
5353
@@ -305,8 +305,6 @@ def _add_unequal_entries(self, change_dict, unequal_entries):
305305
for section_key, changes in unequal_entries.items():
306306
if section_key == self.MISC_SECTION:
307307
self._add_misc_section_changes(change_dict, section_key, changes)
308-
elif section_key in self.DF_EXTRAS:
309-
self._add_extras_section_changes(change_dict, section_key, changes)
310308
else:
311309
for tag, (entry1, entry2) in changes.items():
312310
if section_key == HedSectionKey.UnitClasses:
@@ -339,35 +337,6 @@ def _add_misc_section_changes(change_dict, section_key, changes):
339337
)
340338
change_dict[section_key].append({"change_type": change_type, "change": change_desc, "tag": misc_section})
341339

342-
def _add_extras_section_changes(self, change_dict, section_key, changes):
343-
"""Add changes for extras sections (dataframes) to the change dictionary.
344-
345-
Handles changes to dataframe-based extras like Sources, Prefixes, and AnnotationPropertyExternal.
346-
Note: Extras sections are actually handled by _add_extras_changes which directly compares
347-
the dataframes from schema.extras. This method handles any extras-related entries that
348-
might appear in the unequal_entries from compare_schemas.
349-
350-
Parameters:
351-
change_dict (defaultdict): Change dictionary to append to.
352-
section_key (str): The section identifier (e.g., SOURCES, PREFIXES).
353-
changes (dict): Dictionary mapping entry names to (entry1, entry2) tuples.
354-
"""
355-
# Extras sections (Sources, Prefixes, AnnotationPropertyExternal) are stored as dataframes
356-
# in schema.extras rather than as schema entries, so they're handled separately
357-
# by _add_extras_changes. If we somehow get extras entries here, treat them generically.
358-
for name, (entry1, entry2) in changes.items():
359-
# Compare the entries as generic schema entries
360-
if hasattr(entry1, "attributes") and hasattr(entry2, "attributes"):
361-
if entry1.attributes != entry2.attributes:
362-
change_dict[section_key].append(
363-
{"change_type": "Patch", "change": f"{name} attributes modified", "tag": name}
364-
)
365-
if hasattr(entry1, "description") and hasattr(entry2, "description"):
366-
if entry1.description != entry2.description:
367-
change_dict[section_key].append(
368-
{"change_type": "Patch", "change": f"{name} description modified", "tag": name}
369-
)
370-
371340
@staticmethod
372341
def _add_unit_classes_changes(change_dict, section_key, entry1, entry2):
373342
"""Add changes in unit class definitions to the change dictionary.
@@ -546,7 +515,7 @@ def _add_extras_changes(self, change_dict):
546515
Parameters:
547516
change_dict (defaultdict): Change dictionary to append to.
548517
"""
549-
from hed.schema.schema_io.df_constants import UNIQUE_EXTRAS_KEYS
518+
from hed.schema.schema_io.df_constants import UNIQUE_EXTRAS_KEYS, in_library as _in_library
550519

551520
extras1 = getattr(self.schema1, "extras", {}) or {}
552521
extras2 = getattr(self.schema2, "extras", {}) or {}
@@ -575,9 +544,9 @@ def _add_extras_changes(self, change_dict):
575544

576545
key_cols = UNIQUE_EXTRAS_KEYS.get(key)
577546
if not key_cols:
578-
key_cols = list(set(df1.columns) & set(df2.columns))
547+
key_cols = [c for c in set(df1.columns) & set(df2.columns) if c != _in_library]
579548

580-
compare_cols = list(set(df1.columns) & set(df2.columns))
549+
compare_cols = [c for c in set(df1.columns) & set(df2.columns) if c != _in_library]
581550
if not compare_cols:
582551
continue
583552

hed/schema/schema_compliance.py

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

hed/scripts/schema_script_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def _is_prerelease_partner(base_schema) -> bool:
3333

3434

3535
def validate_schema_object(base_schema, schema_name):
36-
"""Validate a schema object by checking compliance and roundtrip conversion.
36+
"""Validate a schema object by checking non-warning compliance and roundtrip conversion.
3737
38-
Tests the schema for compliance issues and validates that it can be successfully
38+
Tests the schema for non-warningcompliance issues and validates that it can be successfully
3939
converted to and reloaded from all four formats (MEDIAWIKI, XML, JSON, TSV).
4040
4141
Parameters:

0 commit comments

Comments
 (0)