Skip to content

Commit ceac631

Browse files
ci: pre-commit hook to auto-format yaml files (#2112)
* ci: pre-commit hook to auto-format yaml files * fix test (#2113) --------- Co-authored-by: Juan Orduz <juanitorduz@gmail.com>
1 parent a62deeb commit ceac631

File tree

4 files changed

+153
-147
lines changed

4 files changed

+153
-147
lines changed

.github/workflows/ci.yml

Lines changed: 142 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ name: CI
44

55
on:
66
push:
7-
branches: [ master ]
7+
branches: [master]
88
pull_request:
9-
branches: [ master ]
9+
branches: [master]
1010

1111
env:
1212
PYTEST_ADDOPTS: "--cov=numpyro --cov-append"
@@ -17,37 +17,37 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
python-version: ["3.9","3.10","3.13"]
20+
python-version: ["3.9", "3.10", "3.13"]
2121

2222
steps:
23-
- uses: actions/checkout@v2
24-
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v2
26-
with:
27-
python-version: ${{ matrix.python-version }}
28-
- name: Install dependencies
29-
run: |
30-
sudo apt install -y pandoc gsfonts
31-
python -m pip install --upgrade pip
32-
pip install jaxlib
33-
pip install jax
34-
pip install '.[doc,test]'
35-
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
36-
pip install -r docs/requirements.txt
37-
pip freeze
38-
- name: Lint with mypy and ruff
39-
if: matrix.python-version != '3.9'
40-
run: |
41-
make lint
42-
- name: Build documentation
43-
if: matrix.python-version != '3.9'
44-
run: |
45-
make docs
46-
- name: Test documentation
47-
if: matrix.python-version != '3.9'
48-
run: |
49-
make doctest
50-
python -m doctest -v README.md
23+
- uses: actions/checkout@v2
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Install dependencies
29+
run: |
30+
sudo apt install -y pandoc gsfonts
31+
python -m pip install --upgrade pip
32+
pip install jaxlib
33+
pip install jax
34+
pip install '.[doc,test]'
35+
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
36+
pip install -r docs/requirements.txt
37+
pip freeze
38+
- name: Lint with mypy and ruff
39+
if: matrix.python-version != '3.9'
40+
run: |
41+
make lint
42+
- name: Build documentation
43+
if: matrix.python-version != '3.9'
44+
run: |
45+
make docs
46+
- name: Test documentation
47+
if: matrix.python-version != '3.9'
48+
run: |
49+
make doctest
50+
python -m doctest -v README.md
5151
5252
5353
test-modeling:
@@ -59,46 +59,46 @@ jobs:
5959
python-version: ["3.9", "3.13"]
6060

6161
steps:
62-
- uses: actions/checkout@v2
63-
- name: Set up Python ${{ matrix.python-version }}
64-
uses: actions/setup-python@v2
65-
with:
66-
python-version: ${{ matrix.python-version }}
67-
- name: Install dependencies
68-
run: |
69-
sudo apt install -y graphviz
70-
python -m pip install --upgrade pip
71-
# Keep track of pyro-api master branch
72-
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
73-
pip install jaxlib
74-
pip install jax
75-
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
76-
pip install -e '.[dev,test]'
77-
pip freeze
78-
- name: Test with pytest
79-
run: |
80-
CI=1 pytest -vs -k "not test_example" --durations=100 --ignore=test/infer/ --ignore=test/contrib/
81-
- name: Test x64
82-
run: |
83-
JAX_ENABLE_X64=1 pytest -vs test/test_distributions.py -k "powerLaw or Dagum"
84-
- name: Test tracer leak
85-
if: matrix.python-version == '3.13'
86-
env:
87-
JAX_CHECK_TRACER_LEAKS: 1
88-
run: |
89-
pytest -vs test/infer/test_mcmc.py::test_chain_inside_jit
90-
pytest -vs test/infer/test_mcmc.py::test_chain_jit_args_smoke
91-
pytest -vs test/infer/test_mcmc.py::test_reuse_mcmc_run
92-
pytest -vs test/infer/test_mcmc.py::test_model_with_multiple_exec_paths
93-
pytest -vs test/test_distributions.py::test_mean_var -k Gompertz
94-
95-
- name: Coveralls
96-
if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.13'
97-
uses: coverallsapp/github-action@v2
98-
with:
99-
github-token: ${{ secrets.GITHUB_TOKEN }}
100-
parallel: true
101-
flag-name: test-modeling
62+
- uses: actions/checkout@v2
63+
- name: Set up Python ${{ matrix.python-version }}
64+
uses: actions/setup-python@v2
65+
with:
66+
python-version: ${{ matrix.python-version }}
67+
- name: Install dependencies
68+
run: |
69+
sudo apt install -y graphviz
70+
python -m pip install --upgrade pip
71+
# Keep track of pyro-api master branch
72+
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
73+
pip install jaxlib
74+
pip install jax
75+
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
76+
pip install -e '.[dev,test]'
77+
pip freeze
78+
- name: Test with pytest
79+
run: |
80+
CI=1 pytest -vs -k "not test_example" --durations=100 --ignore=test/infer/ --ignore=test/contrib/
81+
- name: Test x64
82+
run: |
83+
JAX_ENABLE_X64=1 pytest -vs test/test_distributions.py -k "powerLaw or Dagum"
84+
- name: Test tracer leak
85+
if: matrix.python-version == '3.13'
86+
env:
87+
JAX_CHECK_TRACER_LEAKS: 1
88+
run: |
89+
pytest -vs test/infer/test_mcmc.py::test_chain_inside_jit
90+
pytest -vs test/infer/test_mcmc.py::test_chain_jit_args_smoke
91+
pytest -vs test/infer/test_mcmc.py::test_reuse_mcmc_run
92+
pytest -vs test/infer/test_mcmc.py::test_model_with_multiple_exec_paths
93+
pytest -vs test/test_distributions.py::test_mean_var -k Gompertz
94+
95+
- name: Coveralls
96+
if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.13'
97+
uses: coverallsapp/github-action@v2
98+
with:
99+
github-token: ${{ secrets.GITHUB_TOKEN }}
100+
parallel: true
101+
flag-name: test-modeling
102102

103103

104104
test-inference:
@@ -110,48 +110,48 @@ jobs:
110110
python-version: ["3.9", "3.13"]
111111

112112
steps:
113-
- uses: actions/checkout@v2
114-
- name: Set up Python ${{ matrix.python-version }}
115-
uses: actions/setup-python@v2
116-
with:
117-
python-version: ${{ matrix.python-version }}
118-
- name: Install dependencies
119-
run: |
120-
python -m pip install --upgrade pip
121-
# Keep track of pyro-api master branch
122-
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
123-
pip install jaxlib
124-
pip install jax
125-
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
126-
pip install -e '.[dev,test]'
127-
pip freeze
128-
- name: Test with pytest
129-
run: |
130-
pytest -vs --durations=20 test/infer/test_mcmc.py
131-
pytest -vs --durations=20 test/infer --ignore=test/infer/test_mcmc.py --ignore=test/contrib/test_nested_sampling.py
132-
pytest -vs --durations=20 test/contrib --ignore=test/contrib/stochastic_support/test_dcc.py
133-
- name: Test x64
134-
run: |
135-
JAX_ENABLE_X64=1 pytest -vs test/infer/test_mcmc.py -k x64
136-
- name: Test chains
137-
run: |
138-
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/infer/test_mcmc.py -k "chain or pmap or vmap"
139-
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/contrib/test_tfp.py -k "chain"
140-
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/contrib/stochastic_support/test_dcc.py
141-
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/infer/test_hmc_gibbs.py -k "chain"
142-
- name: Test custom prng
143-
run: |
144-
JAX_ENABLE_CUSTOM_PRNG=1 pytest -vs test/infer/test_mcmc.py
145-
- name: Test nested sampling
146-
run: |
147-
JAX_ENABLE_X64=1 pytest -vs test/contrib/test_nested_sampling.py
148-
- name: Coveralls
149-
if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.13'
150-
uses: coverallsapp/github-action@v2
151-
with:
152-
github-token: ${{ secrets.GITHUB_TOKEN }}
153-
parallel: true
154-
flag-name: test-inference
113+
- uses: actions/checkout@v2
114+
- name: Set up Python ${{ matrix.python-version }}
115+
uses: actions/setup-python@v2
116+
with:
117+
python-version: ${{ matrix.python-version }}
118+
- name: Install dependencies
119+
run: |
120+
python -m pip install --upgrade pip
121+
# Keep track of pyro-api master branch
122+
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
123+
pip install jaxlib
124+
pip install jax
125+
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
126+
pip install -e '.[dev,test]'
127+
pip freeze
128+
- name: Test with pytest
129+
run: |
130+
pytest -vs --durations=20 test/infer/test_mcmc.py
131+
pytest -vs --durations=20 test/infer --ignore=test/infer/test_mcmc.py --ignore=test/contrib/test_nested_sampling.py
132+
pytest -vs --durations=20 test/contrib --ignore=test/contrib/stochastic_support/test_dcc.py
133+
- name: Test x64
134+
run: |
135+
JAX_ENABLE_X64=1 pytest -vs test/infer/test_mcmc.py -k x64
136+
- name: Test chains
137+
run: |
138+
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/infer/test_mcmc.py -k "chain or pmap or vmap"
139+
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/contrib/test_tfp.py -k "chain"
140+
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/contrib/stochastic_support/test_dcc.py
141+
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/infer/test_hmc_gibbs.py -k "chain"
142+
- name: Test custom prng
143+
run: |
144+
JAX_ENABLE_CUSTOM_PRNG=1 pytest -vs test/infer/test_mcmc.py
145+
- name: Test nested sampling
146+
run: |
147+
JAX_ENABLE_X64=1 pytest -vs test/contrib/test_nested_sampling.py
148+
- name: Coveralls
149+
if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.13'
150+
uses: coverallsapp/github-action@v2
151+
with:
152+
github-token: ${{ secrets.GITHUB_TOKEN }}
153+
parallel: true
154+
flag-name: test-inference
155155

156156

157157
examples:
@@ -163,40 +163,40 @@ jobs:
163163
python-version: ["3.13"]
164164

165165
steps:
166-
- uses: actions/checkout@v2
167-
- name: Set up Python ${{ matrix.python-version }}
168-
uses: actions/setup-python@v2
169-
with:
170-
python-version: ${{ matrix.python-version }}
171-
- name: Install dependencies
172-
run: |
173-
python -m pip install --upgrade pip
174-
pip install jaxlib
175-
pip install jax
176-
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
177-
pip install -e '.[dev,examples,test]'
178-
pip freeze
179-
- name: Test with pytest
180-
run: |
181-
CI=1 XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs -k test_example
182-
- name: Coveralls
183-
if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.13'
184-
uses: coverallsapp/github-action@v2
185-
with:
186-
github-token: ${{ secrets.GITHUB_TOKEN }}
187-
parallel: true
188-
flag-name: examples
166+
- uses: actions/checkout@v2
167+
- name: Set up Python ${{ matrix.python-version }}
168+
uses: actions/setup-python@v2
169+
with:
170+
python-version: ${{ matrix.python-version }}
171+
- name: Install dependencies
172+
run: |
173+
python -m pip install --upgrade pip
174+
pip install jaxlib
175+
pip install jax
176+
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
177+
pip install -e '.[dev,examples,test]'
178+
pip freeze
179+
- name: Test with pytest
180+
run: |
181+
CI=1 XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs -k test_example
182+
- name: Coveralls
183+
if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.13'
184+
uses: coverallsapp/github-action@v2
185+
with:
186+
github-token: ${{ secrets.GITHUB_TOKEN }}
187+
parallel: true
188+
flag-name: examples
189189

190190

191191
finish:
192192

193193
needs: [test-modeling, test-inference, examples]
194194
runs-on: ubuntu-latest
195195
steps:
196-
- name: Coveralls finished
197-
uses: coverallsapp/github-action@v2
198-
with:
199-
github-token: ${{ secrets.GITHUB_TOKEN }}
200-
parallel-finished: true
201-
carryforward: "test-modeling,test-inference,examples"
196+
- name: Coveralls finished
197+
uses: coverallsapp/github-action@v2
198+
with:
199+
github-token: ${{ secrets.GITHUB_TOKEN }}
200+
parallel-finished: true
201+
carryforward: "test-modeling,test-inference,examples"
202202

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: Upload Python Package
1111

1212
on:
1313
release:
14-
types: [ published ]
14+
types: [published]
1515

1616
jobs:
1717
deploy:

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ repos:
4444
stages: [pre-commit, commit-msg]
4545
args: [--ignore-words-list, "Teh,aas,ans,dout", --check-filenames, --skip, "*.ipynb"]
4646

47+
# Format yaml files
48+
- repo: https://github.com/google/yamlfmt
49+
rev: v0.20.0
50+
hooks:
51+
- id: yamlfmt
52+
args: [-formatter, retain_line_breaks=true]

.readthedocs.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ build:
66
python: "3.10"
77

88
sphinx:
9-
configuration: docs/source/conf.py
9+
configuration: docs/source/conf.py
1010

1111
formats:
12-
- pdf
12+
- pdf
1313

1414
python:
15-
install:
16-
- requirements: docs/requirements.txt
15+
install:
16+
- requirements: docs/requirements.txt

0 commit comments

Comments
 (0)