Skip to content

Refactor repo to match ReactPy Router #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/publish-develop-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Publish Develop Docs

on:
push:
branches:
Expand All @@ -17,5 +18,6 @@ jobs:
- name: Publish Develop Docs
run: |
git config user.name github-actions
git config user.email [email protected]
git config user.email [email protected]
cd docs
mike deploy --push develop
2 changes: 1 addition & 1 deletion .github/workflows/publish-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish-release-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ jobs:
- name: Publish ${{ github.event.release.name }} Docs
run: |
git config user.name github-actions
git config user.email [email protected]
git config user.email [email protected]
cd docs
mike deploy --push --update-aliases ${{ github.event.release.name }} latest
2 changes: 1 addition & 1 deletion .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
linkcheckMarkdown docs/ -v -r
linkcheckMarkdown README.md -v -r
linkcheckMarkdown CHANGELOG.md -v -r
cd docs
mkdocs build --strict
- name: Check docs examples
run: |
pip install -r requirements/check-types.txt
pip install -r requirements/check-style.txt
mypy --show-error-codes docs/examples/python/
black docs/examples/python/ --check
ruff check docs/examples/python/
3 changes: 1 addition & 2 deletions .github/workflows/test-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ jobs:
- name: Install Python Dependencies
run: pip install -r requirements/test-run.txt
- name: Run Tests
run: |
nox -s test
run: nox -t test
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ Using the following categories, list your changes in this order:

- Support for IDOM within the Django

[unreleased]: https://github.com/reactive-python/reactpy-django/compare/3.6.0...HEAD
[Unreleased]: https://github.com/reactive-python/reactpy-django/compare/3.6.0...HEAD
[3.6.0]: https://github.com/reactive-python/reactpy-django/compare/3.5.1...3.6.0
[3.5.1]: https://github.com/reactive-python/reactpy-django/compare/3.5.0...3.5.1
[3.5.0]: https://github.com/reactive-python/reactpy-django/compare/3.4.0...3.5.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<a href="https://pypi.python.org/pypi/reactpy-django">
<img src="https://img.shields.io/pypi/v/reactpy-django.svg?label=PyPI">
</a>
<a href="https://github.com/reactive-python/reactpy/blob/main/LICENSE">
<a href="https://github.com/reactive-python/reactpy-django/blob/main/LICENSE.md">
<img src="https://img.shields.io/badge/License-MIT-purple.svg">
</a>
<a href="https://reactive-python.github.io/reactpy-django/">
Expand Down
17 changes: 8 additions & 9 deletions mkdocs.yml → docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ nav:

theme:
name: material
custom_dir: docs/overrides
custom_dir: overrides
palette:
- media: "(prefers-color-scheme: dark)"
scheme: slate
Expand Down Expand Up @@ -114,12 +114,11 @@ extra_css:
- assets/css/home.css

watch:
- docs
- mkdocs.yml
- README.md
- CHANGELOG.md
- LICENSE.md
- .mailmap
- ../docs
- ../README.md
- ../CHANGELOG.md
- ../LICENSE.md
- ../.mailmap

site_name: ReactPy-Django
site_author: Archmonger
Expand All @@ -133,6 +132,6 @@ This project has no affiliation to ReactJS or Meta Platforms, Inc.
</div>'
repo_url: https://github.com/reactive-python/reactpy-django
site_url: https://reactive-python.github.io/reactpy-django
repo_name: reactive-python/reactpy-django
repo_name: ReactPy Django (GitHub)
edit_uri: edit/main/docs/src
docs_dir: docs/src
docs_dir: src
4 changes: 2 additions & 2 deletions docs/src/about/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ pip install -r requirements.txt --upgrade --verbose
By running the command below you can run the full test suite:

```bash linenums="0"
nox -s test
nox -t test
```

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

```bash linenums="0"
nox -s test -- --headless
nox -t test -- --headless
```

## Running Django tests
Expand Down
1 change: 1 addition & 0 deletions docs/src/about/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pip install -r requirements.txt --upgrade
Finally, to verify that everything is working properly, you can manually run the docs preview web server.

```bash linenums="0"
cd docs
mkdocs serve
```

Expand Down
58 changes: 18 additions & 40 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,19 @@
from __future__ import annotations

import re
from glob import glob
from pathlib import Path

import nox
from nox.sessions import Session
from nox import Session, session

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


@nox.session(reuse_venv=True)
def manage(session: Session) -> None:
"""Run a manage.py command for tests/test_app"""
session.install("-r", "requirements/test-env.txt")
session.install("reactpy[stable]")
session.install("-e", ".")
session.chdir("tests")
session.run("python", "manage.py", *session.posargs)


@nox.session
def test(session: Session) -> None:
"""Run the complete test suite"""
session.install("--upgrade", "pip", "setuptools", "wheel")
session.notify("test_suite", posargs=session.posargs)
session.notify("test_types")
session.notify("test_style")


@nox.session
def test_suite(session: Session) -> None:
@session(tags=["test"])
def test_python(session: Session) -> None:
"""Run the Python-based test suite"""
install_requirements_file(session, "test-env")
session.install(".[all]")
session.chdir(HERE / "tests")
session.chdir(ROOT_DIR / "tests")
session.env["REACTPY_DEBUG_MODE"] = "1"

posargs = session.posargs[:]
Expand All @@ -53,9 +31,7 @@ def test_suite(session: Session) -> None:
settings_files = glob(settings_glob)
assert settings_files, f"No Django settings files found at '{settings_glob}'!"
for settings_file in settings_files:
settings_module = (
settings_file.strip(".py").replace("/", ".").replace("\\", ".")
)
settings_module = settings_file.strip(".py").replace("/", ".").replace("\\", ".")
session.run(
"python",
"manage.py",
Expand All @@ -68,28 +44,30 @@ def test_suite(session: Session) -> None:
)


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


@nox.session
@session(tags=["test"])
def test_style(session: Session) -> None:
"""Check that style guidelines are being followed"""
install_requirements_file(session, "check-style")
session.run(
"black",
".",
"--check",
"--extend-exclude",
"/migrations/",
)
session.run("ruff", "check", ".")


@session(tags=["test"])
def test_javascript(session: Session) -> None:
install_requirements_file(session, "test-env")
session.chdir(ROOT_DIR / "src" / "js")
session.run("python", "-m", "nodejs.npm", "install", external=True)
session.run("python", "-m", "nodejs.npm", "run", "check")


def install_requirements_file(session: Session, name: str) -> None:
file_path = HERE / "requirements" / f"{name}.txt"
session.install("--upgrade", "pip", "setuptools", "wheel")
file_path = ROOT_DIR / "requirements" / f"{name}.txt"
assert file_path.exists(), f"requirements file {file_path} does not exist"
session.install("-r", str(file_path))
1 change: 0 additions & 1 deletion requirements/check-style.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
black
ruff
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
package = {
"name": name,
"python_requires": ">=3.9",
"packages": find_namespace_packages(str(src_dir)),
"packages": find_namespace_packages(src_dir),
"package_dir": {"": "src"},
"description": "It's React, but in Python. Now with Django integration.",
"author": "Mark Bakhit",
Expand Down
Loading