Skip to content

Commit 3dac6bf

Browse files
committed
Merge remote-tracking branch 'upstream/main' into asgi-middleware
2 parents 765a6a4 + e24b6aa commit 3dac6bf

File tree

159 files changed

+2930
-10924
lines changed

Some content is hidden

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

159 files changed

+2930
-10924
lines changed

.editorconfig

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
charset = utf-8
11+
end_of_line = lf
12+
13+
[*.py]
14+
indent_size = 4
15+
max_line_length = 120
16+
17+
[*.md]
18+
indent_size = 4
19+
20+
[*.yml]
21+
indent_size = 4
22+
23+
[*.html]
24+
max_line_length = off
25+
26+
[*.js]
27+
max_line_length = off
28+
29+
[*.css]
30+
indent_size = 4
31+
max_line_length = off
32+
33+
# Tests can violate line width restrictions in the interest of clarity.
34+
[**/test_*.py]
35+
max_line_length = off

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: [rmorshea]
3+
github: [archmonger, rmorshea]
44
patreon: # Replace with a single Patreon username
55
open_collective: # Replace with a single Open Collective username
66
ko_fi: # Replace with a single Ko-fi username

.github/pull_request_template.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<sub>By submitting this pull request you agree that all contributions to this project are made under the MIT license.</sub>
1+
## Description
22

3-
## Issues
3+
<!-- A summary of the changes. -->
44

5-
<!-- Describe or link the issues this change resolves -->
6-
7-
## Solution
5+
## Checklist
86

9-
<!-- Describe how these changes resolve the aforementioned issues -->
7+
Please update this checklist as you complete each item:
108

11-
## Checklist
9+
- [ ] Tests have been developed for bug fixes or new functionality.
10+
- [ ] The changelog has been updated, if necessary.
11+
- [ ] Documentation has been updated, if necessary.
12+
- [ ] GitHub Issues closed by this PR have been linked.
1213

13-
- [ ] Tests have been included for all bug fixes or added functionality.
14-
- [ ] The `changelog.rst` has been updated with any significant changes.
14+
<sub>By submitting this pull request I agree that all contributions comply with this project's open source license(s).</sub>

.github/workflows/.hatch-run.yml

Lines changed: 47 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,52 @@
11
name: hatch-run
22

33
on:
4-
workflow_call:
5-
inputs:
6-
job-name:
7-
required: true
8-
type: string
9-
hatch-run:
10-
required: true
11-
type: string
12-
runs-on-array:
13-
required: false
14-
type: string
15-
default: '["ubuntu-latest"]'
16-
python-version-array:
17-
required: false
18-
type: string
19-
default: '["3.x"]'
20-
node-registry-url:
21-
required: false
22-
type: string
23-
default: ""
24-
secrets:
25-
node-auth-token:
26-
required: false
27-
pypi-username:
28-
required: false
29-
pypi-password:
30-
required: false
4+
workflow_call:
5+
inputs:
6+
job-name:
7+
required: true
8+
type: string
9+
run-cmd:
10+
required: true
11+
type: string
12+
runs-on:
13+
required: false
14+
type: string
15+
default: '["ubuntu-latest"]'
16+
python-version:
17+
required: false
18+
type: string
19+
default: '["3.x"]'
20+
secrets:
21+
node-auth-token:
22+
required: false
23+
pypi-username:
24+
required: false
25+
pypi-password:
26+
required: false
3127

3228
jobs:
33-
hatch:
34-
name: ${{ format(inputs.job-name, matrix.python-version, matrix.runs-on) }}
35-
strategy:
36-
matrix:
37-
python-version: ${{ fromJson(inputs.python-version-array) }}
38-
runs-on: ${{ fromJson(inputs.runs-on-array) }}
39-
runs-on: ${{ matrix.runs-on }}
40-
steps:
41-
- uses: actions/checkout@v2
42-
- uses: actions/setup-node@v2
43-
with:
44-
node-version: "14.x"
45-
registry-url: ${{ inputs.node-registry-url }}
46-
- name: Pin NPM Version
47-
run: npm install -g [email protected]
48-
- name: Use Python ${{ matrix.python-version }}
49-
uses: actions/setup-python@v2
50-
with:
51-
python-version: ${{ matrix.python-version }}
52-
- name: Install Python Dependencies
53-
run: pip install hatch poetry
54-
- name: Run Scripts
55-
env:
56-
NODE_AUTH_TOKEN: ${{ secrets.node-auth-token }}
57-
PYPI_USERNAME: ${{ secrets.pypi-username }}
58-
PYPI_PASSWORD: ${{ secrets.pypi-password }}
59-
run: hatch run ${{ inputs.hatch-run }}
29+
hatch:
30+
name: ${{ format(inputs.job-name, matrix.python-version, matrix.runs-on) }}
31+
strategy:
32+
matrix:
33+
python-version: ${{ fromJson(inputs.python-version) }}
34+
runs-on: ${{ fromJson(inputs.runs-on) }}
35+
runs-on: ${{ matrix.runs-on }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: oven-sh/setup-bun@v2
39+
with:
40+
bun-version: latest
41+
- name: Use Python ${{ matrix.python-version }}
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
- name: Install Python Dependencies
46+
run: pip install --upgrade pip hatch uv
47+
- name: Run Scripts
48+
env:
49+
NPM_CONFIG_TOKEN: ${{ secrets.node-auth-token }}
50+
HATCH_INDEX_USER: ${{ secrets.pypi-username }}
51+
HATCH_INDEX_AUTH: ${{ secrets.pypi-password }}
52+
run: ${{ inputs.run-cmd }}

.github/workflows/check.yml

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,46 @@
11
name: check
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- main
10-
schedule:
11-
- cron: "0 0 * * 0"
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: "0 0 * * 0"
1212

1313
jobs:
14-
test-py-cov:
15-
uses: ./.github/workflows/.hatch-run.yml
16-
with:
17-
job-name: "python-{0}"
18-
hatch-run: "test-py"
19-
lint-py:
20-
uses: ./.github/workflows/.hatch-run.yml
21-
with:
22-
job-name: "python-{0}"
23-
hatch-run: "lint-py"
24-
test-py-matrix:
25-
uses: ./.github/workflows/.hatch-run.yml
26-
with:
27-
job-name: "python-{0} {1}"
28-
hatch-run: "test-py --no-cov"
29-
runs-on-array: '["ubuntu-latest", "macos-latest", "windows-latest"]'
30-
python-version-array: '["3.9", "3.10", "3.11"]'
31-
test-docs:
32-
uses: ./.github/workflows/.hatch-run.yml
33-
with:
34-
job-name: "python-{0}"
35-
hatch-run: "test-docs"
36-
test-js:
37-
uses: ./.github/workflows/.hatch-run.yml
38-
with:
39-
job-name: "{1}"
40-
hatch-run: "test-js"
41-
lint-js:
42-
uses: ./.github/workflows/.hatch-run.yml
43-
with:
44-
job-name: "{1}"
45-
hatch-run: "lint-js"
14+
test-python-coverage:
15+
uses: ./.github/workflows/.hatch-run.yml
16+
with:
17+
job-name: "python-{0}"
18+
run-cmd: "hatch test --cover"
19+
lint-python:
20+
uses: ./.github/workflows/.hatch-run.yml
21+
with:
22+
job-name: "python-{0}"
23+
run-cmd: "hatch fmt src/reactpy --check && hatch run python:type_check"
24+
test-python:
25+
uses: ./.github/workflows/.hatch-run.yml
26+
with:
27+
job-name: "python-{0} {1}"
28+
run-cmd: "hatch test"
29+
runs-on: '["ubuntu-latest", "macos-latest", "windows-latest"]'
30+
python-version: '["3.9", "3.10", "3.11"]'
31+
test-documentation:
32+
uses: ./.github/workflows/.hatch-run.yml
33+
with:
34+
job-name: "python-{0}"
35+
run-cmd: "hatch run docs:check"
36+
python-version: '["3.11"]'
37+
test-javascript:
38+
uses: ./.github/workflows/.hatch-run.yml
39+
with:
40+
job-name: "{1}"
41+
run-cmd: "hatch run javascript:test"
42+
lint-javascript:
43+
uses: ./.github/workflows/.hatch-run.yml
44+
with:
45+
job-name: "{1}"
46+
run-cmd: "hatch run javascript:check"

.github/workflows/deploy-docs.yml

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
41
name: deploy-docs
52

63
on:
7-
push:
8-
branches:
9-
- "main"
10-
tags:
11-
- "*"
4+
push:
5+
branches:
6+
- "main"
7+
tags:
8+
- "*"
129

1310
jobs:
14-
deploy-documentation:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Check out src from Git
18-
uses: actions/checkout@v2
19-
- name: Get history and tags for SCM versioning to work
20-
run: |
21-
git fetch --prune --unshallow
22-
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
23-
- name: Login to Heroku Container Registry
24-
run: echo ${{ secrets.HEROKU_API_KEY }} | docker login -u ${{ secrets.HEROKU_EMAIL }} --password-stdin registry.heroku.com
25-
- name: Build Docker Image
26-
run: docker build . --file docs/Dockerfile --tag registry.heroku.com/${{ secrets.HEROKU_APP_NAME }}/web
27-
- name: Push Docker Image
28-
run: docker push registry.heroku.com/${{ secrets.HEROKU_APP_NAME }}/web
29-
- name: Deploy
30-
run: HEROKU_API_KEY=${{ secrets.HEROKU_API_KEY }} heroku container:release web --app ${{ secrets.HEROKU_APP_NAME }}
11+
deploy-documentation:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out src from Git
15+
uses: actions/checkout@v4
16+
- name: Get history and tags for SCM versioning to work
17+
run: |
18+
git fetch --prune --unshallow
19+
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
20+
- name: Install Heroku CLI
21+
run: curl https://cli-assets.heroku.com/install.sh | sh
22+
- name: Login to Heroku Container Registry
23+
run: echo ${{ secrets.HEROKU_API_KEY }} | docker login -u ${{ secrets.HEROKU_EMAIL }} --password-stdin registry.heroku.com
24+
- name: Build Docker Image
25+
run: docker build . --file docs/Dockerfile --tag registry.heroku.com/${{ secrets.HEROKU_APP_NAME }}/web
26+
- name: Push Docker Image
27+
run: docker push registry.heroku.com/${{ secrets.HEROKU_APP_NAME }}/web
28+
- name: Deploy
29+
run: HEROKU_API_KEY=${{ secrets.HEROKU_API_KEY }} heroku container:release web --app ${{ secrets.HEROKU_APP_NAME }}

.github/workflows/publish.yml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
1-
# This workflows will upload a Javscript Package using NPM to npmjs.org when a release is created
2-
# For more information see: https://docs.github.com/en/actions/guides/publishing-nodejs-packages
3-
41
name: publish
52

63
on:
7-
release:
8-
types: [published]
4+
release:
5+
types: [published]
96

107
jobs:
11-
publish:
12-
uses: ./.github/workflows/.hatch-run.yml
13-
with:
14-
job-name: "publish"
15-
hatch-run: "publish"
16-
node-registry-url: "https://registry.npmjs.org"
17-
secrets:
18-
node-auth-token: ${{ secrets.NODE_AUTH_TOKEN }}
19-
pypi-username: ${{ secrets.PYPI_USERNAME }}
20-
pypi-password: ${{ secrets.PYPI_PASSWORD }}
8+
publish-reactpy:
9+
if: startsWith(github.event.release.name, 'reactpy ')
10+
uses: ./.github/workflows/.hatch-run.yml
11+
with:
12+
job-name: "Publish to PyPI"
13+
run-cmd: "hatch build --clean && hatch publish --yes"
14+
secrets:
15+
pypi-username: ${{ secrets.PYPI_USERNAME }}
16+
pypi-password: ${{ secrets.PYPI_PASSWORD }}
17+
18+
publish-reactpy-client:
19+
if: startsWith(github.event.release.name, '@reactpy/client ')
20+
uses: ./.github/workflows/.hatch-run.yml
21+
with:
22+
job-name: "Publish to NPM"
23+
run-cmd: "hatch run javascript:publish_reactpy_client"
24+
secrets:
25+
node-auth-token: ${{ secrets.NODE_AUTH_TOKEN }}
26+
27+
publish-event-to-object:
28+
if: startsWith(github.event.release.name, 'event-to-object ')
29+
uses: ./.github/workflows/.hatch-run.yml
30+
with:
31+
job-name: "Publish to NPM"
32+
run-cmd: "hatch run javascript:publish_event_to_object"
33+
secrets:
34+
node-auth-token: ${{ secrets.NODE_AUTH_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# --- Build Artifacts ---
2+
src/reactpy/static/**/index.js*
3+
14
# --- Jupyter ---
25
*.ipynb_checkpoints
36
*Untitled*.ipynb
@@ -29,6 +32,7 @@ pip-wheel-metadata
2932
.python-version
3033

3134
# -- Python Tests ---
35+
.coverage.*
3236
*.coverage
3337
*.pytest_cache
3438
*.mypy_cache

0 commit comments

Comments
 (0)