diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 76b7db56..7f599099 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,13 +20,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - - name: setup mpi - uses: mpi4py/setup-mpi@v1 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.13' - name: setup mpi uses: mpi4py/setup-mpi@v1 - name: Install Poetry @@ -34,6 +27,11 @@ jobs: with: virtualenvs-create: true virtualenvs-in-project: true + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.13' + cache: poetry - name: check pyproject.toml run: cat pyproject.toml @@ -47,7 +45,6 @@ jobs: run: poetry run mypy opencosmo build-docs: - needs: lint-typecheck runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -175,7 +172,6 @@ jobs: build: name: build runs-on: ubuntu-latest - needs: [run-tests, run-parallel-tests, lint-typecheck] steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/opencosmo/link/collection.py b/opencosmo/link/collection.py index 36593a16..c1f3aa54 100644 --- a/opencosmo/link/collection.py +++ b/opencosmo/link/collection.py @@ -58,7 +58,7 @@ def __init__( self.__filters = filters def __repr__(self): - structure_type = self.header.file.data_type.split("_")[0] + "s" + structure_type = self.__header.file.data_type.split("_")[0] + "s" dtype_str = ", ".join(self.__handlers.keys()) return f"Collection of {structure_type} with linked datasets {dtype_str}" diff --git a/opencosmo/link/io.py b/opencosmo/link/io.py index 9f0b33dc..6a801667 100644 --- a/opencosmo/link/io.py +++ b/opencosmo/link/io.py @@ -92,6 +92,10 @@ def open_linked_files(*files: Path): Open a collection of files that are linked together, such as a properties file and a particle file. """ + if len(files) == 1 and isinstance(files[0], list): + return open_linked_files(*files[0]) + + file_handles = [File(file, "r") for file in files] headers = [read_header(file) for file in file_handles] properties_file, linked_files = verify_links(*headers) diff --git a/pyproject.toml b/pyproject.toml index 592cdac6..0ba1f4cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "opencosmo" -version = "0.6.0" +version = "0.6.1" description = "OpenCosmo Python Toolkit" authors = ["Patrick Wells "] readme = "README.md" diff --git a/test/test_collection.py b/test/test_collection.py index 7a6cb446..fa454605 100644 --- a/test/test_collection.py +++ b/test/test_collection.py @@ -42,6 +42,9 @@ def test_multi_filter(multi_path): for ds in collection.values(): assert all(ds.data["sod_halo_mass"] > 0) +def test_multi_repr(multi_path): + collection = oc.read(multi_path) + assert isinstance(collection.__repr__(), str) def test_multi_filter_write(multi_path, tmp_path): collection = oc.read(multi_path) @@ -85,6 +88,11 @@ def test_data_linking(halo_paths): assert n_particles > 0 assert n_profiles > 0 +def test_data_link_repr(halo_paths): + collection = open_linked_files(halo_paths) + assert isinstance(collection.__repr__(), str) + + def test_data_link_selection(halo_paths): collection = open_linked_files(*halo_paths) diff --git a/test/test_read.py b/test/test_read.py index 8b7b3aef..95d05084 100644 --- a/test/test_read.py +++ b/test/test_read.py @@ -34,3 +34,7 @@ def test_all_columns_included(input_path): def test_read_multi(multi_path): dataset = oc.read(multi_path) assert isinstance(dataset, oc.collection.collection.SimulationCollection) + +def test_dataset_repr(input_path): + dataset = oc.read(input_path) + assert isinstance(dataset.__repr__(), str)