Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file contains configuration for the automatic generation of release notes in GitHub.
# It's not perfect, but it makes it a little less laborious to write informative release notes.
# Also see https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
changelog:
exclude:
labels:
- no releasenotes
categories:
- title: Major Changes 🛠
labels:
- major
- title: New Features 🎉
labels:
- enhancements
- feature request
- title: Bugfixes 🪲
labels:
- bug
- title: Documentation 📖
labels:
- docs
- title: Maintenance 🔧
labels:
- "*"
46 changes: 46 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: PyPI
on:
pull_request:
branches: [main]
push:
branches: [main]
release:
types: [published]

jobs:
build:
name: build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
- name: Build the sdist and the wheel
run: |
pip install build
python3 -m build
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: artifact
path: dist/*

publish:
name: upload release to PyPI
needs: [build]
runs-on: ubuntu-latest
if: github.repository_owner == 'bwengals' && github.event_name == 'release' && github.event.action == 'published'
# Use the `release` GitHub environment to protect the Trusted Publishing (OIDC)
# workflow by requiring signoff from a maintainer.
environment: release
permissions:
# write id-token is necessary for trusted publishing (OIDC)
id-token: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: pytest

on:
pull_request:
push:
branches: [main]
paths:
- ".github/workflows/*"
- "ptgp/**"
- "tests/**"
- "pyproject.toml"
- "conda_envs/**"

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
test:
strategy:
matrix:
include:
- os: ubuntu-latest
python-version: "3.13"
shell: bash -leo pipefail {0}
- os: windows-latest
python-version: "3.12"
shell: cmd /C call {0}
fail-fast: false
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7
with:
environment-file: conda_envs/environment-test.yaml
create-args: >-
python=${{ matrix.python-version }}
environment-name: ptgp-test
init-shell: ${{ matrix.os == 'windows-latest' && 'cmd.exe' || 'bash' }}
cache-environment: true
- name: Install ptgp
run: |
pip install -e .
python --version
- name: Run tests
run: |
python -m pytest --color=yes -vv --durations=50 tests/
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Don't check in hatch-vcs generated version file
ptgp/_version.py


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -174,3 +178,4 @@ cython_debug/

# PyPI configuration file
.pypirc
.idea/
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ci:
autofix_prs: false

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: no-commit-to-branch
args: [--branch, main]
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
hooks:
- id: ruff
args: [ --fix, --unsafe-fixes, --exit-non-zero-on-fix ]
- id: ruff-format
types_or: [ python, pyi, jupyter ]

- repo: https://github.com/MarcoGorelli/madforhooks
rev: 0.4.1
hooks:
- id: no-print-statements
files: ^ptgp/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ Requires the `assumption-system` branch of PyTensor:

```bash
pip install git+https://github.com/jessegrabowski/pytensor@assumption-system
```
```
15 changes: 15 additions & 0 deletions conda_envs/environment-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: ptgp-test
channels:
- conda-forge
dependencies:
- python>=3.12
- jax
- jaxlib
- optax
- numpy
- pytest
- gpjax
- pip
- pip:
- git+https://github.com/jessegrabowski/pytensor@assumption-system
- git+https://github.com/pymc-devs/pymc@v6
5 changes: 4 additions & 1 deletion environment.yaml → conda_envs/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: ptgp
channels:
- conda-forge
dependencies:
- python>=3.11
- python>=3.12
#- pymc # installed from v6 branch via pip
- jax
- jaxlib
Expand All @@ -19,7 +19,10 @@ dependencies:
- seaborn
- pandas
- scikit-learn
- pre-commit
- pytest
#- arviz # installed via pip (arviz 1.x + arviz-base + arviz-plots)
- pymc
- pip
- pip:
- git+https://github.com/jessegrabowski/pytensor@assumption-system
Expand Down
2 changes: 1 addition & 1 deletion notebooks/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ with pm.Model() as vfe_model:

train_step_vfe, shared_params_vfe, shared_extras_vfe = pg.compile_training_step(
pg.collapsed_elbo, vfe, X_var, y_var,
pm_model=vfe_model,
pm_model=vfe_model,
extra_vars=[Z_var],
extra_init=[Z_init],
learning_rate=1e-2,
Expand Down
Loading