From 8b7fb89c6862f9e7d3388248a4b5f5d411da06db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?F=C3=A1bio=20Rosado?=
Date: Tue, 6 Dec 2022 14:36:17 +0000
Subject: [PATCH] Update docs examples so they don't use deprecated features,
styling tweaks (#982)
* Deprecate pyscript output attribute
* Update code blocks so they work
* Small tweaks to styling and use html to warning
* Fix broken test from bad conflict resolution
* lowercase pyodide
---
docs/development/deprecation-cycle.md | 2 +-
docs/guides/http-requests.md | 63 +++++----
docs/guides/passing-objects.md | 128 +++++++++++++++++-
docs/reference/API/display.md | 21 ++-
docs/reference/API/version_info.md | 12 +-
docs/reference/elements/py-config.md | 31 +++--
docs/reference/elements/py-repl.md | 25 +++-
docs/reference/elements/py-script.md | 10 +-
docs/reference/modules/pyscript.md | 2 +-
pyscriptjs/src/plugins/splashscreen.ts | 2 +-
pyscriptjs/src/styles/pyscript_base.css | 2 +
.../tests/integration/test_splashscreen.py | 2 +-
12 files changed, 224 insertions(+), 76 deletions(-)
diff --git a/docs/development/deprecation-cycle.md b/docs/development/deprecation-cycle.md
index 2a717f4c..2928bf39 100644
--- a/docs/development/deprecation-cycle.md
+++ b/docs/development/deprecation-cycle.md
@@ -26,5 +26,5 @@ showWarning(`
The py-deprecated tag is deprecated. Please use the py-actual tag instead. Please refer to this documentation page for more information.
-`)
+`, "html")
```
diff --git a/docs/guides/http-requests.md b/docs/guides/http-requests.md
index 38342902..271c1592 100644
--- a/docs/guides/http-requests.md
+++ b/docs/guides/http-requests.md
@@ -14,14 +14,18 @@ from `PyScript` using Python, since currently, the common tools such as `request
The `fetch` API is a modern way to make HTTP requests. It is available in all modern browsers, and in Pyodide.
-Although there are two ways to use `fetch`, 1) using `JavaScript` from `PyScript`, and 2) using Pyodide's Python wrapper,
-`Pyodide.http.pyfetch`, this example will only show how to use the Python wrapper. Still, the
+Although there are two ways to use `fetch`:
+1) using `JavaScript` from `PyScript`
+2) using Pyodide's Python wrapper,
+`pyodide.http.pyfetch`
+
+This example will only show how to use the Python wrapper. Still, the
[fetch documentation](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters) is a useful reference, as its
parameters can be called from Python using the `pyfetch` wrapper.
## Pyodide.http, pyfetch, and FetchResponse
-[Pyodide.http module](https://pyodide.org/en/stable/usage/api/python-api/http.html#module-pyodide.http) is a Python API
+The [pyodide.http module](https://pyodide.org/en/stable/usage/api/python-api/http.html#module-pyodide.http) is a Python API
for dealing with HTTP requests. It provides the `pyfetch` function as a wrapper for the `fetch` API,
which returns a `FetchResponse` object whenever a request is made. Extra keyword arguments can be passed to `pyfetch`
which will be passed to the `fetch` API.
@@ -92,9 +96,9 @@ concluding html code.
GET, POST, PUT, DELETE example
-
+
-
+
[[fetch]]
files = ["/request.py"]
@@ -106,34 +110,33 @@ concluding html code.
Here is the output of your request:
@@ -195,7 +198,7 @@ await pyodide.http.pyfetch(url: str, **kwargs: Any) -> FetchResponse
```
Use `pyfetch` to make HTTP requests in `PyScript`. This is a wrapper around the `fetch` API. Returns a `FetchResponse`.
-### [`pyfetch` Docs.](https://pyodide.org/en/stable/usage/api/python-api/http.html#pyodide.http.pyfetch)
+- [`pyfetch` Docs.](https://pyodide.org/en/stable/usage/api/python-api/http.html#pyodide.http.pyfetch)
## pyodide.http.FetchResponse
### Usage
@@ -207,4 +210,4 @@ json = await response.json()
Class for handling HTTP responses. This is a wrapper around the `JavaScript` fetch `Response`. Contains common (async)
methods and properties for handling HTTP responses, such as `json()`, `url`, `status`, `headers`, etc.
-### [`FetchResponse` Docs.](https://pyodide.org/en/stable/usage/api/python-api/http.html#pyodide.http.FetchResponse)
+- [`FetchResponse` Docs.](https://pyodide.org/en/stable/usage/api/python-api/http.html#pyodide.http.FetchResponse)
diff --git a/docs/guides/passing-objects.md b/docs/guides/passing-objects.md
index 3023f55f..58df0de0 100644
--- a/docs/guides/passing-objects.md
+++ b/docs/guides/passing-objects.md
@@ -45,7 +45,7 @@ The [PyScript JavaScript module](../reference/modules/pyscript.md) exposes its