Skip to content

Rework CI to utilize Bun and Hatch #41

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

Merged
merged 14 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ end_of_line = lf
indent_size = 4
max_line_length = 120


[*.md]
indent_size = 4

[*.html]
indent_size = 4
max_line_length = off

[*.js]
Expand Down
47 changes: 28 additions & 19 deletions .github/workflows/publish-develop-docs.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
name: Publish Develop Docs
on:
push:
branches:
- main
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pip install -r requirements/build-docs.txt
- name: Publish Develop Docs
run: |
git config user.name github-actions
git config user.email [email protected]
cd docs
mike deploy --push develop
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pip install -r requirements/build-docs.txt
- name: Install dependecies
run: |
pip install --upgrade hatch uv
- name: Configure Git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Publish Develop Docs
run: |
hatch run docs:deploy_develop
concurrency:
group: publish-docs
31 changes: 31 additions & 0 deletions .github/workflows/publish-latest-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Latest Docs
on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pip install -r requirements/build-docs.txt
- name: Install dependecies
run: |
pip install --upgrade hatch uv
- name: Configure Git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Publish Develop Docs
run: |
hatch run docs:deploy_latest ${{ github.ref_name }}
concurrency:
group: publish-docs
47 changes: 26 additions & 21 deletions .github/workflows/publish-py.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@
name: Publish Python

on:
release:
types: [published]
release:
types: [published]

jobs:
publish-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/build-pkg.txt
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py bdist_wheel
twine upload dist/*
publish-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
pip3 --quiet install --upgrade hatch uv twine
pip install -r requirements/build-pkg.txt
- name: Build Package
run: |
hatch build --clean
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
23 changes: 0 additions & 23 deletions .github/workflows/publish-release-docs.yml

This file was deleted.

15 changes: 6 additions & 9 deletions .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,19 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install Python Dependencies
run: |
pip install -r requirements/build-docs.txt
pip install -r requirements/check-types.txt
pip install -r requirements/check-style.txt
pip3 --quiet install --upgrade hatch uv ruff
- name: Check docs build
run: |
linkcheckMarkdown docs/ -v -r
linkcheckMarkdown README.md -v -r
linkcheckMarkdown CHANGELOG.md -v -r
cd docs
mkdocs build --strict
hatch run docs:build
hatch run docs:linkcheck
- name: Check docs examples
run: |
mypy --show-error-codes docs/examples/python/
ruff check docs/examples/python/
40 changes: 0 additions & 40 deletions .github/workflows/test-src.yaml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/test-src.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Test

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *"

jobs:
source:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python Dependencies
run: |
pip3 install hatch uv
- name: Run Tests
run: |
hatch test --cover --python ${{ matrix.python-version }}
mv .coverage ".coverage.py${{ matrix.python-version }}"
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: "coverage-data-py${{ matrix.python-version }}"
path: ".coverage.py${{ matrix.python-version }}"
if-no-files-found: error
include-hidden-files: true
retention-days: 7
coverage:
needs:
- source
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Latest Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Python Dependencies
run: python -m pip install --upgrade coverage[toml]
- name: Download data
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Combine coverage and fail if it's <100%
run: |
python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: htmlcov
27 changes: 27 additions & 0 deletions .github/workflows/test-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test Style

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Python Dependencies
run: |
pip3 install hatch uv
- name: Run Tests
run: |
hatch fmt --check
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ Using the following categories, list your changes in this order:

## [Unreleased]

- Nothing (yet)!
### Changed

- JavaScript bundle is now created using [`Bun`](https://bun.sh/)
- Python package is now built using [`Hatch`](https://hatch.pypa.io/)

## [1.0.0] - 2024-10-18

Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import operator
from typing import TypedDict

from reactpy import component, html, run
Expand Down Expand Up @@ -41,7 +42,7 @@ def home():

@component
def all_messages():
last_messages = {", ".join(msg["with"]): msg for msg in sorted(message_data, key=lambda m: m["id"])}
last_messages = {", ".join(msg["with"]): msg for msg in sorted(message_data, key=operator.itemgetter("id"))}

messages = []
for msg in last_messages.values():
Expand All @@ -63,15 +64,13 @@ def messages_with(*names):
messages = [msg for msg in message_data if tuple(msg["with"]) == names]
return html.div(
html.h1(f"Messages with {', '.join(names)} 💬"),
html.ul(
[
html.li(
{"key": msg["id"]},
f"{msg['from'] or 'You'}: {msg['message']}",
)
for msg in messages
]
),
html.ul([
html.li(
{"key": msg["id"]},
f"{msg['from'] or 'You'}: {msg['message']}",
)
for msg in messages
]),
)


Expand Down
Loading