Repository: pymc-devs/pymc (branch: ruff_linter)
Commit date: 2024-01-09T19:22:48Z

Workflow file: .github/workflows/pre-commit.yml (pre-commit)
name: pre-commit

on:
  pull_request:
  push:
    branches: [main]

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    env:
      SKIP: no-commit-to-branch
    steps:
    - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
    - uses: actions/setup-python@v5
      with:
        python-version: "3.9"  # Run pre-commit on oldest supported Python version
    - uses: pre-commit/action@v3.0.0
  mypy:
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    defaults:
      run:
        shell: bash -l {0}
    steps:
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
      - name: Cache conda
        uses: actions/cache@v3
        env:
          # Increase this value to reset cache if environment-test.yml has not changed
          CACHE_NUMBER: 0
        with:
          path: ~/conda_pkgs_dir
          key: ${{ runner.os }}-py39-conda-${{ env.CACHE_NUMBER }}-${{
            hashFiles('conda-envs/environment-test.yml') }}
      - name: Cache multiple paths
        uses: actions/cache@v3
        env:
          # Increase this value to reset cache if requirements.txt has not changed
          CACHE_NUMBER: 0
        with:
          path: |
            ~/.cache/pip
            $RUNNER_TOOL_CACHE/Python/*
            ~\AppData\Local\pip\Cache
          key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{
            hashFiles('requirements.txt') }}
      - uses: conda-incubator/setup-miniconda@v2
        with:
          miniforge-variant: Mambaforge
          miniforge-version: latest
          mamba-version: "*"
          activate-environment: pymc-test
          channel-priority: strict
          environment-file: conda-envs/environment-test.yml
          python-version: "3.9"  # Run pre-commit on oldest supported Python version
          use-mamba: true
          use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267
      - name: Install-pymc and mypy dependencies
        run: |
          conda activate pymc-test
          pip install -e .
          pip install --pre -U polyagamma
          python --version
      - name: Run mypy
        run: |
          conda activate pymc-test
          python ./scripts/run_mypy.py --verbose

env:
  PIP_INDEX_URL: http://localhost:8629/2024-01-09
  UV_INDEX_URL: http://localhost:8629/2024-01-09


Failed build logs:
step_name: pre-commit/4_Run pre-commitaction@v3.0.0.txt
log: ##[group]Run pre-commit/action@v3.0.0
with:
  extra_args: --all-files
env:
  SKIP: no-commit-to-branch
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
##[group]Run python -m pip install pre-commit
[36;1mpython -m pip install pre-commit[0m
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  SKIP: no-commit-to-branch
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
Collecting pre-commit
  Downloading pre_commit-3.6.0-py2.py3-none-any.whl.metadata (1.3 kB)
Collecting cfgv>=2.0.0 (from pre-commit)
  Downloading cfgv-3.4.0-py2.py3-none-any.whl.metadata (8.5 kB)
Collecting identify>=1.0.0 (from pre-commit)
  Downloading identify-2.5.33-py2.py3-none-any.whl.metadata (4.4 kB)
Collecting nodeenv>=0.11.1 (from pre-commit)
  Downloading nodeenv-1.8.0-py2.py3-none-any.whl.metadata (21 kB)
Collecting pyyaml>=5.1 (from pre-commit)
  Downloading PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
Collecting virtualenv>=20.10.0 (from pre-commit)
  Downloading virtualenv-20.25.0-py3-none-any.whl.metadata (4.5 kB)
Requirement already satisfied: setuptools in /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages (from nodeenv>=0.11.1->pre-commit) (58.1.0)
Collecting distlib<1,>=0.3.7 (from virtualenv>=20.10.0->pre-commit)
  Downloading distlib-0.3.8-py2.py3-none-any.whl.metadata (5.1 kB)
Collecting filelock<4,>=3.12.2 (from virtualenv>=20.10.0->pre-commit)
  Downloading filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
Collecting platformdirs<5,>=3.9.1 (from virtualenv>=20.10.0->pre-commit)
  Downloading platformdirs-4.1.0-py3-none-any.whl.metadata (11 kB)
Downloading pre_commit-3.6.0-py2.py3-none-any.whl (204 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 204.0/204.0 kB 15.0 MB/s eta 0:00:00
Downloading cfgv-3.4.0-py2.py3-none-any.whl (7.2 kB)
Downloading identify-2.5.33-py2.py3-none-any.whl (98 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.9/98.9 kB 29.3 MB/s eta 0:00:00
Downloading nodeenv-1.8.0-py2.py3-none-any.whl (22 kB)
Downloading PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (738 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 738.9/738.9 kB 62.7 MB/s eta 0:00:00
Downloading virtualenv-20.25.0-py3-none-any.whl (3.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 94.8 MB/s eta 0:00:00
Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 kB 74.7 MB/s eta 0:00:00
Downloading filelock-3.13.1-py3-none-any.whl (11 kB)
Downloading platformdirs-4.1.0-py3-none-any.whl (17 kB)
Installing collected packages: distlib, pyyaml, platformdirs, nodeenv, identify, filelock, cfgv, virtualenv, pre-commit
Successfully installed cfgv-3.4.0 distlib-0.3.8 filelock-3.13.1 identify-2.5.33 nodeenv-1.8.0 platformdirs-4.1.0 pre-commit-3.6.0 pyyaml-6.0.1 virtualenv-20.25.0

[notice] A new release of pip is available: 23.0.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
##[group]Run python -m pip freeze --local
[36;1mpython -m pip freeze --local[0m
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  SKIP: no-commit-to-branch
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
cfgv==3.4.0
distlib==0.3.8
filelock==3.13.1
identify==2.5.33
nodeenv==1.8.0
platformdirs==4.1.0
pre-commit==3.6.0
PyYAML==6.0.1
virtualenv==20.25.0
##[group]Run actions/cache@v3
with:
  path: ~/.cache/pre-commit
  key: pre-commit-3|/opt/hostedtoolcache/Python/3.9.18/x64|85a42e0c0d7ae6174d79f49ec88a69ec255502eb51f27814478804e4cfd430f9
  enableCrossOsArchive: false
  fail-on-cache-miss: false
  lookup-only: false
env:
  SKIP: no-commit-to-branch
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
Cache Size: ~74 MB (77731725 B)
[command]/usr/bin/tar -xf /home/runner/work/_temp/64e9f7f2-65c6-4b3f-bffb-599fde6080b8/cache.tzst -P -C /home/runner/work/pymc/pymc --use-compress-program unzstd
Received 77731725 of 77731725 (100.0%), 74.0 MBs/sec
Cache restored successfully
Cache restored from key: pre-commit-3|/opt/hostedtoolcache/Python/3.9.18/x64|85a42e0c0d7ae6174d79f49ec88a69ec255502eb51f27814478804e4cfd430f9
##[group]Run pre-commit run --show-diff-on-failure --color=always --all-files
[36;1mpre-commit run --show-diff-on-failure --color=always --all-files[0m
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  SKIP: no-commit-to-branch
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
check for merge conflicts............................................................[42mPassed[m
check toml...........................................................................[42mPassed[m
check yaml...........................................................................[42mPassed[m
debug statements (python)............................................................[42mPassed[m
fix end of files.....................................................................[42mPassed[m
don't commit to branch..............................................................[43;30mSkipped[m
fix requirements.txt.................................................................[42mPassed[m
trim trailing whitespace.............................................................[42mPassed[m
Apply Apache 2.0 License.............................................................[42mPassed[m
pyupgrade............................................................................[42mPassed[m
ruff.................................................................................[41mFailed[m
[2m- hook id: ruff[m
[2m- files were modified by this hook[m

Found 5 errors (5 fixed, 0 remaining).

ruff-format..........................................................................[42mPassed[m
pydocstyle...........................................................................[42mPassed[m
Disallow print statements............................................................[42mPassed[m
Check no tests are ignored...........................................................[42mPassed[m
Generate pip dependency from conda...................................................[42mPassed[m
No relative imports..................................................................[42mPassed[m
Check no links that should be cross-references are in the docs.......................[42mPassed[m
pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:
[1mdiff --git a/docs/source/conf.py b/docs/source/conf.py[m
[1mindex 9ef1d52..4dba6d9 100755[m
[1m--- a/docs/source/conf.py[m
[1m+++ b/docs/source/conf.py[m
[36m@@ -16,6 +16,7 @@[m
 # serve to show the default.[m
 [m
 import os[m
[32m+[m
 from pathlib import Path[m
 [m
 import pymc[m
[1mdiff --git a/pymc/distributions/multivariate.py b/pymc/distributions/multivariate.py[m
[1mindex 570c139..03ea4f3 100644[m
[1m--- a/pymc/distributions/multivariate.py[m
[1m+++ b/pymc/distributions/multivariate.py[m
[36m@@ -30,9 +30,8 @@[m [mfrom pytensor.graph.op import Op[m
 from pytensor.raise_op import Assert[m
 from pytensor.sparse.basic import sp_sum[m
 from pytensor.tensor import TensorConstant, gammaln, sigmoid[m
[31m-from pytensor.tensor.linalg import cholesky, det, eigh[m
[32m+[m[32mfrom pytensor.tensor.linalg import cholesky, det, eigh, solve_triangular, trace[m
 from pytensor.tensor.linalg import inv as matrix_inverse[m
[31m-from pytensor.tensor.linalg import solve_triangular, trace[m
 from pytensor.tensor.random.basic import dirichlet, multinomial, multivariate_normal[m
 from pytensor.tensor.random.op import RandomVariable[m
 from pytensor.tensor.random.utils import ([m
[1mdiff --git a/pymc/distributions/transforms.py b/pymc/distributions/transforms.py[m
[1mindex 3e2a5a0..7c0d971 100644[m
[1m--- a/pymc/distributions/transforms.py[m
[1m+++ b/pymc/distributions/transforms.py[m
[36m@@ -18,6 +18,7 @@[m [mfrom functools import singledispatch[m
 import numpy as np[m
 import pytensor.tensor as pt[m
 [m
[32m+[m
 # ignore mypy error because it somehow considers that[m
 # "numpy.core.numeric has no attribute normalize_axis_tuple"[m
 from numpy.core.numeric import normalize_axis_tuple  # type: ignore[m
[1mdiff --git a/pymc/math.py b/pymc/math.py[m
[1mindex ddfcaa4..7c9ceaa 100644[m
[1m--- a/pymc/math.py[m
[1m+++ b/pymc/math.py[m
[36m@@ -27,7 +27,6 @@[m [mimport scipy.sparse[m
 [m
 from pytensor.graph.basic import Apply[m
 from pytensor.graph.op import Op[m
[31m-[m
 from pytensor.tensor import ([m
     abs,[m
     and_,[m
[36m@@ -98,7 +97,6 @@[m [mfrom scipy.linalg import block_diag as scipy_block_diag[m
 [m
 from pymc.pytensorf import floatX, ix_, largest_common_dtype[m
 [m
[31m-[m
 __all__ = [[m
     "abs",[m
     "and_",[m
[1mdiff --git a/tests/distributions/test_mixture.py b/tests/distributions/test_mixture.py[m
[1mindex 8dfa5a8..be3e1bc 100644[m
[1m--- a/tests/distributions/test_mixture.py[m
[1m+++ b/tests/distributions/test_mixture.py[m
[36m@@ -14,7 +14,6 @@[m
 [m
 import warnings[m
 [m
[31m-[m
 import numpy as np[m
 import pytensor[m
 import pytest[m
##[error]Process completed with exit code 1.


Changed files:
docs/source/conf.py
pymc/distributions/multivariate.py
pymc/distributions/transforms.py
pymc/math.py
tests/distributions/test_mixture.py

Fix diff:
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 9ef1d527a..4dba6d9f7 100755
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -16,6 +16,7 @@
 # serve to show the default.
 
 import os
+
 from pathlib import Path
 
 import pymc
diff --git a/pymc/distributions/multivariate.py b/pymc/distributions/multivariate.py
index 570c13988..03ea4f3a5 100644
--- a/pymc/distributions/multivariate.py
+++ b/pymc/distributions/multivariate.py
@@ -30,9 +30,8 @@ from pytensor.graph.op import Op
 from pytensor.raise_op import Assert
 from pytensor.sparse.basic import sp_sum
 from pytensor.tensor import TensorConstant, gammaln, sigmoid
-from pytensor.tensor.linalg import cholesky, det, eigh
+from pytensor.tensor.linalg import cholesky, det, eigh, solve_triangular, trace
 from pytensor.tensor.linalg import inv as matrix_inverse
-from pytensor.tensor.linalg import solve_triangular, trace
 from pytensor.tensor.random.basic import dirichlet, multinomial, multivariate_normal
 from pytensor.tensor.random.op import RandomVariable
 from pytensor.tensor.random.utils import (
diff --git a/pymc/distributions/transforms.py b/pymc/distributions/transforms.py
index 3e2a5a069..7c0d97100 100644
--- a/pymc/distributions/transforms.py
+++ b/pymc/distributions/transforms.py
@@ -18,6 +18,7 @@ from functools import singledispatch
 import numpy as np
 import pytensor.tensor as pt
 
+
 # ignore mypy error because it somehow considers that
 # "numpy.core.numeric has no attribute normalize_axis_tuple"
 from numpy.core.numeric import normalize_axis_tuple  # type: ignore
diff --git a/pymc/math.py b/pymc/math.py
index ddfcaa44d..7c9ceaa9e 100644
--- a/pymc/math.py
+++ b/pymc/math.py
@@ -27,7 +27,6 @@ import scipy.sparse
 
 from pytensor.graph.basic import Apply
 from pytensor.graph.op import Op
-
 from pytensor.tensor import (
     abs,
     and_,
@@ -98,7 +97,6 @@ from scipy.linalg import block_diag as scipy_block_diag
 
 from pymc.pytensorf import floatX, ix_, largest_common_dtype
 
-
 __all__ = [
     "abs",
     "and_",
diff --git a/tests/distributions/test_mixture.py b/tests/distributions/test_mixture.py
index 8dfa5a8ca..be3e1bcbd 100644
--- a/tests/distributions/test_mixture.py
+++ b/tests/distributions/test_mixture.py
@@ -14,7 +14,6 @@
 
 import warnings
 
-
 import numpy as np
 import pytensor
 import pytest