Skip to content

Commit 5ee7998

Browse files
committed
add tools and packages section, remove outdated references, and fix Jinja template link
1 parent 1e93576 commit 5ee7998

File tree

9 files changed

+46
-40
lines changed

9 files changed

+46
-40
lines changed

docs/examples/tutorial_tic_tac_toe/tic_tac_toe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def inner(event):
3434
f"Winner: {winner}" if winner else "Next player: " + ("X" if x_is_next else "O")
3535
)
3636

37-
return html._(
37+
return html.fragment(
3838
html.div({"className": "status"}, status),
3939
html.div(
4040
{"className": "board-row"},

docs/mkdocs.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ nav:
1111
- Add React to an Existing Project: learn/add-react-to-an-existing-project.md
1212
- Setup:
1313
- Editor Setup: learn/editor-setup.md
14-
# - ReactPy Developer Tools 🚫: learn/react-developer-tools.md
15-
- Tools, Modules, and Packages 🚧: learn/extra-tools-and-packages.md
14+
- Tools, Libraries, and Packages: learn/tools-and-packages.md
1615
# - More Tutorials:
1716
# - "Tutorial: React Bootstrap 🚫": learn/tutorial-react-bootstrap.md
1817
# - "Tutorial: Material UI 🚫": learn/tutorial-material-ui.md
@@ -85,8 +84,8 @@ nav:
8584
- Components and Hooks must be pure 🚧: reference/components-and-hooks-must-be-pure.md
8685
- React calls Components and Hooks 🚧: reference/react-calls-components-and-hooks.md
8786
- Rules of Hooks 🚧: reference/rules-of-hooks.md
88-
# - Template Tags:
89-
# - Jinja 🚧: reference/jinja.md
87+
- Template Tags:
88+
- Jinja 🚧: reference/jinja.md
9089
- Protocol Structure 🚧: reference/protocol-structure.md
9190
- Client API 🚧: reference/client-api.md
9291
- About:

docs/overrides/homepage_examples/add_interactivity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def searchable_video_list(videos):
1717
search_text, set_search_text = use_state("")
1818
found_videos = filter_videos(videos, search_text)
1919

20-
return html._(
20+
return html.fragment(
2121
search_input(
2222
{"onChange": lambda event: set_search_text(event["target"]["value"])},
2323
value=search_text,

docs/src/learn/add-react-to-an-existing-project.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ First, install ReactPy, Starlette, and your preferred ASGI webserver.
4646

4747
Next, configure your ASGI framework to use ReactPy's Jinja2 template tag. The method for doing this will vary depending on the ASGI framework you are using. Below is an example that follow's [Starlette's documentation](https://www.starlette.io/templates/):
4848

49+
!!! abstract "Note"
50+
51+
The `ReactPyJinja` extension enables a handful of [template tags](../reference/jinja.md) that allow you to render ReactPy components in your templates. The `component` tag is used to render a ReactPy SSR component, while the `pyscript_setup` and `pyscript_component` tags can be used together to render CSR components.
52+
4953
```python linenums="0" hl_lines="6 11 17"
5054
{% include "../../examples/add_react_to_an_existing_project/asgi_configure_jinja.py" %}
5155
```
5256

5357
Now you will need to wrap your existing ASGI application with ReactPy's middleware, define the dotted path to your root components, and render your components in your existing HTML templates.
5458

55-
!!! abstract "Note"
56-
57-
The `ReactPyJinja` extension enables a handful of [template tags](/reference/templatetags/) that allow you to render ReactPy components in your templates. The `component` tag is used to render a ReactPy SSR component, while the `pyscript_setup` and `pyscript_component` tags can be used together to render CSR components.
58-
5959
=== "main.py"
6060

6161
```python hl_lines="6 22"

docs/src/learn/creating-a-react-app.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ These standalone executors are the easiest way to get started with ReactPy, as t
2020

2121
In order to serve the initial HTML page, you will need to run a server. The ASGI examples below use [Uvicorn](https://www.uvicorn.org/), but you can use [any ASGI server](https://github.com/florimondmanca/awesome-asgi#servers).
2222

23-
Executors on this page can either support client-side rendering ([CSR](https://developer.mozilla.org/en-US/docs/Glossary/CSR)) or server-side rendering ([SSR](https://developer.mozilla.org/en-US/docs/Glossary/SSR))
23+
Executors on this page can either support client-side rendering ([CSR](https://developer.mozilla.org/en-US/docs/Glossary/CSR)) or server-side rendering ([SSR](https://developer.mozilla.org/en-US/docs/Glossary/SSR)).
2424

2525
### Running via ASGI SSR
2626

@@ -93,3 +93,7 @@ Support for WSGI executors is coming in a [future version](https://github.com/re
9393
### Running via WSGI CSR
9494

9595
Support for WSGI executors is coming in a [future version](https://github.com/reactive-python/reactpy/issues/1260).
96+
97+
### Running as a native app
98+
99+
Support for native apps (iO, Android, Windows, etc.) is coming in a [future version](https://github.com/reactive-python/reactpy/issues/570).

docs/src/learn/editor-setup.md

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,54 +17,39 @@ A properly configured editor can make code clearer to read and faster to write.
1717

1818
Other popular text editors used in the React community include:
1919

20-
- [WebStorm](https://www.jetbrains.com/webstorm/) is an integrated development environment designed specifically for JavaScript.
2120
- [Sublime Text](https://www.sublimetext.com/) has support for [syntax highlighting](https://stackoverflow.com/a/70960574/458193) and autocomplete built in.
2221
- [Vim](https://www.vim.org/) is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems and with Apple OS X.
2322

2423
## Recommended text editor features
2524

2625
Some editors come with these features built in, but others might require adding an extension. Check to see what support your editor of choice provides to be sure!
2726

28-
### Python Linting
27+
### Linting
2928

30-
Linting is the process of running a program that will analyse code for potential errors. [Flake8](https://flake8.pycqa.org/en/latest/) is a popular, open source linter for Python.
29+
Linting is the process of running a program that will analyse code for potential errors. [Ruff](https://docs.astral.sh/ruff/) is Reactive Python's linter of choice due to its speed and configurability. Additionally, we recommend using [Pyright](https://microsoft.github.io/pyright/) as a performant type checker for Python.
3130

32-
- [Install Flake8](https://flake8.pycqa.org/en/latest/#installation) (be sure you have [Python installed!](https://www.python.org/downloads/))
33-
- [Integrate Flake8 in VSCode with the official extension](https://marketplace.visualstudio.com/items?itemName=ms-python.flake8)
34-
- [Install Reactpy-Flake8](https://pypi.org/project/reactpy-flake8/) to lint your ReactPy code
31+
Be sure you have [Python installed](https://www.python.org/downloads/) before you proceed!
3532

36-
### JavaScript Linting
37-
38-
You typically won't use much JavaScript alongside ReactPy, but there are still some cases where you might. For example, you might want to use JavaScript to fetch data from an API or to add some interactivity to your app.
39-
40-
In these cases, it's helpful to have a linter that can catch common mistakes in your code as you write it. [ESLint](https://eslint.org/) is a popular, open source linter for JavaScript.
41-
42-
- [Install ESLint with the recommended configuration for React](https://www.npmjs.com/package/eslint-config-react-app) (be sure you have [Node installed!](https://nodejs.org/en/download/current/))
43-
- [Integrate ESLint in VSCode with the official extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
44-
45-
**Make sure that you've enabled all the [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) rules for your project.** They are essential and catch the most severe bugs early. The recommended [`eslint-config-react-app`](https://www.npmjs.com/package/eslint-config-react-app) preset already includes them.
33+
- [Install Ruff using the VSCode extension](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff) or the [standalone package](https://docs.astral.sh/ruff/installation/).
34+
- [Install Pyright using the VSCode extension](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance) or the [standalone package](https://microsoft.github.io/pyright/#/installation).
4635

4736
### Formatting
4837

49-
The last thing you want to do when sharing your code with another contributor is get into an discussion about [tabs vs spaces](https://www.google.com/search?q=tabs+vs+spaces)! Fortunately, [Prettier](https://prettier.io/) will clean up your code by reformatting it to conform to preset, configurable rules. Run Prettier, and all your tabs will be converted to spaces—and your indentation, quotes, etc will also all be changed to conform to the configuration. In the ideal setup, Prettier will run when you save your file, quickly making these edits for you.
38+
The last thing you want to do when sharing your code with another contributor is get into an discussion about [tabs vs spaces](https://www.google.com/search?q=tabs+vs+spaces)! Fortunately, [Ruff](https://docs.astral.sh/ruff/) will clean up your code by reformatting it to conform to preset, configurable rules. Run Ruff, and all your tabs will be converted to spaces—and your indentation, quotes, etc will also all be changed to conform to the configuration. In the ideal setup, Ruff will run when you save your file, quickly making these edits for you.
5039

51-
You can install the [Prettier extension in VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) by following these steps:
40+
You can install the [Ruff extension in VSCode](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff) by following these steps:
5241

5342
1. Launch VS Code
5443
2. Use Quick Open, press ++ctrl+p++
55-
3. Paste in `ext install esbenp.prettier-vscode`
44+
3. Paste in `ext install charliermarsh.ruff`
5645
4. Press Enter
5746

58-
#### Formatting on save
47+
**Formatting on save**
5948

6049
Ideally, you should format your code on every save. VS Code has settings for this!
6150

6251
1. In VS Code, press ++ctrl+shift+p++
63-
2. Type "settings"
52+
2. Type "workspace settings"
6453
3. Hit Enter
65-
4. In the search bar, type "format on save"
66-
5. Be sure the "format on save" option is ticked!
67-
68-
!!! abstract "Note"
69-
70-
If your ESLint preset has formatting rules, they may conflict with Prettier. We recommend disabling all formatting rules in your ESLint preset using [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) so that ESLint is _only_ used for catching logical mistakes. If you want to enforce that files are formatted before a pull request is merged, use [`prettier --check`](https://prettier.io/docs/en/cli.html#--check) for your continuous integration.
54+
4. In the search bar, type "Format on save"
55+
5. Be sure the "Format on save" option is ticked!

docs/src/learn/extra-tools-and-packages.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/src/learn/tools-and-packages.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<p class="intro" markdown>
2+
3+
Use external ReactPy packages and tools to help you build your projects.
4+
5+
</p>
6+
7+
## First party packages
8+
9+
The Reactive Python organization provides several packages and tools to help you build your projects.
10+
11+
| Package | Description |
12+
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
13+
| [ReactPy Router](https://reactive-python.github.io/reactpy-router/) | URL router for ReactPy to help you build single-page applications. |
14+
| [ReactPy Django](https://reactive-python.github.io/reactpy-django/) | A Django integration for ReactPy. Comes with several Django-exclusive features. |
15+
16+
## Third party packages
17+
18+
There are also a number of third-party packages that can help you build your projects.
19+
20+
You can find a list of these packages on the [ReactPy GitHub Discussions](https://github.com/reactive-python/reactpy/discussions/categories/third-party-packages).

docs/src/reference/jinja.md

Whitespace-only changes.

0 commit comments

Comments
 (0)