diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index fec5076..17c351d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,34 +1,39 @@ -# This workflow will build docs and push it to branch gh-pages -# For more information see: https://github.com/marketplace/actions/deploy-to-github-pages-python +name: Docs -name: Generate pdoc3 documentation on: push: - branches: - - main + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false jobs: - build-and-deploy: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v4 + with: + enable-cache: true + - run: uv sync --group docs + - run: uv run pdoc -o site livelossplot '!livelossplot.inputs' + - uses: actions/upload-pages-artifact@v3 + with: + path: site + + deploy: + needs: build runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install livelossplot with dependencies - run: | - pip install -e . - - name: Install pdoc3 - run: | - pip install pdoc3 - - name: Checkout - uses: actions/checkout@master - - name: Generate docs - run: | - pdoc3 --html livelossplot --force --output-dir docs --skip-errors - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs/livelossplot/ + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/external_packages.yml b/.github/workflows/external_packages.yml index 10f44c0..c397a2b 100644 --- a/.github/workflows/external_packages.yml +++ b/.github/workflows/external_packages.yml @@ -1,45 +1,27 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package with external dependencies +name: External integrations on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: - build: - + external: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install package and dev dependencies - run: | - python -m pip install --upgrade pip - pip install -e . - pip install -r requirements-dev.txt - - name: Test TensorBoard output - run: | - pip install tensorflow tensorboard - pytest tests/external_test_tensorboard.py - - name: Test Keras input - run: | - pip install keras - pytest tests/external_test_keras.py - - name: Test PyTorch Ignite input - run: | - pip install pytorch-ignite - pytest tests/external_test_pytorch_ignite.py - - name: Test Poutyne input - run: | - pip install poutyne - pytest tests/external_test_poutyne.py - - name: Test Jupyter Notebook matplotlib output - run: | - pytest tests/external_test_examples.py + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v4 + with: + enable-cache: true + - run: uv sync --group dev + - name: TensorBoard + run: uv run --with tensorflow --with tensorboard pytest tests/external_test_tensorboard.py + - name: Keras + run: uv run --with keras --with tensorflow pytest tests/external_test_keras.py + - name: PyTorch Ignite + run: uv run --with pytorch-ignite pytest tests/external_test_pytorch_ignite.py + - name: Poutyne + run: uv run --with poutyne pytest tests/external_test_poutyne.py + - name: Notebook examples + run: uv run pytest tests/external_test_examples.py diff --git a/.github/workflows/flake8_yapf.yml b/.github/workflows/flake8_yapf.yml deleted file mode 100644 index 393e5b2..0000000 --- a/.github/workflows/flake8_yapf.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Flake8 and yapf - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install dependencies - run: | - pip install flake8 - pip install yapf - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics - - name: yapf - id: yapf - uses: diegovalenzuelaiturra/yapf-action@v0.0.1 - with: - args: . --recursive --diff - - name: Fail if yapf made changes - if: steps.yapf.outputs.exit-code == 2 - run: exit 1 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..ac57b16 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,22 @@ +name: Lint + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v4 + with: + enable-cache: true + - run: uv sync --group dev + - name: Ruff + run: uv run ruff check . + - name: Ty (informational) + run: uv run ty check livelossplot + continue-on-error: true diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml deleted file mode 100644 index f8475cb..0000000 --- a/.github/workflows/pythonpackage.yml +++ /dev/null @@ -1,33 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] - - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements-dev.txt - pip install -e . - - name: Test with pytest - run: | - pytest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f8043bb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +# Required: PYPI_API_TOKEN — generate at https://pypi.org/manage/account/token/ + +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v4 + + - name: Verify tag matches package version + run: | + TAG_VERSION="${GITHUB_REF_NAME#v}" + PKG_VERSION="$(uv run --no-project python -c 'import tomllib, pathlib; print(tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"])')" + if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then + echo "Tag $GITHUB_REF_NAME does not match pyproject version $PKG_VERSION" >&2 + exit 1 + fi + + - name: Build sdist + wheel + run: uv build + + - name: Publish to PyPI + env: + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + run: uv publish + + - name: Extract changelog section + run: | + VERSION="${GITHUB_REF_NAME#v}" + awk -v ver="$VERSION" ' + /^## \[/ { + if (in_section) { exit } + if (index($0, "[" ver "]") > 0) { in_section = 1; next } + } + in_section { print } + ' CHANGELOG.md > release_notes.md + if [ ! -s release_notes.md ]; then + echo "No changelog section found for version $VERSION" >&2 + exit 1 + fi + + - name: Create GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create "$GITHUB_REF_NAME" \ + --title "$GITHUB_REF_NAME" \ + --notes-file release_notes.md \ + dist/* diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..02cb702 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,22 @@ +name: Tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.10', '3.11', '3.12', '3.13'] + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v4 + with: + enable-cache: true + - run: uv sync --group dev --python ${{ matrix.python-version }} + - run: uv run --python ${{ matrix.python-version }} pytest diff --git a/.gitignore b/.gitignore index 76d8cb3..c606fbf 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,12 @@ build/ tensorboard_logs/ examples/_test* .mypy_cache/ +.pytest_cache/ +.ruff_cache/ +.ty_cache/ + +# uv +.venv/ # OS / editor cruft .DS_Store diff --git a/.yapfignore b/.yapfignore deleted file mode 100644 index a060e9d..0000000 --- a/.yapfignore +++ /dev/null @@ -1,3 +0,0 @@ -build* -old* -setup.py \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fb308e..f0a6735 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,23 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.5.7] - 2026-05-04 +## [0.6.0] - 2026-05-04 -### Fixed +### Changed -- `BokehPlot` now renders and live-updates inside Google Colab. Colab blocks Jupyter Comms, so `push_notebook` was silently dead; the plot is now embedded via `