Repository: hikari-py/hikari
Pull request #1942 (2024-06-20 11:01:33)

Use UV in readthedocs build
### Summary
Use UV in readthedocs build

### Checklist
<!-- Make sure to tick all the following boxes by putting an `x` in between (like this `[x]`) -->
~~- [ ] I have run `nox` and all the pipelines have passed.~~
~~- [ ] I have made unittests according to the code I have added/modified/deleted.~~

### Related issues
None



Patch:
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index 645f48da..044e6b63 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -3,14 +3,12 @@ version: 2
 build:
   os: ubuntu-22.04
   tools:
-    # NOTE: This should be kept up to date with .ci.yml
+    # NOTE: This should be kept up to date with ci.yml
     python: "3.11"
-
-mkdocs:
-  configuration: mkdocs.yml
-
-python:
-   install:
-     - requirements: dev-requirements/mkdocs.txt
-     - method: pip
-       path: .
+  commands:
+    - asdf plugin add uv
+    - asdf install uv latest
+    - asdf global uv latest
+    - uv venv
+    - uv pip install -r dev-requirements.txt
+    - .venv/bin/nox -s mkdocs
diff --git a/changes/1943.feature.md b/changes/1943.feature.md
new file mode 100644
index 00000000..1629071d
--- /dev/null
+++ b/changes/1943.feature.md
@@ -0,0 +1,1 @@
+Add payload to deserialization error to make it easier to diagnose
diff --git a/hikari/impl/event_manager_base.py b/hikari/impl/event_manager_base.py
index 240462ec..a35570fb 100644
--- a/hikari/impl/event_manager_base.py
+++ b/hikari/impl/event_manager_base.py
@@ -614,6 +614,7 @@ async def _handle_dispatch(
             asyncio.get_running_loop().call_exception_handler(
                 {
                     "message": "Exception occurred in raw event dispatch conduit",
+                    "payload": payload,
                     "exception": ex,
                     "task": asyncio.current_task(),
                 }
diff --git a/hikari/impl/interaction_server.py b/hikari/impl/interaction_server.py
index 63fbada5..ae0972a7 100644
--- a/hikari/impl/interaction_server.py
+++ b/hikari/impl/interaction_server.py
@@ -453,7 +453,11 @@ async def on_interaction(self, body: bytes, signature: bytes, timestamp: bytes)
 
         except Exception as exc:
             asyncio.get_running_loop().call_exception_handler(
-                {"message": "Exception occurred during interaction deserialization", "exception": exc}
+                {
+                    "message": "Exception occurred during interaction deserialization",
+                    "payload": payload,
+                    "exception": exc,
+                }
             )
             return _Response(_INTERNAL_SERVER_ERROR_STATUS, b"Exception occurred during interaction deserialization")
 
diff --git a/pipelines/config.py b/pipelines/config.py
index 283dfa7c..5b4c2c6d 100644
--- a/pipelines/config.py
+++ b/pipelines/config.py
@@ -35,7 +35,12 @@
 FLAKE8_REPORT = _os.path.join(ARTIFACT_DIRECTORY, "flake8")
 PYPROJECT_TOML = "pyproject.toml"
 COVERAGE_HTML_PATH = _os.path.join(ARTIFACT_DIRECTORY, "coverage", "html")
-DOCUMENTATION_OUTPUT_PATH = _os.path.join(ARTIFACT_DIRECTORY, "docs")
+
+if "READTHEDOCS_OUTPUT" in _os.environ:
+    DOCUMENTATION_OUTPUT_PATH = _os.environ["READTHEDOCS_OUTPUT"] + "/html"
+else:
+    DOCUMENTATION_OUTPUT_PATH = _os.path.join(ARTIFACT_DIRECTORY, "docs")
+
 
 # Reformatting paths
 REFORMATTING_FILE_EXTS = (


Test patch:
diff --git a/tests/hikari/impl/test_event_manager_base.py b/tests/hikari/impl/test_event_manager_base.py
index def3a8fb..c4884c67 100644
--- a/tests/hikari/impl/test_event_manager_base.py
+++ b/tests/hikari/impl/test_event_manager_base.py
@@ -592,7 +592,12 @@ async def test_handle_dispatch_handles_exceptions(self, event_manager):
 
         error_handler.assert_called_once_with(
             event_loop,
-            {"exception": exc, "message": "Exception occurred in raw event dispatch conduit", "task": mock_task},
+            {
+                "exception": exc,
+                "message": "Exception occurred in raw event dispatch conduit",
+                "payload": pl,
+                "task": mock_task,
+            },
         )
 
     @pytest.mark.asyncio
diff --git a/tests/hikari/impl/test_interaction_server.py b/tests/hikari/impl/test_interaction_server.py
index eab5ff2c..97fdc32e 100644
--- a/tests/hikari/impl/test_interaction_server.py
+++ b/tests/hikari/impl/test_interaction_server.py
@@ -848,7 +848,11 @@ async def test_on_interaction_on_failed_deserialize(
             result = await mock_interaction_server.on_interaction(b'{"type": 2}', b"signature", b"timestamp")
 
             get_running_loop.return_value.call_exception_handler.assert_called_once_with(
-                {"message": "Exception occurred during interaction deserialization", "exception": mock_exception}
+                {
+                    "message": "Exception occurred during interaction deserialization",
+                    "payload": {"type": 2},
+                    "exception": mock_exception,
+                }
             )
 
         assert result.content_type == "text/plain"