Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs and test #171

Merged
merged 12 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
69 changes: 69 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,39 @@ orbs:
python: circleci/python@2.1.1
codecov: codecov/codecov@3.2.2

commands:
install_pandoc:
description: "Install pandoc"
parameters:
pandoc_url:
type: string
pandoc_dest:
type: string
steps:
- restore_cache:
keys:
- pandoc-download
- run:
name: Install pandoc
command: |
if [ ! -f "~/pandoc.tar.gz" ]; then
wget << parameters.pandoc_url >> -O ~/pandoc.tar.gz
fi
sudo tar xvzf ~/pandoc.tar.gz --strip-components 1 -C << parameters.pandoc_dest >>
- save_cache:
key: pandoc-download
paths:
- ~/pandoc.tar.gz

jobs:
build-and-test:
docker:
- image: cimg/python:3.8.0
steps:
- checkout
- restore_cache:
keys:
- pip-cache
- run:
name: Update pip
command: pip install --upgrade pip
Expand All @@ -25,8 +52,46 @@ jobs:
curl -Os https://uploader.codecov.io/v0.1.0_4653/linux/codecov
chmod +x codecov
./codecov -t ${CODECOV_TOKEN}
- save_cache:
key: pip-cache
paths:
- ~/.cache/pip
- codecov/upload:
file: coverage.xml
build-docs:
docker:
- image: cimg/python:3.8.0
steps:
- checkout
- restore_cache:
keys:
- pip-cache-doc
- run:
name: Update pip
command: pip install --upgrade pip
- python/install-packages:
pkg-manager: pip-dist
path-args: .[dev]
# Install requirements for docs within docs/requirements.txt
- run:
name: Install docs requirements
command: pip install -r docs/requirements.txt
- save_cache:
key: pip-cache-doc
paths:
- ~/.cache/pip
- install_pandoc:
pandoc_url: "https://github.com/jgm/pandoc/releases/download/2.10/pandoc-2.10-linux-amd64.tar.gz"
pandoc_dest: "/usr/local/"
- run:
name: Build docs
no_output_timeout: 20m
command: |
cd docs
make html
- store_artifacts:
path: docs/_build/html
destination: docs

publish:
docker:
Expand Down Expand Up @@ -97,6 +162,10 @@ workflows:
filters: # required since `deploy` has tag filters AND requires `build`
tags:
only: /.*/
- build-docs:
filters: # required since `deploy` has tag filters AND requires `build`
tags:
only: /.*/
- publish:
requires:
- build-and-test
Expand Down
3 changes: 2 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SPHINXOPTS = -j auto
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# NCORES ?= $(shell nproc)

# Put it first so that "make" without argument is like "make help".
help:
Expand All @@ -12,4 +13,4 @@ help:
.PHONY: help Makefile

%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) # -j $(NCORES)
11 changes: 9 additions & 2 deletions docs/_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,17 @@ Configuration
.. automodule:: gpjax.config
.. currentmodule:: gpjax.config

.. autofunction:: add_parameter

.. autofunction:: get_defaults
.. autofunction:: get_global_config_if_exists

.. autofunction:: add_parameter
.. autofunction:: get_default_config

.. autofunction:: update_x64_sensitive_settings

.. autofunction:: get_global_config

.. autofunction:: reset_global_config


Quadrature
Expand Down
11 changes: 8 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

from importlib_metadata import version

import docs.conf_sphinx_patch


def read(*names, **kwargs):
"""Function to decode a read files. Credit GPyTorch."""
Expand Down Expand Up @@ -59,7 +57,14 @@ def find_version(*file_paths):
author = "Thomas Pinder"

# The full version, including alpha/beta/rc tags
version = find_version("gpjax", "__init__.py")
import sys
from os.path import join, pardir, dirname

sys.path.insert(0, join(dirname(__file__), pardir))

import gpjax

version = gpjax.__version__
release = version


Expand Down
2 changes: 1 addition & 1 deletion examples/barycentres.pct.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def wasserstein_barycentres(
cov_stack = jnp.stack(covariances)
stack_sqrt = jax.vmap(sqrtm)(cov_stack)

def step(covariance_candidate: jax.Array):
def step(covariance_candidate: jax.Array, idx: None):
inner_term = jax.vmap(sqrtm)(
jnp.matmul(jnp.matmul(stack_sqrt, covariance_candidate), stack_sqrt)
)
Expand Down
1 change: 1 addition & 0 deletions examples/classification.pct.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from jaxtyping import Array, Float
from jaxutils import Dataset
import jaxkern as jk
import jax

import gpjax as gpx

Expand Down
Loading