Skip to content

Commit da15d41

Browse files
authored
Rework CI to utilize Bun and Hatch (#41)
- JavaScript bundle is now created using [`Bun`](https://bun.sh/) - Python package is now built using [`Hatch`](https://hatch.pypa.io/)
1 parent bcb310f commit da15d41

Some content is hidden

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

50 files changed

+445
-5040
lines changed

.editorconfig

+2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ end_of_line = lf
1414
indent_size = 4
1515
max_line_length = 120
1616

17+
1718
[*.md]
1819
indent_size = 4
1920

2021
[*.html]
22+
indent_size = 4
2123
max_line_length = off
2224

2325
[*.js]
+28-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
name: Publish Develop Docs
22
on:
3-
push:
4-
branches:
5-
- main
3+
push:
4+
branches:
5+
- main
66
jobs:
7-
deploy:
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v4
11-
with:
12-
fetch-depth: 0
13-
- uses: actions/setup-python@v5
14-
with:
15-
python-version: 3.x
16-
- run: pip install -r requirements/build-docs.txt
17-
- name: Publish Develop Docs
18-
run: |
19-
git config user.name github-actions
20-
git config user.email [email protected]
21-
cd docs
22-
mike deploy --push develop
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
- uses: oven-sh/setup-bun@v2
14+
with:
15+
bun-version: latest
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: 3.x
19+
- run: pip install -r requirements/build-docs.txt
20+
- name: Install dependecies
21+
run: |
22+
pip install --upgrade hatch uv
23+
- name: Configure Git
24+
run: |
25+
git config user.name github-actions
26+
git config user.email [email protected]
27+
- name: Publish Develop Docs
28+
run: |
29+
hatch run docs:deploy_develop
30+
concurrency:
31+
group: publish-docs
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish Latest Docs
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
- uses: oven-sh/setup-bun@v2
14+
with:
15+
bun-version: latest
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: 3.x
19+
- run: pip install -r requirements/build-docs.txt
20+
- name: Install dependecies
21+
run: |
22+
pip install --upgrade hatch uv
23+
- name: Configure Git
24+
run: |
25+
git config user.name github-actions
26+
git config user.email [email protected]
27+
- name: Publish Develop Docs
28+
run: |
29+
hatch run docs:deploy_latest ${{ github.ref_name }}
30+
concurrency:
31+
group: publish-docs

.github/workflows/publish-py.yaml

+26-21
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,31 @@
44
name: Publish Python
55

66
on:
7-
release:
8-
types: [published]
7+
release:
8+
types: [published]
99

1010
jobs:
11-
publish-package:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v4
15-
- name: Set up Python
16-
uses: actions/setup-python@v5
17-
with:
18-
python-version: "3.x"
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install -r requirements/build-pkg.txt
23-
- name: Build and publish
24-
env:
25-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
26-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
27-
run: |
28-
python setup.py bdist_wheel
29-
twine upload dist/*
11+
publish-package:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: oven-sh/setup-bun@v2
16+
with:
17+
bun-version: latest
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.x"
22+
- name: Install dependencies
23+
run: |
24+
pip3 --quiet install --upgrade hatch uv twine
25+
pip install -r requirements/build-pkg.txt
26+
- name: Build Package
27+
run: |
28+
hatch build --clean
29+
- name: Publish to PyPI
30+
env:
31+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
32+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
33+
run: |
34+
twine upload dist/*

.github/workflows/publish-release-docs.yml

-23
This file was deleted.

.github/workflows/test-docs.yml

+6-9
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,19 @@ jobs:
1717
- uses: actions/checkout@v4
1818
with:
1919
fetch-depth: 0
20+
- uses: oven-sh/setup-bun@v2
21+
with:
22+
bun-version: latest
2023
- uses: actions/setup-python@v5
2124
with:
2225
python-version: 3.x
2326
- name: Install Python Dependencies
2427
run: |
25-
pip install -r requirements/build-docs.txt
26-
pip install -r requirements/check-types.txt
27-
pip install -r requirements/check-style.txt
28+
pip3 --quiet install --upgrade hatch uv ruff
2829
- name: Check docs build
2930
run: |
30-
linkcheckMarkdown docs/ -v -r
31-
linkcheckMarkdown README.md -v -r
32-
linkcheckMarkdown CHANGELOG.md -v -r
33-
cd docs
34-
mkdocs build --strict
31+
hatch run docs:build
32+
hatch run docs:linkcheck
3533
- name: Check docs examples
3634
run: |
37-
mypy --show-error-codes docs/examples/python/
3835
ruff check docs/examples/python/

.github/workflows/test-src.yaml

-40
This file was deleted.

.github/workflows/test-src.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: "0 0 * * *"
12+
13+
jobs:
14+
source:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: ["3.9", "3.10", "3.11", "3.12"]
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: oven-sh/setup-bun@v2
22+
with:
23+
bun-version: latest
24+
- name: Use Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Install Python Dependencies
29+
run: |
30+
pip3 install hatch uv
31+
- name: Run Tests
32+
run: |
33+
hatch test --cover --python ${{ matrix.python-version }}
34+
mv .coverage ".coverage.py${{ matrix.python-version }}"
35+
- name: Upload coverage data
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: "coverage-data-py${{ matrix.python-version }}"
39+
path: ".coverage.py${{ matrix.python-version }}"
40+
if-no-files-found: error
41+
include-hidden-files: true
42+
retention-days: 7
43+
coverage:
44+
needs:
45+
- source
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
- name: Use Latest Python
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: "3.x"
53+
- name: Install Python Dependencies
54+
run: python -m pip install --upgrade coverage[toml]
55+
- name: Download data
56+
uses: actions/download-artifact@v4
57+
with:
58+
merge-multiple: true
59+
- name: Combine coverage and fail if it's <100%
60+
run: |
61+
python -m coverage combine
62+
python -m coverage html --skip-covered --skip-empty
63+
python -m coverage report --fail-under=100
64+
- name: Upload HTML report
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: coverage-report
68+
path: htmlcov

.github/workflows/test-style.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test Style
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test-style:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: oven-sh/setup-bun@v2
17+
with:
18+
bun-version: latest
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.x"
22+
- name: Install Python Dependencies
23+
run: |
24+
pip3 install hatch uv
25+
- name: Run Tests
26+
run: |
27+
hatch fmt --check

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ Using the following categories, list your changes in this order:
3434

3535
## [Unreleased]
3636

37-
- Nothing (yet)!
37+
### Changed
38+
39+
- JavaScript bundle is now created using [`Bun`](https://bun.sh/)
40+
- Python package is now built using [`Hatch`](https://hatch.pypa.io/)
3841

3942
## [1.0.0] - 2024-10-18
4043

MANIFEST.in

-2
This file was deleted.
File renamed without changes.

docs/examples/python/nested-routes.py docs/examples/python/nested_routes.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import operator
12
from typing import TypedDict
23

34
from reactpy import component, html, run
@@ -41,7 +42,7 @@ def home():
4142

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

4647
messages = []
4748
for msg in last_messages.values():
@@ -63,15 +64,13 @@ def messages_with(*names):
6364
messages = [msg for msg in message_data if tuple(msg["with"]) == names]
6465
return html.div(
6566
html.h1(f"Messages with {', '.join(names)} 💬"),
66-
html.ul(
67-
[
68-
html.li(
69-
{"key": msg["id"]},
70-
f"{msg['from'] or 'You'}: {msg['message']}",
71-
)
72-
for msg in messages
73-
]
74-
),
67+
html.ul([
68+
html.li(
69+
{"key": msg["id"]},
70+
f"{msg['from'] or 'You'}: {msg['message']}",
71+
)
72+
for msg in messages
73+
]),
7574
)
7675

7776

File renamed without changes.

0 commit comments

Comments
 (0)