From 481a82beea24b1c589d41f6aca2fcd600e3c34b1 Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Wed, 21 Aug 2024 08:29:45 -0400 Subject: [PATCH] Install packages required for CI checks. --- .github/workflows/requirements-test.in | 6 +++ .github/workflows/requirements-test.txt | 49 ++++++++++++++++++++++--- .github/workflows/test.yaml | 2 +- hoomd_validation/custom_actions.py | 43 ++++++++++++---------- requirements.txt | 8 ---- 5 files changed, 75 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/requirements-test.in delete mode 100644 requirements.txt diff --git a/.github/workflows/requirements-test.in b/.github/workflows/requirements-test.in new file mode 100644 index 00000000..98eb30c7 --- /dev/null +++ b/.github/workflows/requirements-test.in @@ -0,0 +1,6 @@ +h5py +matplotlib +numpy +rtoml +scipy +signac diff --git a/.github/workflows/requirements-test.txt b/.github/workflows/requirements-test.txt index bc6f9784..389526ee 100644 --- a/.github/workflows/requirements-test.txt +++ b/.github/workflows/requirements-test.txt @@ -1,6 +1,45 @@ -h5py==3.10.0 -gsd==3.2.1 -numpy==1.26.4 -PyYAML==6.0.1 +# This file was autogenerated by uv via the following command: +# uv pip compile requirements-test.in +contourpy==1.2.1 + # via matplotlib +cycler==0.12.1 + # via matplotlib +filelock==3.15.4 + # via signac +fonttools==4.53.1 + # via matplotlib +h5py==3.11.0 + # via -r requirements-test.in +kiwisolver==1.4.5 + # via matplotlib +matplotlib==3.9.2 + # via -r requirements-test.in +numpy==2.1.0 + # via + # -r requirements-test.in + # contourpy + # h5py + # matplotlib + # scipy +packaging==24.1 + # via + # matplotlib + # signac +pillow==10.4.0 + # via matplotlib +pyparsing==3.1.2 + # via matplotlib +python-dateutil==2.9.0.post0 + # via matplotlib +rtoml==0.11.0 + # via -r requirements-test.in +scipy==1.14.1 + # via -r requirements-test.in signac==2.2.0 -signac-flow==0.28.0 + # via -r requirements-test.in +six==1.16.0 + # via python-dateutil +synced-collections==1.0.0 + # via signac +tqdm==4.66.5 + # via signac diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a49f327e..cc69fbdc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,4 +1,4 @@ -name: test +name: Unit test concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/hoomd_validation/custom_actions.py b/hoomd_validation/custom_actions.py index 03387bd6..4e4afb22 100644 --- a/hoomd_validation/custom_actions.py +++ b/hoomd_validation/custom_actions.py @@ -5,30 +5,35 @@ try: import hoomd -except ModuleNotFoundError as e: - print(f"Warning: {e}") -class ComputeDensity(hoomd.custom.Action): - """Compute the density of particles in the system. + class ComputeDensity(hoomd.custom.Action): + """Compute the density of particles in the system. + + The density computed is a number density. - The density computed is a number density. + Args: + N: When not None, Use N instead of the number of particles when + computing the density. + """ - Args: - N: When not None, Use N instead of the number of particles when - computing the density. - """ + def __init__(self, N=None): + self.N = N - def __init__(self, N=None): - self.N = N + @hoomd.logging.log + def density(self): + """float: The density of the system.""" + if self.N is None: + return self._state.N_particles / self._state.box.volume - @hoomd.logging.log - def density(self): - """float: The density of the system.""" - if self.N is None: - return self._state.N_particles / self._state.box.volume + return self.N / self._state.box.volume - return self.N / self._state.box.volume + def act(self, timestep): + """Dummy act method.""" + pass +except ModuleNotFoundError as e: + print(f"Warning: {e}") - def act(self, timestep): - """Dummy act method.""" + # This workaround is to allow `python project.py init` to succeed in CI checks + # without requiring a working HOOMD installation. + class ComputeDensity: pass diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 94b5f2d3..00000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -gsd -matplotlib -numpy -rtoml -scipy -signac >= 2.2.0 -signac-flow >= 0.25.1 -signac-dashboard