Skip to content

Commit 53f5488

Browse files
authored
Synchronize CI with other reactive-python repos (#48)
1 parent 28d60a2 commit 53f5488

12 files changed

+109
-83
lines changed

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

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
branches:
55
- main
66
jobs:
7-
deploy:
7+
publish-develop-docs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v4
@@ -17,14 +17,12 @@ jobs:
1717
with:
1818
python-version: 3.x
1919
- name: Install dependencies
20-
run: |
21-
pip install --upgrade hatch uv
20+
run: pip install --upgrade pip hatch uv
2221
- name: Configure Git
2322
run: |
2423
git config user.name github-actions
2524
git config user.email [email protected]
2625
- name: Publish Develop Docs
27-
run: |
28-
hatch run docs:deploy_develop
26+
run: hatch run docs:deploy_develop
2927
concurrency:
3028
group: publish-docs

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ jobs:
1818
python-version: 3.x
1919
- name: Install dependencies
2020
run: |
21-
pip install --upgrade hatch uv
21+
pip install --upgrade pip hatch uv
2222
- name: Configure Git
2323
run: |
2424
git config user.name github-actions
2525
git config user.email [email protected]
26-
- name: Publish Develop Docs
27-
run: |
28-
hatch run docs:deploy_latest ${{ github.ref_name }}
26+
- name: Publish ${{ github.event.release.name }} Docs
27+
run: hatch run docs:deploy_latest ${{ github.ref_name }}
2928
concurrency:
3029
group: publish-docs

.github/workflows/publish-py.yaml

-33
This file was deleted.

.github/workflows/publish-python.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Python
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish-python:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: oven-sh/setup-bun@v2
13+
with:
14+
bun-version: latest
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.x"
19+
- name: Install dependencies
20+
run: pip install --upgrade pip hatch uv
21+
- name: Build Package
22+
run: hatch build --clean
23+
- name: Publish to PyPI
24+
env:
25+
HATCH_INDEX_USER: ${{ secrets.PYPI_USERNAME }}
26+
HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }}
27+
run: hatch publish --yes

.github/workflows/test-docs.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ jobs:
2424
with:
2525
python-version: 3.x
2626
- name: Install Python Dependencies
27-
run: |
28-
pip3 --quiet install --upgrade hatch uv ruff
27+
run: pip install --upgrade pip hatch uv
28+
- name: Check documentation links
29+
run: hatch run docs:linkcheck
2930
- name: Check docs build
30-
run: |
31-
hatch run docs:build
32-
hatch run docs:linkcheck
31+
run: hatch run docs:build
3332
- name: Check docs examples
34-
run: |
35-
ruff check docs/examples/python/
33+
run: hatch fmt docs --check
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test Style
1+
name: Test
22

33
on:
44
push:
@@ -9,7 +9,7 @@ on:
99
- main
1010

1111
jobs:
12-
test-style:
12+
javascript:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
@@ -18,10 +18,8 @@ jobs:
1818
bun-version: latest
1919
- uses: actions/setup-python@v5
2020
with:
21-
python-version: "3.x"
21+
python-version: 3.x
2222
- name: Install Python Dependencies
23-
run: |
24-
pip3 install hatch uv
23+
run: pip install --upgrade pip hatch uv
2524
- name: Run Tests
26-
run: |
27-
hatch fmt --check
25+
run: hatch run javascript:check

.github/workflows/test-src.yml renamed to .github/workflows/test-python.yml

+22-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- cron: "0 0 * * *"
1212

1313
jobs:
14-
source:
14+
python-source:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
@@ -26,8 +26,7 @@ jobs:
2626
with:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Install Python Dependencies
29-
run: |
30-
pip3 install hatch uv
29+
run: pip install --upgrade pip hatch uv
3130
- name: Run Tests
3231
run: |
3332
hatch test --cover --python ${{ matrix.python-version }}
@@ -40,18 +39,18 @@ jobs:
4039
if-no-files-found: error
4140
include-hidden-files: true
4241
retention-days: 7
43-
coverage:
42+
43+
python-coverage:
4444
needs:
45-
- source
45+
- python-source
4646
runs-on: ubuntu-latest
4747
steps:
4848
- uses: actions/checkout@v4
49-
- name: Use Latest Python
50-
uses: actions/setup-python@v5
49+
- uses: actions/setup-python@v5
5150
with:
5251
python-version: "3.x"
5352
- name: Install Python Dependencies
54-
run: python -m pip install --upgrade coverage[toml]
53+
run: pip install --upgrade coverage[toml]
5554
- name: Download data
5655
uses: actions/download-artifact@v4
5756
with:
@@ -66,3 +65,18 @@ jobs:
6665
with:
6766
name: coverage-report
6867
path: htmlcov
68+
69+
python-formatting:
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v4
73+
- uses: oven-sh/setup-bun@v2
74+
with:
75+
bun-version: latest
76+
- uses: actions/setup-python@v5
77+
with:
78+
python-version: "3.x"
79+
- name: Install Python Dependencies
80+
run: pip install --upgrade pip hatch uv
81+
- name: Check Python formatting
82+
run: hatch fmt src tests --check

CHANGELOG.md

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

3535
## [Unreleased]
3636

37-
- Nothing (yet)!
37+
### Changed
38+
39+
- Set upper limit on ReactPy version to `<2.0.0`.
3840

3941
## [1.0.3] - 2024-11-21
4042

docs/mkdocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@ site_description: It's React-Router, but in Python.
145145
copyright: '&copy;<div id="year"> </div> <script> document.getElementById("year").innerHTML = new Date().getFullYear(); </script>Reactive Python and affiliates.<div class="legal-footer-right">This project has no affiliation to ReactJS or Meta Platforms, Inc.</div>'
146146
repo_url: https://github.com/reactive-python/reactpy-router
147147
site_url: https://reactive-python.github.io/reactpy-router
148-
repo_name: ReactPy Router (GitHub)
148+
repo_name: ReactPy Router
149149
edit_uri: edit/main/docs/src/
150150
docs_dir: src

docs/src/about/contributing.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ If you plan to make code changes to this repository, you will need to install th
55
- [Git](https://git-scm.com/downloads)
66
- [Python 3.9+](https://www.python.org/downloads/)
77
- [Hatch](https://hatch.pypa.io/latest/)
8+
- [Bun](https://bun.sh/)
89

910
Once you finish installing these dependencies, you can clone this repository:
1011

@@ -40,6 +41,8 @@ By utilizing `hatch`, the following commands are available to manage the develop
4041
| `hatch fmt --check` | Run all linters and formatters, but do not save fixes to the disk |
4142
| `hatch fmt --linter` | Run only linters |
4243
| `hatch fmt --formatter` | Run only formatters |
44+
| `hatch run javascript:check` | Run the JavaScript linter/formatter |
45+
| `hatch run javascript:fix` | Run the JavaScript linter/formatter and write fixes to disk |
4346

4447
??? tip "Configure your IDE for linting"
4548

@@ -54,6 +57,7 @@ By utilizing `hatch`, the following commands are available to manage the develop
5457
| `hatch run docs:serve` | Start the [`mkdocs`](https://www.mkdocs.org/) server to view documentation locally |
5558
| `hatch run docs:build` | Build the documentation |
5659
| `hatch run docs:linkcheck` | Check for broken links in the documentation |
60+
| `hatch fmt docs --check` | Run linter on code examples in the documentation |
5761

5862
### Environment Management
5963

docs/src/dictionary.txt

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ backhaul
3939
sublicense
4040
contravariant
4141
formatters
42+
linter
4243
linters
4344
linting
4445
pytest

pyproject.toml

+35-17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
build-backend = "hatchling.build"
33
requires = ["hatchling", "hatch-build-scripts"]
44

5+
##############################
6+
# >>> Hatch Build Config <<< #
7+
##############################
8+
59
[project]
610
name = "reactpy_router"
711
description = "A URL router for ReactPy."
@@ -24,7 +28,7 @@ classifiers = [
2428
"Environment :: Web Environment",
2529
"Typing :: Typed",
2630
]
27-
dependencies = ["reactpy>=1.0.0", "typing_extensions"]
31+
dependencies = ["reactpy>=1.0.0, <2.0.0", "typing_extensions"]
2832
dynamic = ["version"]
2933
urls.Changelog = "https://reactive-python.github.io/reactpy-router/latest/about/changelog/"
3034
urls.Documentation = "https://reactive-python.github.io/reactpy-router/latest/"
@@ -35,10 +39,10 @@ path = "src/reactpy_router/__init__.py"
3539

3640
[tool.hatch.build.targets.sdist]
3741
include = ["/src"]
38-
artifacts = ["/src/reactpy_router/static/bundle.js"]
42+
artifacts = ["/src/reactpy_router/static/"]
3943

4044
[tool.hatch.build.targets.wheel]
41-
artifacts = ["/src/reactpy_router/static/bundle.js"]
45+
artifacts = ["/src/reactpy_router/static/"]
4246

4347
[tool.hatch.metadata]
4448
license-files = { paths = ["LICENSE.md"] }
@@ -53,7 +57,9 @@ commands = [
5357
]
5458
artifacts = []
5559

56-
# >>> Hatch Tests <<<
60+
#############################
61+
# >>> Hatch Test Runner <<< #
62+
#############################
5763

5864
[tool.hatch.envs.hatch-test]
5965
extra-dependencies = ["pytest-sugar", "anyio", "reactpy[testing,starlette]"]
@@ -63,24 +69,30 @@ matrix-name-format = "{variable}-{value}"
6369
[[tool.hatch.envs.hatch-test.matrix]]
6470
python = ["3.9", "3.10", "3.11", "3.12"]
6571

66-
# >>> Hatch Documentation Scripts <<<
72+
[tool.pytest.ini_options]
73+
addopts = """\
74+
--strict-config
75+
--strict-markers
76+
"""
77+
78+
#######################################
79+
# >>> Hatch Documentation Scripts <<< #
80+
#######################################
6781

6882
[tool.hatch.envs.docs]
6983
template = "docs"
70-
detached = true
7184
dependencies = [
7285
"mkdocs",
7386
"mkdocs-git-revision-date-localized-plugin",
7487
"mkdocs-material==9.4.0",
7588
"mkdocs-include-markdown-plugin",
76-
"linkcheckmd",
7789
"mkdocs-spellcheck[all]",
7890
"mkdocs-git-authors-plugin",
7991
"mkdocs-minify-plugin",
8092
"mike",
8193
"mkdocstrings[python]",
82-
"black",
83-
"reactpy_router @ {root:uri}",
94+
"black", # Used by mkdocstrings for auto formatting
95+
"linkcheckmd",
8496
]
8597

8698
[tool.hatch.envs.docs.scripts]
@@ -94,10 +106,23 @@ linkcheck = [
94106
deploy_latest = ["cd docs && mike deploy --push --update-aliases {args} latest"]
95107
deploy_develop = ["cd docs && mike deploy --push develop"]
96108

109+
############################
110+
# >>> Hatch JS Scripts <<< #
111+
############################
97112

98-
# >>> Generic Tools <<<
113+
[tool.hatch.envs.javascript]
114+
detached = true
115+
116+
[tool.hatch.envs.javascript.scripts]
117+
check = ["cd src/js && bun install", "cd src/js && bun run check"]
118+
fix = ["cd src/js && bun install", "cd src/js && bun run format"]
119+
120+
#########################
121+
# >>> Generic Tools <<< #
122+
#########################
99123

100124
[tool.ruff]
125+
extend-exclude = [".venv/*", ".eggs/*", "build/*"]
101126
line-length = 120
102127
format.preview = true
103128
lint.extend-ignore = [
@@ -111,13 +136,6 @@ lint.extend-ignore = [
111136
"SLF001", # Private member accessed
112137
]
113138
lint.preview = true
114-
extend-exclude = [".venv/*", ".eggs/*", "build/*"]
115-
116-
[tool.pytest.ini_options]
117-
addopts = """\
118-
--strict-config
119-
--strict-markers
120-
"""
121139

122140
[tool.coverage.run]
123141
branch = true

0 commit comments

Comments
 (0)