diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 67ff683..c590769 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,11 +24,10 @@ 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 + 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 report -m diff --git a/pyproject.toml b/pyproject.toml index 6123d37..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__*" @@ -52,3 +52,8 @@ exclude_lines = [ "if __name__ == .__main__.:", "@tf.function" ] + +[dependency-groups] +dev = [ + "ruff>=0.11.9", +] 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])