From 8e29ddb9a104515d727c95d2c2f00f5b5989e687 Mon Sep 17 00:00:00 2001 From: tmcclintock Date: Fri, 9 May 2025 23:08:57 -0700 Subject: [PATCH 1/6] fix: ruff in dev deps --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 6123d37..9b86930 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,3 +52,8 @@ exclude_lines = [ "if __name__ == .__main__.:", "@tf.function" ] + +[dependency-groups] +dev = [ + "ruff>=0.11.9", +] From 21d9bfe4c77a6ab80b073acb13f09b43efb67c5f Mon Sep 17 00:00:00 2001 From: tmcclintock Date: Fri, 9 May 2025 23:09:05 -0700 Subject: [PATCH 2/6] fix: ruff fixes --- src/ConditionalGMM/UnivariateGMM.py | 5 +++-- tests/test_cGMM.py | 2 +- tests/test_cMVN.py | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ConditionalGMM/UnivariateGMM.py b/src/ConditionalGMM/UnivariateGMM.py index 104c217..52fb14e 100644 --- a/src/ConditionalGMM/UnivariateGMM.py +++ b/src/ConditionalGMM/UnivariateGMM.py @@ -103,8 +103,9 @@ def ppf(self, q): (float or array-like) quantile corresponding to `q` """ - f = lambda x: self.cdf(x) - q - return sp.optimize.newton(func=f, x0=self.mean(), fprime=self.pdf) + return sp.optimize.newton( + func=lambda x: self.cdf(x) - q, x0=self.mean(), fprime=self.pdf + ) def mean(self): """Mean of the RV for the GMM. diff --git a/tests/test_cGMM.py b/tests/test_cGMM.py index 91fe927..e46bf00 100644 --- a/tests/test_cGMM.py +++ b/tests/test_cGMM.py @@ -14,7 +14,7 @@ def test_cGMM_basic(): means = [[0.5, -0.2]] covs = [[[2.0, 0.3], [0.3, 0.5]]] fixed_inds = [1] - cGMM = CondGMM(weights, means, covs, fixed_inds) + CondGMM(weights, means, covs, fixed_inds) # 2d - 2 component weights = [0.5, 0.5] diff --git a/tests/test_cMVN.py b/tests/test_cMVN.py index e152b9f..fd8cb87 100644 --- a/tests/test_cMVN.py +++ b/tests/test_cMVN.py @@ -13,20 +13,19 @@ def test_cMN_basic(): means = [0.5, -0.2] cov = [[2.0, 0.3], [0.3, 0.5]] ind = [0] - cMN = CondMNorm(means, cov, ind) + CondMNorm(means, cov, ind) # 3D means = [0.5, -0.2, 1.0] cov = [[2.0, 0.3, 0.0], [0.3, 0.5, 0.0], [0.0, 0.0, 1.0]] inds = [1, 2] - cMN = CondMNorm(means, cov, inds) + CondMNorm(means, cov, inds) def test_cMN_exceptions(): # 3D means = [0.5, -0.2, 1.0] cov = [[2.0, 0.3, 0.0], [0.3, 0.5, 0.0], [0.0, 0.0, 1.0]] - inds = [1, 2] with pytest.raises(AssertionError): CondMNorm(means, cov, [-1]) From aef6328dc1c000ec9f0e08f690f986c4cf588d5a Mon Sep 17 00:00:00 2001 From: tmcclintock Date: Fri, 9 May 2025 23:09:19 -0700 Subject: [PATCH 3/6] fix: ruff in ci --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 67ff683..3865f6b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,7 +24,7 @@ jobs: - name: Install the project and dependencies run: uv sync --all-extras - # - uses: astral-sh/ruff-action@v3 + - uses: astral-sh/ruff-action@v3 - name: Run tests with coverage run: uv run pytest tests From 2d49b2bc16e2595c903ce757cd7749abedbcb60d Mon Sep 17 00:00:00 2001 From: tmcclintock Date: Fri, 9 May 2025 23:18:35 -0700 Subject: [PATCH 4/6] fix: correct coverage path --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9b86930..d01eb0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Homepage = "https://github.com/tmcclintock/ConditionalGMM" Issues = "https://github.com/tmcclintock/ConditionalGMM/issues" [tool.coverage.run] -include = ["./ConditionalGMM/*"] +include = ["./src/ConditionalGMM/*"] omit = [ "*tests*", "*__init__*" From ba79cd6e4fbd88d408d55c4190ee4a740d3ff87c Mon Sep 17 00:00:00 2001 From: tmcclintock Date: Fri, 9 May 2025 23:18:42 -0700 Subject: [PATCH 5/6] feat: coverage in CI --- .github/workflows/ci.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3865f6b..8feaa0c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,8 +27,13 @@ jobs: - uses: astral-sh/ruff-action@v3 - name: Run tests with coverage - run: uv run pytest tests + run: uv run coverage run -m pytest - # TODO: figure out how to use this - # - name: Produce coverage report - # run: uv run coverage report -m \ No newline at end of file + - name: Produce coverage report + run: uv run coverage xml + + - name: Show coverage report + uses: orgoro/coverage@v3.2 + with: + coverageFile: ./coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From a3d67e2c00875963d4cbce8e0e09840e0c7b0de7 Mon Sep 17 00:00:00 2001 From: tmcclintock Date: Fri, 9 May 2025 23:21:50 -0700 Subject: [PATCH 6/6] Fix: simplify coverage in job --- .github/workflows/ci.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8feaa0c..c590769 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,10 +30,4 @@ jobs: run: uv run coverage run -m pytest - name: Produce coverage report - run: uv run coverage xml - - - name: Show coverage report - uses: orgoro/coverage@v3.2 - with: - coverageFile: ./coverage.xml - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + run: uv run coverage report -m