Skip to content

Commit e3d0866

Browse files
authored
Refactor repo to match ReactPy Router (#216)
1 parent c3eee76 commit e3d0866

21 files changed

+3481
-1080
lines changed

Diff for: .github/workflows/publish-develop-docs.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Publish Develop Docs
2+
23
on:
34
push:
45
branches:
@@ -17,5 +18,6 @@ jobs:
1718
- name: Publish Develop Docs
1819
run: |
1920
git config user.name github-actions
20-
git config user.email [email protected]
21+
git config user.email [email protected]
22+
cd docs
2123
mike deploy --push develop

Diff for: .github/workflows/publish-py.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v3
1515
- name: Set up Python
16-
uses: actions/setup-python@v1
16+
uses: actions/setup-python@v4
1717
with:
1818
python-version: "3.x"
1919
- name: Install dependencies

Diff for: .github/workflows/publish-release-docs.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ jobs:
1818
- name: Publish ${{ github.event.release.name }} Docs
1919
run: |
2020
git config user.name github-actions
21-
git config user.email [email protected]
21+
git config user.email [email protected]
22+
cd docs
2223
mike deploy --push --update-aliases ${{ github.event.release.name }} latest

Diff for: .github/workflows/test-docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
linkcheckMarkdown docs/ -v -r
2727
linkcheckMarkdown README.md -v -r
2828
linkcheckMarkdown CHANGELOG.md -v -r
29+
cd docs
2930
mkdocs build --strict
3031
- name: Check docs examples
3132
run: |
3233
pip install -r requirements/check-types.txt
3334
pip install -r requirements/check-style.txt
3435
mypy --show-error-codes docs/examples/python/
35-
black docs/examples/python/ --check
3636
ruff check docs/examples/python/

Diff for: .github/workflows/test-src.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ jobs:
2525
- name: Install Python Dependencies
2626
run: pip install -r requirements/test-run.txt
2727
- name: Run Tests
28-
run: |
29-
nox -s test
28+
run: nox -t test

Diff for: CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ Using the following categories, list your changes in this order:
444444

445445
- Support for IDOM within the Django
446446

447-
[unreleased]: https://github.com/reactive-python/reactpy-django/compare/3.6.0...HEAD
447+
[Unreleased]: https://github.com/reactive-python/reactpy-django/compare/3.6.0...HEAD
448448
[3.6.0]: https://github.com/reactive-python/reactpy-django/compare/3.5.1...3.6.0
449449
[3.5.1]: https://github.com/reactive-python/reactpy-django/compare/3.5.0...3.5.1
450450
[3.5.0]: https://github.com/reactive-python/reactpy-django/compare/3.4.0...3.5.0

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<a href="https://pypi.python.org/pypi/reactpy-django">
88
<img src="https://img.shields.io/pypi/v/reactpy-django.svg?label=PyPI">
99
</a>
10-
<a href="https://github.com/reactive-python/reactpy/blob/main/LICENSE">
10+
<a href="https://github.com/reactive-python/reactpy-django/blob/main/LICENSE.md">
1111
<img src="https://img.shields.io/badge/License-MIT-purple.svg">
1212
</a>
1313
<a href="https://reactive-python.github.io/reactpy-django/">

Diff for: mkdocs.yml renamed to docs/mkdocs.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ nav:
2525

2626
theme:
2727
name: material
28-
custom_dir: docs/overrides
28+
custom_dir: overrides
2929
palette:
3030
- media: "(prefers-color-scheme: dark)"
3131
scheme: slate
@@ -114,12 +114,11 @@ extra_css:
114114
- assets/css/home.css
115115

116116
watch:
117-
- docs
118-
- mkdocs.yml
119-
- README.md
120-
- CHANGELOG.md
121-
- LICENSE.md
122-
- .mailmap
117+
- ../docs
118+
- ../README.md
119+
- ../CHANGELOG.md
120+
- ../LICENSE.md
121+
- ../.mailmap
123122

124123
site_name: ReactPy-Django
125124
site_author: Archmonger
@@ -133,6 +132,6 @@ This project has no affiliation to ReactJS or Meta Platforms, Inc.
133132
</div>'
134133
repo_url: https://github.com/reactive-python/reactpy-django
135134
site_url: https://reactive-python.github.io/reactpy-django
136-
repo_name: reactive-python/reactpy-django
135+
repo_name: ReactPy Django (GitHub)
137136
edit_uri: edit/main/docs/src
138-
docs_dir: docs/src
137+
docs_dir: src

Diff for: docs/src/about/code.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ pip install -r requirements.txt --upgrade --verbose
5252
By running the command below you can run the full test suite:
5353

5454
```bash linenums="0"
55-
nox -s test
55+
nox -t test
5656
```
5757

5858
Or, if you want to run the tests in the background:
5959

6060
```bash linenums="0"
61-
nox -s test -- --headless
61+
nox -t test -- --headless
6262
```
6363

6464
## Running Django tests

Diff for: docs/src/about/docs.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pip install -r requirements.txt --upgrade
3434
Finally, to verify that everything is working properly, you can manually run the docs preview web server.
3535

3636
```bash linenums="0"
37+
cd docs
3738
mkdocs serve
3839
```
3940

Diff for: noxfile.py

+18-40
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,19 @@
11
from __future__ import annotations
22

3-
import re
43
from glob import glob
54
from pathlib import Path
65

7-
import nox
8-
from nox.sessions import Session
6+
from nox import Session, session
97

10-
HERE = Path(__file__).parent
11-
POSARGS_PATTERN = re.compile(r"^(\w+)\[(.+)\]$")
8+
ROOT_DIR = Path(__file__).parent
129

1310

14-
@nox.session(reuse_venv=True)
15-
def manage(session: Session) -> None:
16-
"""Run a manage.py command for tests/test_app"""
17-
session.install("-r", "requirements/test-env.txt")
18-
session.install("reactpy[stable]")
19-
session.install("-e", ".")
20-
session.chdir("tests")
21-
session.run("python", "manage.py", *session.posargs)
22-
23-
24-
@nox.session
25-
def test(session: Session) -> None:
26-
"""Run the complete test suite"""
27-
session.install("--upgrade", "pip", "setuptools", "wheel")
28-
session.notify("test_suite", posargs=session.posargs)
29-
session.notify("test_types")
30-
session.notify("test_style")
31-
32-
33-
@nox.session
34-
def test_suite(session: Session) -> None:
11+
@session(tags=["test"])
12+
def test_python(session: Session) -> None:
3513
"""Run the Python-based test suite"""
3614
install_requirements_file(session, "test-env")
3715
session.install(".[all]")
38-
session.chdir(HERE / "tests")
16+
session.chdir(ROOT_DIR / "tests")
3917
session.env["REACTPY_DEBUG_MODE"] = "1"
4018

4119
posargs = session.posargs[:]
@@ -53,9 +31,7 @@ def test_suite(session: Session) -> None:
5331
settings_files = glob(settings_glob)
5432
assert settings_files, f"No Django settings files found at '{settings_glob}'!"
5533
for settings_file in settings_files:
56-
settings_module = (
57-
settings_file.strip(".py").replace("/", ".").replace("\\", ".")
58-
)
34+
settings_module = settings_file.strip(".py").replace("/", ".").replace("\\", ".")
5935
session.run(
6036
"python",
6137
"manage.py",
@@ -68,28 +44,30 @@ def test_suite(session: Session) -> None:
6844
)
6945

7046

71-
@nox.session
47+
@session(tags=["test"])
7248
def test_types(session: Session) -> None:
7349
install_requirements_file(session, "check-types")
7450
install_requirements_file(session, "pkg-deps")
7551
session.run("mypy", "--show-error-codes", "src/reactpy_django", "tests/test_app")
7652

7753

78-
@nox.session
54+
@session(tags=["test"])
7955
def test_style(session: Session) -> None:
8056
"""Check that style guidelines are being followed"""
8157
install_requirements_file(session, "check-style")
82-
session.run(
83-
"black",
84-
".",
85-
"--check",
86-
"--extend-exclude",
87-
"/migrations/",
88-
)
8958
session.run("ruff", "check", ".")
9059

9160

61+
@session(tags=["test"])
62+
def test_javascript(session: Session) -> None:
63+
install_requirements_file(session, "test-env")
64+
session.chdir(ROOT_DIR / "src" / "js")
65+
session.run("python", "-m", "nodejs.npm", "install", external=True)
66+
session.run("python", "-m", "nodejs.npm", "run", "check")
67+
68+
9269
def install_requirements_file(session: Session, name: str) -> None:
93-
file_path = HERE / "requirements" / f"{name}.txt"
70+
session.install("--upgrade", "pip", "setuptools", "wheel")
71+
file_path = ROOT_DIR / "requirements" / f"{name}.txt"
9472
assert file_path.exists(), f"requirements file {file_path} does not exist"
9573
session.install("-r", str(file_path))

Diff for: requirements/check-style.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
black
21
ruff

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
package = {
2626
"name": name,
2727
"python_requires": ">=3.9",
28-
"packages": find_namespace_packages(str(src_dir)),
28+
"packages": find_namespace_packages(src_dir),
2929
"package_dir": {"": "src"},
3030
"description": "It's React, but in Python. Now with Django integration.",
3131
"author": "Mark Bakhit",

0 commit comments

Comments
 (0)