Skip to content

Commit cb5a780

Browse files
authored
Cleanup for pypi release (#172)
* moved install method to poetry * updated contributing guidelines * moved changelog to kacl * updated github actions * updated doc scripts * updated doc action and styling * removed markdown katex * reverted checkpoint functionality * update test workflow * added type hints and increased coverage to part of geometry.py
1 parent a98fd93 commit cb5a780

55 files changed

Lines changed: 1345 additions & 1261 deletions

Some content is hidden

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

.flake8

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Setup Python + Poetry environment'
2+
description: 'Setup Python + Poetry environment'
3+
4+
inputs:
5+
python-version:
6+
required: false
7+
description: 'Python version'
8+
default: '3.10'
9+
outputs: {}
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- uses: actions/setup-python@v4
14+
with:
15+
python-version: ${{inputs.python-version}}
16+
- name: Install poetry
17+
run: python -m pip install poetry
18+
shell: bash
19+
- name: Create virtual environment
20+
run: poetry install --with=dev
21+
shell: bash

.github/dependabot.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@ updates:
55
directory: "/" # Location of package manifests
66
schedule:
77
interval: "daily"
8-
ignore:
9-
# Ignore updates to "black" because we'd need to reformat everything
10-
- dependency-name: "black"

.github/workflows/build_docs.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Documentation
1+
name: Update Documentation
22

33
on:
4-
push:
5-
tags:
6-
- '*'
4+
release:
5+
types: [ published ]
76

87
jobs:
98

@@ -15,18 +14,9 @@ jobs:
1514

1615
steps:
1716
- uses: actions/checkout@v3
18-
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v4
20-
with:
21-
python-version: ${{ matrix.python-version }}
22-
- name: Install dependencies
17+
- uses: ./.github/actions/python-poetry-env
18+
- name: Building docs
2319
run: |
24-
python -m pip install --upgrade pip
25-
pip install -e .[docs]
26-
- name: Test and get accuracy file
27-
run: |
28-
echo "Testing and saving accuracy file..."
29-
make get_test_data
30-
coverage run --source=jwave -m pytest -vs
20+
mkdocs build
3121
- name: Build documentation
3222
run: mkdocs gh-deploy --force
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Draft a release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'The version number (e.g. 1.2.3) OR one of: patch|minor|major|prepatch|preminor|premajor|prerelease'
8+
required: true
9+
default: 'patch'
10+
11+
jobs:
12+
draft-release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Set up SSH agent
16+
uses: webfactory/ssh-agent@v0.5.0
17+
with:
18+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
19+
- uses: actions/checkout@v2
20+
with:
21+
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
22+
- uses: ./.github/actions/python-poetry-env
23+
- name: Update version
24+
id: updated_version
25+
shell: bash
26+
run: |
27+
poetry version ${{ github.event.inputs.version }}
28+
version=$(poetry version --short)
29+
echo ::set-output name="version::$version"
30+
- name: Update changelog
31+
id: changelog
32+
shell: bash
33+
run: |
34+
poetry run kacl-cli release ${{ steps.updated_version.outputs.version }} --modify --auto-link
35+
echo "" >> CHANGELOG.md
36+
body=$(poetry run kacl-cli get ${{ steps.updated_version.outputs.version }})
37+
body="${body//'%'/'%25'}"
38+
body="${body//$'\n'/'%0A'}"
39+
body="${body//$'\r'/'%0D'}"
40+
echo ::set-output name="body::$body"
41+
- name: Commit changes
42+
uses: EndBug/add-and-commit@v7
43+
with:
44+
add: 'CHANGELOG.md pyproject.toml'
45+
message: 'Release ${{ steps.updated_version.outputs.version }}'
46+
- name: Create tag
47+
run: |
48+
git tag ${{ steps.updated_version.outputs.version }}
49+
git push --tags
50+
- name: Create a draft release
51+
uses: actions/create-release@v1
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
with:
55+
tag_name: ${{ steps.updated_version.outputs.version }}
56+
release_name: Release ${{ steps.updated_version.outputs.version }}
57+
body: ${{ steps.changelog.outputs.body }}
58+
draft: true

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
build-and-publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: ./.github/actions/python-poetry-env
13+
- name: Publish to pypi
14+
run: |
15+
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
16+
poetry publish --build --no-interaction
17+
- name: Deploy docs
18+
run: poetry run mkdocs gh-deploy --force

.github/workflows/tests.yml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This is a workflow for Unit, Integration, and Regression Tests
22

3-
name: Unit, Integration and Regression Tests
3+
name: CI
44

55
on:
66
push:
@@ -11,53 +11,31 @@ on:
1111

1212
jobs:
1313
unit_and_integration_tests:
14-
strategy:
15-
matrix:
16-
python-version: [3.11]
17-
os: [ubuntu-latest]
18-
runs-on: ${{ matrix.os }}
14+
runs-on: ubuntu-latest
1915
steps:
2016
- uses: actions/checkout@v3
21-
- uses: actions/setup-python@v4
22-
with:
23-
python-version: ${{ matrix.python-version }}
24-
- name: Making virtual environment, linting
25-
run: |
26-
make testenv
17+
- uses: ./.github/actions/python-poetry-env
2718
- name: Downloading test data
2819
run: |
2920
make get_test_data
3021
- name: Running tests
31-
run: |
32-
source .venv/bin/activate
33-
coverage run --source=jwave -m pytest -xvs --ignore=tests/regression_tests
22+
run: poetry run coverage run --source=jwave -m pytest -xvs --ignore=tests/regression_tests
3423
- name: "Upload coverage data for unit and integration tests"
3524
uses: actions/upload-artifact@v2
3625
with:
3726
name: coverage-unit
3827
path: ./.coverage
3928

4029
regression_tests:
41-
strategy:
42-
matrix:
43-
python-version: [3.11]
44-
os: [ubuntu-latest]
45-
runs-on: ${{ matrix.os }}
30+
runs-on: ubuntu-latest
4631
steps:
4732
- uses: actions/checkout@v3
48-
- uses: actions/setup-python@v4
49-
with:
50-
python-version: ${{ matrix.python-version }}
51-
- name: Making virtual environment, linting
52-
run: |
53-
make testenv
33+
- uses: ./.github/actions/python-poetry-env
5434
- name: Downloading test data
5535
run: |
5636
make get_test_data
5737
- name: Running tests
58-
run: |
59-
source .venv/bin/activate
60-
coverage run --source=jwave -m pytest -xvs ./tests/regression_tests
38+
run: poetry run coverage run --source=jwave -m pytest -xvs ./tests/regression_tests
6139
- name: "Upload coverage data for regression tests"
6240
uses: actions/upload-artifact@v2
6341
with:

.gitignore

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Project
12
*.ipynb_checkpoints
23
*.pytest_cache
34
*.vscode
@@ -7,11 +8,8 @@
78
site/*
89
build/*
910

10-
# Nodejs
11-
node_modules
12-
package-lock.json
13-
package.json
14-
11+
# poetry
12+
poetry.lock
1513

1614
# Testing
1715
.coverage
@@ -29,16 +27,10 @@ docs/notebooks/others/ct.jpg
2927
#k-wave outputs
3028
docs/benchmarks/kwave/*.png
3129

32-
# Profiling
33-
profiling/*
3430

3531
# Misc
3632
*.DS_Store
3733
*.env.local
3834
*.env.development.local
3935
*.env.test.local
4036
*.env.production.local
41-
42-
*npm-debug.log*
43-
*yarn-debug.log*
44-
*yarn-error.log*

.pre-commit-config.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
11
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: check-ast
6+
- id: check-added-large-files
7+
- id: check-merge-conflict
8+
- id: check-case-conflict
9+
- id: check-yaml
10+
- id: check-toml
11+
- id: debug-statements
12+
- id: end-of-file-fixer
13+
- id: no-commit-to-branch
14+
- id: trailing-whitespace
15+
- id: mixed-line-ending
216
- repo: https://github.com/hadialqattan/pycln
317
rev: 'v1.1.0'
418
hooks:
519
- id: pycln
620
args: [--config=pyproject.toml]
21+
- repo: https://github.com/google/yapf
22+
rev: v0.40.0
23+
hooks:
24+
- id: yapf
25+
args: ['--style=pyproject.toml', '--parallel', '--in-place']
726
- repo: https://github.com/pycqa/isort
827
rev: '5.12.0'
928
hooks:
1029
- id: isort
1130
files: "\\.(py)$"
1231
args: [--settings-path=pyproject.toml]
13-
- repo: https://github.com/psf/black
14-
rev: 22.12.0
15-
hooks:
16-
- id: black
17-
language_version: python3.10

CHANGELOG.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
6+
## [Unreleased]
7+
### Added
8+
- `k0` is automatically calculated in the Convergent Born Series, if not given, using the fromula from Osnabrugge et al.
9+
10+
### Fixed
11+
- updated for new `Array` type in `jax` 0.4.x
12+
13+
### Changed
14+
- reverted checkpoint to only step checkpoints for time varying simulations. Soon jwave will use diffrax for advanced checkpointing
15+
16+
## [0.0.4] - 2022-11-04
17+
### Added
18+
- Convergent Born series.
19+
20+
### Fixed
21+
- Correctly handles Nyquist frequency for Helmholtz operator, to improve agreement with k-Wave.
22+
- Fixed incorrect domain size for angular spectrum.
23+
- Angular spectrum is only dispatched on `pressure` types.
24+
25+
## [0.0.3] - 2022-07-05
26+
### Added
27+
- Angular spectrum method for single frequency sources.
28+
- Differentiable rayleigh integral (from a plane)
29+
30+
## [0.0.2] - 2022-06-23
31+
### Added
32+
- Generate `TimeHarmonicSource` from point sources.
33+
34+
### Fixed
35+
- Helmholtz notebook parameters bug.
36+
37+
## [0.0.1] - 2022-06-07
38+
### Added
39+
- Finite differences helmholtz tested.
40+
- Extract time varying params without running the simulation.
41+
- Windows one-line installer
42+
43+
### Fixed
44+
- Using numpy operations in TimeAxis for static fields.
45+
- Pml for 1D and 3D simulations.
46+
- Plotting functions of `jwave.utils` now work with both `Field`s and arrays.
47+
48+
[Unreleased]: https://github.com/ucl-bug/jwave/compare/0.0.5...master
49+
[0.0.4]: https://github.com/ucl-bug/jwave/compare/0.0.3...0.0.4
50+
[0.0.3]: https://github.com/ucl-bug/jwave/compare/0.0.2...0.0.3
51+
[0.0.2]: https://github.com/ucl-bug/jwave/compare/0.0.1...0.0.2
52+
[0.0.1]: https://github.com/ucl-bug/jwave/releases/tag/0.0.1

0 commit comments

Comments
 (0)