diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..566d4a5 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 + diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml new file mode 100644 index 0000000..b89347d --- /dev/null +++ b/.github/workflows/run_tests.yml @@ -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 + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b6e5bff --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 + diff --git a/README.md b/README.md index cde2ab5..24547cc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/benchmarks/optimistix_example.py b/benchmarks/optimistix_example.py index ad1a614..ff16466 100644 --- a/benchmarks/optimistix_example.py +++ b/benchmarks/optimistix_example.py @@ -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. """ diff --git a/pyproject.toml b/pyproject.toml index b30d982..4edf830 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [ @@ -33,3 +33,6 @@ dev = [ ] [tool.hatch.metadata] allow-direct-references = true + +[tool.hatch.build.targets.wheel] +packages = ["src/grapevine"] diff --git a/tests/simple_example_problem.py b/tests/simple_example_problem.py index eca84c2..c8025a6 100644 --- a/tests/simple_example_problem.py +++ b/tests/simple_example_problem.py @@ -1,4 +1,5 @@ """Simple example problems for other tests to use.""" + from functools import partial from jax.scipy.special import expit