Skip to content

Commit 350513f

Browse files
committed
merge dev
2 parents 7e3911b + 52bdb58 commit 350513f

File tree

318 files changed

+10759
-6140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

318 files changed

+10759
-6140
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug report
3+
about: Create a bug report to help us improve BayesFlow
4+
title: "[BUG]"
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Minimal steps to reproduce the behavior:
15+
1. Import '...'
16+
2. Create network '....'
17+
3. Call '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Traceback**
24+
If you encounter an error, please provide a complete traceback to help explain your problem.
25+
26+
**Environment**
27+
- OS: [e.g. Ubuntu]
28+
- Python Version: [e.g. 3.11]
29+
- Backend: [e.g. jax, tensorflow, pytorch]
30+
- BayesFlow Version: [e.g. 2.0.2]
31+
32+
**Additional context**
33+
Add any other context about the problem here.
34+
35+
**Minimality**
36+
- [ ] I verify that my example is minimal, does not rely on third-party packages, and is most likely an issue in BayesFlow.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest a new feature to be implemented in BayesFlow
4+
title: "[FEATURE]"
5+
labels: feature
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/workflows/publish.yaml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,53 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI
12

2-
name: Publish to PyPI.org
33
on:
44
release:
55
types: [published]
6+
67
jobs:
7-
pypi:
8+
build:
9+
name: Build distribution 📦
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
persist-credentials: false
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.x"
20+
- name: Install pypa/build
21+
run: >-
22+
python3 -m
23+
pip install
24+
build
25+
--user
26+
- name: Build a binary wheel and a source tarball
27+
run: python3 -m build
28+
- name: Store the distribution packages
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: python-package-distributions
32+
path: dist/
33+
34+
publish-to-pypi:
35+
name: >-
36+
Publish Python 🐍 distribution 📦 to PyPI
37+
needs:
38+
- build
839
runs-on: ubuntu-latest
40+
environment:
41+
name: pypi
42+
url: https://pypi.org/p/bayesflow # Replace <package-name> with your PyPI project name
43+
permissions:
44+
id-token: write # IMPORTANT: mandatory for trusted publishing
45+
946
steps:
10-
- name: Checkout
11-
uses: actions/checkout@v4
12-
with:
13-
fetch-depth: 0
14-
- run: python3 -m pip install -U build && python3 -m build
15-
- name: Publish package
16-
uses: pypa/gh-action-pypi-publish@release/v1
17-
with:
18-
password: ${{ secrets.PYPI_API_TOKEN }}
47+
- name: Download all the dists
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: python-package-distributions
51+
path: dist/
52+
- name: Publish distribution 📦 to PyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/style.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Check Code Style
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
- dev
9+
push:
10+
branches:
11+
- main
12+
- dev
13+
14+
jobs:
15+
check-code-style:
16+
name: Check Code Style
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout Repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.10"
28+
29+
- name: Install Ruff
30+
run: |
31+
pip install -U pip setuptools wheel
32+
pip install ruff
33+
34+
- name: Run Linter
35+
run: ruff check --config pyproject.toml --verbose
36+
37+
- name: Run Formatter
38+
run: ruff format --config pyproject.toml --check --verbose

.github/workflows/tests.yaml

Lines changed: 42 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
name: Tests
2+
name: Multi-Backend Tests
33

44
on:
55
workflow_dispatch:
@@ -12,93 +12,80 @@ on:
1212
- main
1313
- dev
1414

15+
defaults:
16+
run:
17+
shell: bash
1518

16-
jobs:
17-
lint:
18-
runs-on: ubuntu-latest
19-
defaults:
20-
run:
21-
shell: bash -el {0}
22-
23-
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@v4
26-
27-
- name: Set up Conda
28-
uses: conda-incubator/setup-miniconda@v3
29-
with:
30-
environment-file: environment.yaml
31-
python-version: "3.10"
32-
33-
- name: Show Environment Info
34-
run: |
35-
conda info
36-
conda list
37-
conda config --show-sources
38-
conda config --show
39-
printenv | sort
40-
41-
- name: Run Linter
42-
run: |
43-
ruff check --config pyproject.toml --verbose
44-
45-
- name: Run Formatter
46-
run: |
47-
ruff format --check --config pyproject.toml --verbose
4819

20+
jobs:
4921
test:
50-
runs-on: ${{ matrix.os }}
22+
name: Run Multi-Backend Tests
23+
5124
strategy:
52-
fail-fast: false
5325
matrix:
5426
os: [ubuntu-latest, windows-latest]
55-
python-version: ["3.10", "3.11"]
27+
python-version: ["3.10"] # we usually only need to test the oldest python version
5628
backend: ["jax", "tensorflow", "torch"]
57-
defaults:
58-
run:
59-
shell: bash -el {0}
29+
30+
runs-on: ${{ matrix.os }}
31+
6032
env:
6133
KERAS_BACKEND: ${{ matrix.backend }}
6234

6335
steps:
64-
- name: Checkout code
36+
- name: Checkout Repository
6537
uses: actions/checkout@v4
6638

67-
- name: Set up Conda
68-
uses: conda-incubator/setup-miniconda@v3
39+
- name: Set up Python
40+
uses: actions/setup-python@v5
6941
with:
70-
environment-file: environment.yaml
7142
python-version: ${{ matrix.python-version }}
7243

44+
- name: Install Dependencies
45+
run: |
46+
python -m pip install -U pip setuptools wheel
47+
pip install .[test]
48+
7349
- name: Install JAX
7450
if: ${{ matrix.backend == 'jax' }}
7551
run: |
7652
pip install -U jax
77-
- name: Install NumPy
78-
if: ${{ matrix.backend == 'numpy' }}
79-
run: |
80-
conda install numpy
81-
- name: Install Tensorflow
53+
54+
- name: Install TensorFlow
8255
if: ${{ matrix.backend == 'tensorflow' }}
8356
run: |
8457
pip install -U tensorflow
58+
8559
- name: Install PyTorch
8660
if: ${{ matrix.backend == 'torch' }}
8761
run: |
88-
conda install pytorch torchvision torchaudio cpuonly -c pytorch
62+
pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
8963
9064
- name: Show Environment Info
9165
run: |
92-
conda info
93-
conda list
94-
conda config --show-sources
95-
conda config --show
66+
python --version
67+
pip --version
9668
printenv | sort
97-
conda env export
69+
pip list
9870
9971
- name: Run Tests
10072
run: |
101-
pytest -x
73+
pytest -x -m "not slow"
74+
75+
- name: Run Slow Tests
76+
# Run slow tests on manual trigger and pushes/PRs to main.
77+
# Limit to one OS and Python version to save compute.
78+
# Multiline if statements are weird, https://github.com/orgs/community/discussions/25641,
79+
# but feel free to convert it.
80+
if: ${{ ((github.event_name == 'workflow_dispatch') || (github.event_name == 'push' && github.ref_name == 'main') || (github.event_name == 'pull_request' && github.base_ref == 'main')) && ((matrix.os == 'windows-latest') && (matrix.python-version == '3.10')) }}
81+
run: |
82+
pytest -m "slow"
83+
84+
- name: Upload test results to Codecov
85+
if: ${{ !cancelled() }}
86+
uses: codecov/codecov-action@v4
87+
with:
88+
token: ${{ secrets.CODECOV_TOKEN }}
10289

10390
- name: Create Coverage Report
10491
run: |

0 commit comments

Comments
 (0)