Skip to content

Commit 09f15c4

Browse files
authored
Merge pull request #30 from GPflow/develop
Release 0.2.0.
2 parents 92f9eaa + d6e0113 commit 09f15c4

Some content is hidden

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

78 files changed

+26801
-1543
lines changed

.github/workflows/benchmark.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: benchmark
2+
3+
on:
4+
schedule:
5+
# * is a special character in YAML so you have to quote this string
6+
# 10:17 every Monday - A compromise between random and a convenient time:
7+
- cron: '17 10 * * 1'
8+
9+
env:
10+
penv: './poetryenv poetryenvs'
11+
run: 'run python benchmark'
12+
bex: 'benchmark/examples'
13+
res: 'gh-pages/benchmark_results'
14+
plots: 'gh-pages/docs/benchmark_plots/'
15+
16+
jobs:
17+
benchmark:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v3
22+
with:
23+
ref: gh-pages
24+
path: gh-pages
25+
- uses: actions/setup-python@v4
26+
with:
27+
python-version: "3.10"
28+
- name: Install
29+
run: |
30+
curl -sSL https://install.python-poetry.org | python3 -
31+
pip install -r poetryenv_requirements.txt
32+
${penv}/np_max install
33+
${penv}/tf_max install
34+
${penv}/jax_max install
35+
${penv}/torch_max install
36+
- name: Run benchmarks
37+
run: |
38+
${penv}/np_max ${run}/run_benchmark.py ${bex}/np_example.py ${res}
39+
${penv}/tf_max ${run}/run_benchmark.py ${bex}/tf_example.py ${res}
40+
${penv}/tf_max ${run}/run_benchmark.py ${bex}/tf_example.py --modifiers=no_compile ${res}
41+
${penv}/jax_max ${run}/run_benchmark.py ${bex}/jax_example.py ${res}
42+
${penv}/jax_max ${run}/run_benchmark.py ${bex}/jax_example.py --modifiers=no_jit ${res}
43+
${penv}/torch_max ${run}/run_benchmark.py ${bex}/torch_example.py ${res}
44+
- name: Plot benchmarks
45+
run: |
46+
${penv}/np_max ${run}/plot_benchmarks.py ${res}
47+
mkdir -p ${plots}
48+
mv ${res}/overhead.png ${plots}
49+
- name: Commit new benchmark results
50+
run: |
51+
cd gh-pages
52+
git add benchmark_results docs/benchmark_plots
53+
git config --global user.email "none"
54+
git config --global user.name "github-actions-bot"
55+
git commit -m "Run benchmarks."
56+
git push
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: build_test_deploy
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- gh-pages
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
test-base:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.10"
18+
- run: curl -sSL https://install.python-poetry.org | python3 -
19+
- run: poetry install
20+
- run: poetry run task test
21+
22+
test-versions:
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
framework: ["py", "np", "tf", "tfp", "jax", "torch"]
27+
version: ["min", "max"]
28+
include:
29+
- version: "min"
30+
python: "3.7"
31+
- version: "max"
32+
python: "3.10"
33+
34+
name: test-${{ matrix.framework }}-${{ matrix.version }}
35+
steps:
36+
- uses: actions/checkout@v3
37+
- uses: actions/setup-python@v4
38+
with:
39+
python-version: ${{ matrix.python }}
40+
- run: pip install -r poetryenv_requirements.txt
41+
- run: curl -sSL https://install.python-poetry.org | python3 -
42+
- run: ./poetryenv poetryenvs/${{ matrix.framework }}_${{ matrix.version }} install
43+
- run: ./poetryenv poetryenvs/${{ matrix.framework }}_${{ matrix.version }} run task test
44+
45+
all-tests:
46+
needs: [test-base, test-versions]
47+
runs-on: ubuntu-latest
48+
steps:
49+
- run: echo ok
50+
51+
docs:
52+
needs: all-tests
53+
if: contains(fromJson('["refs/heads/main", "refs/heads/develop"]'), github.ref)
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v3
58+
with:
59+
ref: gh-pages
60+
path: gh-pages
61+
- uses: actions/setup-python@v4
62+
with:
63+
python-version: "3.10"
64+
- run: curl -sSL https://install.python-poetry.org | python3 -
65+
- run: poetry install
66+
- run: poetry run task docs
67+
- name: Commit new documentation
68+
run: |
69+
branch=$(git symbolic-ref --short HEAD)
70+
rm -rf gh-pages/docs/${branch}
71+
mv docs_build gh-pages/docs/${branch}
72+
cd gh-pages
73+
git add docs
74+
git config --global user.email "none"
75+
git config --global user.name "github-actions-bot"
76+
git commit -m "Build documentation."
77+
git push
78+
79+
deploy:
80+
needs: all-tests
81+
if: github.event_name == 'release'
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v3
85+
- uses: actions/setup-python@v4
86+
with:
87+
python-version: "3.10"
88+
- run: curl -sSL https://install.python-poetry.org | python3 -
89+
- run: poetry build
90+
- run: poetry publish -u __token__ -p ${{ secrets.CHECK_SHAPES_PYPI_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ instance/
6969
.scrapy
7070

7171
# Sphinx documentation
72-
docs/_build/
72+
docs_build/
73+
docs_test/
7374

7475
# PyBuilder
7576
target/

CITATION.cff

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
cff-version: 1.2.0
2+
title: check_shapes
3+
message: >-
4+
If you use this software, please cite it using the
5+
metadata from this file.
6+
type: software
7+
authors:
8+
- given-names: Jesper
9+
family-names: Nielsen
10+
11+
affiliation: Secondmind
12+
repository-code: 'https://github.com/GPflow/check_shapes'
13+
abstract: >-
14+
A library for annotating and checking tensor
15+
shapes.
16+
license: Apache-2.0

CONTRIBUTING.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributing to `check_shapes`
2+
3+
This file contains notes for potential contributors to `check_shapes`, as well as some notes that may be helpful for maintenance.
4+
5+
## Project scope
6+
7+
The aim of `check_shapes` is to annotate and check the shapes of tensors. There are many other pre- and post conditions one could check, but to keep the scope reasonable we will limit ourselves to tensor shapes.
8+
9+
We welcome contributions to `check_shapes`. If you would like to contribute a feature, please raise discussion via a GitHub issue, to discuss the suitability of the feature within `check_shapes`. If the feature is outside the envisaged scope, we can still link to a separate project in our Readme.
10+
11+
### I have this big feature/extension I would like to add...
12+
13+
Due to limited scope we may not be able to review and merge every feature, however useful it may be. Particularly large contributions or changes to core code are harder to justify against the scope of the project or future development plans. We recommend discussing a possible contribution in an issue before work begins. This should give an indication to how broadly it is supported to bring it into the codebase.
14+
15+
## Code quality requirements
16+
17+
- Code must be covered by tests. We use the [pytest](https://docs.pytest.org/) framework.
18+
- The code must be documented. We use *reST* in docstrings. *reST* is a [standard way of documenting](http://docs.python-guide.org/en/latest/writing/documentation/) in python.
19+
Missing documentation leads to ambiguities and difficulties in understanding future contributions and use cases.
20+
- Use [type annotations](https://docs.python.org/3/library/typing.html). Type hints make code cleaner and _safer_ to some extent.
21+
- Python code should generally follow the *PEP8* style. We use some custom naming conventions (see below) to have our notation follow the Gaussian process literature. Use `pylint` and `mypy` for formatting and _type checking_.
22+
- Practise writing good code as far as is reasonable. Simpler is usually better. Reading the existing codebase should give a good idea of the expected style.
23+
- `check_shapes` uses [black](https://github.com/psf/black) and [isort](https://pycqa.github.io/isort/) for formatting.
24+
- You can use `poetry run task format_and_test` to check that your code follows the above requirements.
25+
26+
## Pull requests
27+
28+
If you think that your contribution falls within the project scope (see above) please submit a Pull Request (PR) to our GitHub page.
29+
(GitHub provides extensive documentation on [forking](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) and [pull requests](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests).)
30+
31+
In order to maintain code quality, and make life easy for the reviewers, please ensure that your PR:
32+
33+
- Only fixes one issue or adds one feature.
34+
- Makes the minimal amount of changes to the existing codebase.
35+
- Is testing its changes.
36+
- Passes all checks (formatting, types, tests - you can run them all locally using `poetry run task test` from the `check_shapes` root directory).
37+
38+
All code goes through a PR; there are no direct commits to the `main` and `develop` branches.
39+
40+
## Version numbering
41+
42+
The main purpose of versioning `check_shapes` is user convenience.
43+
44+
We use the [semantic versioning scheme](https://semver.org/). The semver implies `MAJOR.MINOR.PATCH` version scheme, where `MAJOR` changes when there are incompatibilities in API, `MINOR` means adding functionality without breaking existing API and `PATCH` presumes the code update has backward compatible bug fixes.
45+
46+
When incrementing the version number, this has to be reflected in `./pyproject.toml`.

CONTRIBUTORS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# List of contributors to `check_shapes`
2+
3+
Because GitHub's [graph of contributors](http://github.com/GPflow/GPflow/graphs/contributors) does not necessarily include all contributors, this file contains a list of all contributors, added by date of first contribution.
4+
5+
[@jesnie](https://github.com/jesnie)
6+
7+
Add yourself when you first contribute to `check_shapes`'s code, tests, or documentation!

HOWTO_RELEASE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# How to make a new `check_shapes` release
2+
3+
1. Bump the version numbers in the `develop` branch, in *BOTH* the
4+
[`pyproject.toml`](https://github.com/GPflow/check_shapes/blob/develop/pyproject.toml) file
5+
and the
6+
[`__init__`](https://github.com/GPflow/check_shapes/blob/develop/check_shapes/__init__.py).
7+
8+
2. Update [RELEASE.md](https://github.com/GPflow/check_shapes/blob/develop/RELEASE.md).
9+
- Make sure it contains up-to-date release notes for the next release.
10+
* They should cover all changes, that are visible to library userso on the `develop` branch
11+
since the most recent release.
12+
* They should make clear to users whether they might benefit from this release and what
13+
backwards incompatibilities they might face.
14+
- Make sure the release version matches what you were setting elsewhere.
15+
- Make a new copy of the template, to prepare for the next release.
16+
17+
3. Create a release PR from `develop` to `main`.
18+
- **Make a merge commit. DO NOT SQUASH-MERGE.**
19+
- If you squash-merge, `main` will be *ahead* of develop (by the squash-merge commit). This
20+
means we’ll end up with merge conflicts at the following release!
21+
22+
4. Go to the [release page on GitHub](https://github.com/GPflow/check_shapes/releases/new) and
23+
create a release for a tag “v{VERSION}” (e.g., for version 2.1.3 the tag needs to be `v2.1.3`) to
24+
`main` branch. Copy the release notes into the description field!
25+
26+
5. You are almost done now! Go to https://github.com/GPflow/check_shapes/actions and monitor the
27+
tests for your newly-created release passed and the job for pushing the pip package succeeded.
28+
GitHub Actions are triggered by the publication of the release above.
29+
30+
6. Take a break; wait until the new release
31+
[shows up on PyPi](https://pypi.org/project/check_shapes/#history).
32+
33+
34+
Done done! Go and celebrate our hard work :)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ To check you installation run our tests:
4848

4949
```bash
5050
poetry run task test
51-
```
51+
```
52+
53+
For testing with different versions of Python and dependencies, see the `poetryenv` script.

RELEASE.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
Release notes for all past releases are available in the ['Releases' section](https://github.com/GPflow/check_shapes/releases) of the `check_shapes` Repo. [HOWTO_RELEASE.md](HOWTO_RELEASE.md) explains just that.
2+
3+
# Release x.y.z (template for future releases)
4+
5+
<INSERT SMALL BLURB ABOUT RELEASE FOCUS AREA AND POTENTIAL TOOLCHAIN CHANGES>
6+
7+
## Breaking Changes
8+
9+
* <DOCUMENT BREAKING CHANGES HERE>
10+
* <THIS SECTION SHOULD CONTAIN API AND BEHAVIORAL BREAKING CHANGES>
11+
12+
## Known Caveats
13+
14+
* <CAVEATS REGARDING THE RELEASE (BUT NOT BREAKING CHANGES).>
15+
* <ADDING/BUMPING DEPENDENCIES SHOULD GO HERE>
16+
* <KNOWN LACK OF SUPPORT ON SOME PLATFORM SHOULD GO HERE>
17+
18+
## Major Features and Improvements
19+
20+
* <INSERT MAJOR FEATURE HERE, USING MARKDOWN SYNTAX>
21+
* <IF RELEASE CONTAINS MULTIPLE FEATURES FROM SAME AREA, GROUP THEM TOGETHER>
22+
23+
## Bug Fixes and Other Changes
24+
25+
* <SIMILAR TO ABOVE SECTION, BUT FOR OTHER IMPORTANT CHANGES / BUG FIXES>
26+
* <IF A CHANGE CLOSES A GITHUB ISSUE, IT SHOULD BE DOCUMENTED HERE>
27+
* <NOTES SHOULD BE GROUPED PER AREA>
28+
29+
## Thanks to our Contributors
30+
31+
This release contains contributions from:
32+
33+
<INSERT>, <NAME>, <HERE>, <USING>, <GITHUB>, <HANDLE>
34+
35+
36+
# Release 0.3.0 (next upcoming release in progress)
37+
38+
<INSERT SMALL BLURB ABOUT RELEASE FOCUS AREA AND POTENTIAL TOOLCHAIN CHANGES>
39+
40+
## Breaking Changes
41+
42+
* <DOCUMENT BREAKING CHANGES HERE>
43+
* <THIS SECTION SHOULD CONTAIN API AND BEHAVIORAL BREAKING CHANGES>
44+
45+
## Known Caveats
46+
47+
* <CAVEATS REGARDING THE RELEASE (BUT NOT BREAKING CHANGES).>
48+
* <ADDING/BUMPING DEPENDENCIES SHOULD GO HERE>
49+
* <KNOWN LACK OF SUPPORT ON SOME PLATFORM SHOULD GO HERE>
50+
51+
## Major Features and Improvements
52+
53+
* <INSERT MAJOR FEATURE HERE, USING MARKDOWN SYNTAX>
54+
* <IF RELEASE CONTAINS MULTIPLE FEATURES FROM SAME AREA, GROUP THEM TOGETHER>
55+
56+
## Bug Fixes and Other Changes
57+
58+
* <SIMILAR TO ABOVE SECTION, BUT FOR OTHER IMPORTANT CHANGES / BUG FIXES>
59+
* <IF A CHANGE CLOSES A GITHUB ISSUE, IT SHOULD BE DOCUMENTED HERE>
60+
* <NOTES SHOULD BE GROUPED PER AREA>
61+
62+
## Thanks to our Contributors
63+
64+
This release contains contributions from:
65+
66+
<INSERT>, <NAME>, <HERE>, <USING>, <GITHUB>, <HANDLE>
67+
68+
69+
# Release 0.2.0
70+
71+
This release makes `check_shapes` independent of the underlying framework.
72+
73+
## Major Features and Improvements
74+
75+
* Made `check_shapes` independent of tensor framework:
76+
- Made NumPy optional.
77+
- Made TensorFlow optional.
78+
- Made TensorFlow-Probability optional.
79+
- Added support for JAX.
80+
- Added support for PyTorch.
81+
* Added benchmarks and documentation of overhead imposed by `check_shapes`.
82+
83+
## Bug Fixes and Other Changes
84+
85+
* Fixed bug related to `tf.saved_model` and methods wrapped in `@check_shapes`.
86+
* Added support for TensorFlow-Probability `_TensorCoercible` objects.
87+
88+
## Thanks to our Contributors
89+
90+
This release contains contributions from:
91+
92+
jesnie
93+
94+
95+
# Release 0.1.0
96+
97+
Initial import from [GPflow](https://github.com/GPflow/GPflow) and experimental release.
98+
99+
## Thanks to our Contributors
100+
101+
This release contains contributions from:
102+
103+
jesnie

0 commit comments

Comments
 (0)