Skip to content

Commit

Permalink
Tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
teddygroves committed Oct 23, 2024
1 parent c555981 commit d72a3d8
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 4 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
release-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: build release distributions
run: |
python -m pip install pdm
pdm build
- name: upload windows dists
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
permissions:
id-token: write

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

43 changes: 43 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run tests

on:
push:
branches:
- '**'
tags-ignore:
- '**'

jobs:
build:

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.12]

steps:

- name: checkout code
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install pdm
run: pip install pdm

- name: pre-commit checks
uses: pre-commit/action@v2.0.3

- name: Run tests
run: |
pdm install --dev
pdm run pytest tests --cov=src
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.0
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# grapevine

JAX/Blackjax implementation of the grapevine method for reusing the solutions of guessing problems embedded in Hamiltonian trajectories.
JAX/Blackjax implementation of the grapevine method for reusing the solutions of guessing problems embedded in Hamiltonian trajectories.

The grapevine method can dramatically speed up MCMC for statistical with embedded equation solving problems.
The grapevine method can dramatically speed up MCMC for statistical with embedded equation solving problems.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/optimistix_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""An example comparing GrapeNUTS and NUTS on a representative problem.
This is supposed to be a complete example, mirroring how the grapevine method is used in practice.
This is supposed to be a complete example, mirroring how the grapevine method is used in practice.
"""
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "grapevine"
name = "grapevine-mcmc"
version = "0.1.0"
description = "Faster Hamiltonian trajectories for problems with guesses, using Blackjax"
authors = [
Expand Down Expand Up @@ -33,3 +33,6 @@ dev = [
]
[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/grapevine"]
1 change: 1 addition & 0 deletions tests/simple_example_problem.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Simple example problems for other tests to use."""

from functools import partial

from jax.scipy.special import expit
Expand Down

0 comments on commit d72a3d8

Please sign in to comment.