Repository: pymc-devs/pymc (branch: dev_min_discrete)
Commit date: 2024-01-09T14:51:16Z

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 13.4 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 22.9 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 60.9 MB/s eta 0:00:00
Downloading virtualenv-20.25.0-py3-none-any.whl (3.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 110.7 MB/s eta 0:00:00
Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 kB 74.1 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|b7d4a4a04370b550519b1f72b5bf6dd4b4e69a4587d4158fa35a817d3fb6ebbb
  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: ~96 MB (101090557 B)
[command]/usr/bin/tar -xf /home/runner/work/_temp/8c13d2fc-c290-4a58-9ce5-065f84e25152/cache.tzst -P -C /home/runner/work/pymc/pymc --use-compress-program unzstd
Received 101090557 of 101090557 (100.0%), 96.3 MBs/sec
Cache restored successfully
Cache restored from key: pre-commit-3|/opt/hostedtoolcache/Python/3.9.18/x64|b7d4a4a04370b550519b1f72b5bf6dd4b4e69a4587d4158fa35a817d3fb6ebbb
##[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
isort................................................................................[42mPassed[m
pyupgrade............................................................................[42mPassed[m
black................................................................................[41mFailed[m
[2m- hook id: black[m
[2m- files were modified by this hook[m

[1mreformatted tests/logprob/test_transforms.py[0m

[1mAll done! ✨ 🍰 ✨[0m
[34m[1m1 file [0m[1mreformatted[0m, [34m207 files [0mleft unchanged.

black-jupyter........................................................................[42mPassed[m
pylint...............................................................................[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/tests/logprob/test_transforms.py b/tests/logprob/test_transforms.py[m
[1mindex 3409afd..acf7296 100644[m
[1m--- a/tests/logprob/test_transforms.py[m
[1m+++ b/tests/logprob/test_transforms.py[m
[36m@@ -699,7 +699,7 @@[m [mdef test_negated_discrete_rv_transform():[m
 [m
     # A negated Bernoulli has pmf {p if x == -1; 1-p if x == 0; 0 otherwise}[m
     assert logp_fn(-2) == -np.inf[m
[31m-    np.testing.assert_allclose(logp_fn(-1),  np.log(p))[m
[32m+[m[32m    np.testing.assert_allclose(logp_fn(-1), np.log(p))[m
     np.testing.assert_allclose(logp_fn(0), np.log(1 - p))[m
     assert logp_fn(1) == -np.inf[m
 [m
##[error]Process completed with exit code 1.


Changed files:
tests/logprob/test_transforms.py

Fix diff:
diff --git a/tests/logprob/test_transforms.py b/tests/logprob/test_transforms.py
index 3409afdb9..acf7296f4 100644
--- a/tests/logprob/test_transforms.py
+++ b/tests/logprob/test_transforms.py
@@ -699,7 +699,7 @@ def test_negated_discrete_rv_transform():
 
     # A negated Bernoulli has pmf {p if x == -1; 1-p if x == 0; 0 otherwise}
     assert logp_fn(-2) == -np.inf
-    np.testing.assert_allclose(logp_fn(-1),  np.log(p))
+    np.testing.assert_allclose(logp_fn(-1), np.log(p))
     np.testing.assert_allclose(logp_fn(0), np.log(1 - p))
     assert logp_fn(1) == -np.inf