Skip to content

Commit 9369442

Browse files
committed
potentially working check workflows
1 parent 42f4ab3 commit 9369442

File tree

19 files changed

+1153
-765
lines changed

19 files changed

+1153
-765
lines changed

.github/workflows/check.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,32 @@ jobs:
1515
uses: ./.github/workflows/.hatch-run.yml
1616
with:
1717
job-name: "python-{0}"
18-
hatch-run: "test-py"
18+
run-cmd: "hatch test --cover"
1919
lint-py:
2020
uses: ./.github/workflows/.hatch-run.yml
2121
with:
2222
job-name: "python-{0}"
23-
hatch-run: "lint-py"
23+
run-cmd: "hatch run python:check"
2424
test-py-matrix:
2525
uses: ./.github/workflows/.hatch-run.yml
2626
with:
2727
job-name: "python-{0} {1}"
28-
hatch-run: "test-py --no-cov"
28+
run-cmd: "hatch test"
2929
runs-on: '["ubuntu-latest", "macos-latest", "windows-latest"]'
3030
python-version: '["3.9", "3.10", "3.11"]'
3131
test-docs:
3232
uses: ./.github/workflows/.hatch-run.yml
3333
with:
3434
job-name: "python-{0}"
35-
hatch-run: "test-docs"
36-
# as of Dec 2023 lxml does have wheels for 3.12
37-
# https://bugs.launchpad.net/lxml/+bug/2040440
35+
run-cmd: "hatch run docs:check"
3836
python-version: '["3.11"]'
3937
test-js:
4038
uses: ./.github/workflows/.hatch-run.yml
4139
with:
4240
job-name: "{1}"
43-
hatch-run: "test-js"
41+
run-cmd: "hatch run javascript:test"
4442
lint-js:
4543
uses: ./.github/workflows/.hatch-run.yml
4644
with:
4745
job-name: "{1}"
48-
hatch-run: "lint-js"
46+
run-cmd: "hatch run javascript:check"

LICENSE.md renamed to LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## The MIT License (MIT)
1+
The MIT License (MIT)
22

3-
#### Copyright (c) Reactive Python and affiliates.
3+
Copyright (c) Reactive Python and affiliates.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

docs/README.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
11
# ReactPy's Documentation
22

3-
We provide two main ways to run the docs. Both use
4-
[`nox`](https://pypi.org/project/nox/):
5-
6-
- `nox -s docs` - displays the docs and rebuilds when files are modified.
7-
- `nox -s docs-in-docker` - builds a docker image and runs the docs from there.
8-
9-
If any changes to the core of the documentation are made (i.e. to non-`*.rst` files),
10-
then you should run a manual test of the documentation using the `docs_in_docker`
11-
session.
12-
13-
If you wish to build and run the docs by hand you need to perform two commands, each
14-
being run from the root of the repository:
15-
16-
- `sphinx-build -b html docs/source docs/build`
17-
- `python scripts/run_docs.py`
18-
19-
The first command constructs the static HTML and any Javascript. The latter actually
20-
runs the web server that serves the content.
3+
...

docs/poetry.lock

Lines changed: 1087 additions & 685 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ readme = "README.md"
77

88
[tool.poetry.dependencies]
99
python = "^3.9"
10-
reactpy = { path = "../src/py/reactpy", extras = ["starlette", "sanic", "fastapi", "flask", "tornado", "testing"], develop = false }
1110
furo = "2022.04.07"
11+
reactpy = { path = "..", extras = ["all"], develop = false }
1212
sphinx = "*"
1313
sphinx-autodoc-typehints = "*"
1414
sphinx-copybutton = "*"

docs/source/_custom_js/package-lock.json

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/source/_exts/autogen_api_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
HERE = Path(__file__).parent
1010
SRC = HERE.parent.parent.parent / "src"
11-
PYTHON_PACKAGE = SRC / "py" / "reactpy" / "reactpy"
11+
PYTHON_PACKAGE = SRC / "reactpy"
1212

1313
AUTO_DIR = HERE.parent / "_auto"
1414
AUTO_DIR.mkdir(exist_ok=True)

pyproject.toml

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -132,29 +132,48 @@ cov = ["test-cov {args}", "cov-report"]
132132
[tool.hatch.envs.default.env-vars]
133133
REACTPY_DEBUG_MODE = "1"
134134

135+
#######################################
136+
# >>> Hatch Documentation Scripts <<< #
137+
#######################################
138+
[tool.hatch.envs.docs]
139+
template = "docs"
140+
dependencies = ["poetry"]
141+
detached = true
142+
143+
[tool.hatch.envs.docs.scripts]
144+
build = [
145+
"cd docs && poetry install",
146+
"cd docs && poetry run sphinx-build -a -T -W --keep-going -b doctest source build",
147+
]
148+
docker_build = [
149+
"hatch run docs:build",
150+
"cd docs && docker build . --file ./docs/Dockerfile --tag reactpy-docs:latest",
151+
]
152+
check = [
153+
"cd docs && poetry install",
154+
"cd docs && poetry run sphinx-build -a -T -W --keep-going -b doctest source build",
155+
"cd docs && docker build . --file docs/Dockerfile",
156+
]
157+
135158
################################
136159
# >>> Hatch Python Scripts <<< #
137160
################################
138161

139-
[tool.hatch.envs.lint]
162+
[tool.hatch.envs.python]
140163
extra-dependencies = [
141-
"black==24.1.1",
142-
"ruff==0.0.278",
143-
"flake8==7.0.0",
164+
"ruff",
144165
"toml",
145-
"flake8-pyproject",
146-
"mypy",
147-
"types-toml",
148166
"mypy==1.8",
167+
"types-toml",
149168
"types-click",
150169
"types-tornado",
151170
"types-flask",
152171
"types-requests",
153172
]
154173

155174
[tool.hatch.envs.python.scripts]
156-
# TODO: Replace mypy with pylint
157-
type_check = "mypy --strict src/reactpy"
175+
# TODO: Replace mypy with pyright
176+
check = ["mypy --strict src/reactpy", "hatch fmt src/reactpy --check"]
158177

159178
############################
160179
# >>> Hatch JS Scripts <<< #
@@ -236,7 +255,7 @@ omit = ["reactpy/__main__.py"]
236255
[tool.ruff]
237256
target-version = "py39"
238257
line-length = 88
239-
select = [
258+
lint.select = [
240259
"A",
241260
"ARG",
242261
"B",
@@ -250,7 +269,6 @@ select = [
250269
# "FBT",
251270
"I",
252271
"ICN",
253-
"ISC",
254272
"N",
255273
"PLC",
256274
"PLE",
@@ -265,7 +283,7 @@ select = [
265283
"W",
266284
"YTT",
267285
]
268-
ignore = [
286+
lint.ignore = [
269287
# TODO: turn this on later
270288
"N802",
271289
"N806", # allow TitleCase functions/variables
@@ -299,22 +317,22 @@ ignore = [
299317
"PLR0913",
300318
"PLR0915",
301319
]
302-
unfixable = [
320+
lint.unfixable = [
303321
# Don't touch unused imports
304322
"F401",
305323
]
306324

307-
[tool.ruff.isort]
325+
[tool.ruff.lint.isort]
308326
known-first-party = ["reactpy"]
309327

310-
[tool.ruff.flake8-tidy-imports]
328+
[tool.ruff.lint.flake8-tidy-imports]
311329
ban-relative-imports = "all"
312330

313331
[tool.flake8]
314332
select = ["RPY"] # only need to check with reactpy-flake8
315333
exclude = ["**/node_modules/*", ".eggs/*", ".tox/*", "**/venv/*"]
316334

317-
[tool.ruff.per-file-ignores]
335+
[tool.ruff.lint.per-file-ignores]
318336
# Tests can use magic values, assertions, and relative imports
319337
"**/tests/**/*" = ["PLR2004", "S101", "TID252"]
320338
"docs/**/*.py" = [

src/reactpy/_console/rewrite_camel_case_props.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import ast
44
import re
5-
import sys
65
from copy import copy
76
from keyword import kwlist
87
from pathlib import Path
@@ -23,9 +22,6 @@
2322
@click.argument("paths", nargs=-1, type=click.Path(exists=True))
2423
def rewrite_camel_case_props(paths: list[str]) -> None:
2524
"""Rewrite camelCase props to snake_case"""
26-
if sys.version_info < (3, 9): # nocov
27-
msg = "This command requires Python>=3.9"
28-
raise RuntimeError(msg)
2925

3026
for p in map(Path, paths):
3127
for f in [p] if p.is_file() else p.rglob("*.py"):

src/reactpy/_console/rewrite_keys.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import ast
4-
import sys
54
from pathlib import Path
65

76
import click
@@ -45,9 +44,6 @@ def rewrite_keys(paths: list[str]) -> None:
4544
just above its changes. As such it requires manual intervention to put those
4645
comments back in their original location.
4746
"""
48-
if sys.version_info < (3, 9): # nocov
49-
msg = "This command requires Python>=3.9"
50-
raise RuntimeError(msg)
5147

5248
for p in map(Path, paths):
5349
for f in [p] if p.is_file() else p.rglob("*.py"):

0 commit comments

Comments
 (0)