Expose dataset/conversion scripts as uv entry points
scripts/ is now a proper package (scripts/__init__.py, added to the wheel's packages), with each script registered under [project.scripts] using its bare dashed name (e.g. `uv run migrate-geant-steps`). Tests now import these modules normally instead of loading them by file path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,4 @@
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
# scripts/ is not an installed package — load the module straight from its path.
|
||||
_SPEC = importlib.util.spec_from_file_location(
|
||||
"bump_dataset_version",
|
||||
Path(__file__).resolve().parents[1] / "scripts" / "bump_dataset_version.py",
|
||||
)
|
||||
bump_dataset_version = importlib.util.module_from_spec(_SPEC)
|
||||
_SPEC.loader.exec_module(bump_dataset_version)
|
||||
from scripts import bump_dataset_version
|
||||
|
||||
plan_bump_gen = bump_dataset_version.plan_bump_gen
|
||||
plan_bump_schema = bump_dataset_version.plan_bump_schema
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
import importlib.util
|
||||
import json
|
||||
import stat
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
# scripts/ is not an installed package — load the module straight from its path.
|
||||
_SPEC = importlib.util.spec_from_file_location(
|
||||
"create_root_files",
|
||||
Path(__file__).resolve().parents[1] / "scripts" / "create_root_files.py",
|
||||
)
|
||||
create_root_files = importlib.util.module_from_spec(_SPEC)
|
||||
_SPEC.loader.exec_module(create_root_files)
|
||||
from scripts import create_root_files
|
||||
|
||||
parse_detector_spec = create_root_files.parse_detector_spec
|
||||
next_shard_index = create_root_files.next_shard_index
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
import polars as pl
|
||||
|
||||
# scripts/ is not an installed package — load the module straight from its path.
|
||||
_SPEC = importlib.util.spec_from_file_location(
|
||||
"steps_to_parquet",
|
||||
Path(__file__).resolve().parents[1] / "scripts" / "steps_to_parquet.py",
|
||||
)
|
||||
steps_to_parquet = importlib.util.module_from_spec(_SPEC)
|
||||
_SPEC.loader.exec_module(steps_to_parquet)
|
||||
from scripts import steps_to_parquet
|
||||
|
||||
|
||||
def _frame() -> pl.DataFrame:
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
import importlib.util
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
# scripts/ is not an installed package — load the module straight from its path.
|
||||
_SPEC = importlib.util.spec_from_file_location(
|
||||
"steps_to_parquet_parallel",
|
||||
Path(__file__).resolve().parents[1] / "scripts" / "steps_to_parquet_parallel.py",
|
||||
)
|
||||
steps_to_parquet_parallel = importlib.util.module_from_spec(_SPEC)
|
||||
_SPEC.loader.exec_module(steps_to_parquet_parallel)
|
||||
from scripts import steps_to_parquet_parallel
|
||||
|
||||
run_parallel = steps_to_parquet_parallel.run_parallel
|
||||
resolve_destination = steps_to_parquet_parallel.resolve_destination
|
||||
|
||||
Reference in New Issue
Block a user