diff options
author | 2023-08-09 18:11:08 +0100 | |
---|---|---|
committer | 2023-08-09 18:11:08 +0100 | |
commit | a74b755c9bce4ac37394be6e0dcf947cbbbf81fb (patch) | |
tree | a33832d245171c82fd8747f555aea4f6d29821c9 /pydis_site | |
parent | Move commit model into its own file (diff) | |
parent | Merge pull request #1068 from python-discord/dependabot/pip/ruff-0.0.283 (diff) |
Merge branch 'main' into move-commit-model-to-proper-module
Diffstat (limited to 'pydis_site')
8 files changed, 31 insertions, 13 deletions
diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot-extended-configuration-options.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot-extended-configuration-options.md index a35d79a9..f5425d88 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot-extended-configuration-options.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot-extended-configuration-options.md @@ -73,7 +73,7 @@ If you wish to set all values in your `env.server` for your testing server, you **Note**: This is only required when you're not configuring the bot [automatically](#automatic-configuration) -If you will be working on a feature that includes the python help forum, you will need to use `Forum Channels`. +If you will be working on a feature that includes the Python help forum, you will need to use `Forum Channels`. Forum channels cannot be included in a template, which is why this needs to be done by hand for the time being. diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot.md index b5e11a97..f54ee664 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot.md @@ -132,7 +132,7 @@ With all of the above setup, you can run The projec with `docker compose up`. Th Some other useful docker commands are as follows: -1. `docker compose pull` this pulls updates for all non-bot services, such as psotgres, redis and our [site](../site) project! +1. `docker compose pull` this pulls updates for all non-bot services, such as postgres, redis and our [site](../site) project! 1. `docker compose build` this rebuilds the bot's docker image, this is only needed if you need to make changes to the bot's dependencies, or the Dockerfile itself. Your bot is now running, all inside Docker. diff --git a/pydis_site/apps/content/resources/guides/python-guides/docker-hosting-guide.md b/pydis_site/apps/content/resources/guides/python-guides/docker-hosting-guide.md index 57d86e99..7af6a0bb 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/docker-hosting-guide.md +++ b/pydis_site/apps/content/resources/guides/python-guides/docker-hosting-guide.md @@ -26,7 +26,7 @@ description: This guide shows how to host a bot with Docker and GitHub Actions o ## Introduction -Let's say you have got a nice discord bot written in python and you have a VPS to host it on. Now the only question is +Let's say you have got a nice discord bot written in Python and you have a VPS to host it on. Now the only question is how to run it 24/7. You might have been suggested to use *screen multiplexer*, but it has some disadvantages: 1. Every time you update the bot you have to SSH to your server, attach to screen, shutdown the bot, run `git pull` and diff --git a/pydis_site/apps/content/utils.py b/pydis_site/apps/content/utils.py index 56f6283d..cfd73d67 100644 --- a/pydis_site/apps/content/utils.py +++ b/pydis_site/apps/content/utils.py @@ -1,8 +1,10 @@ import datetime import functools import json +import logging import tarfile import tempfile +from http import HTTPStatus from io import BytesIO from pathlib import Path @@ -18,6 +20,7 @@ from pydis_site import settings from .models import Commit, Tag TAG_CACHE_TTL = datetime.timedelta(hours=1) +log = logging.getLogger(__name__) def github_client(**kwargs) -> httpx.Client: @@ -144,9 +147,26 @@ def set_tag_commit(tag: Tag) -> None: # Fetch and set the commit with github_client() as client: - data = client.get("/repos/python-discord/bot/commits", params={"path": path}) - data.raise_for_status() - data = data.json()[0] + response = client.get("/repos/python-discord/bot/commits", params={"path": path}) + if ( + # We want to hop out early in three cases: + # - We got a forbidden response. (GitHub wrongfully uses this for rate limits.) + # - We got ratelimited. + response.status_code in (HTTPStatus.FORBIDDEN, HTTPStatus.TOO_MANY_REQUESTS) + # - GitHub has unicorn time again and is returning 5xx codes. + or int(response.status_code / 100) == 5 + ): # pragma: no cover + log.warning( + "Received code %d from GitHub for commit history for bot file %r", + response.status_code, path, + ) + # We hop out early because otherwise, these failures may result in the + # overall request to the tag page breaking. + return + + # This should only be permanent issues from here, such as bad requests. + response.raise_for_status() + data = response.json()[0] commit = data["commit"] author, committer = commit["author"], commit["committer"] diff --git a/pydis_site/apps/content/views/page_category.py b/pydis_site/apps/content/views/page_category.py index 062c2bc1..1d9a9c39 100644 --- a/pydis_site/apps/content/views/page_category.py +++ b/pydis_site/apps/content/views/page_category.py @@ -56,9 +56,7 @@ class PageOrCategoryView(TemplateView): entry_info["name"] = frontmatter.load(entry).metadata["title"] elif entry.is_dir(): entry_info["name"] = utils.get_category(entry)["title"] - else: # pragma: no cover - # TODO: Remove coverage.py pragma in Python 3.10 - # See: https://github.com/nedbat/coveragepy/issues/198 + else: continue context["subarticles"].append(entry_info) diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 628a2c22..74e0ad4a 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -26,7 +26,7 @@ <h4 class="mt-5 mb-2"><i class="fa fa-trophy"></i> Perceptive Porcupines: WTPython!?</h4> <p class="my-1"><em>VV, Poppinawhile, ethansocal, Jeff Z, Cohan, ¯\_(ツ)_/¯</em></p> <p class="my-1"> - What the Python (wtpython) is a simple terminal user interface that allows you to explore relevant answers on Stackoverflow without leaving your terminal or IDE. When you get an error, all you have to do is swap python for wtpython. When your code hits an error, you'll see a textual interface for exploring relevant answers allowing you to stay focused and ship faster! + What the Python (wtpython) is a simple terminal user interface that allows you to explore relevant answers on Stackoverflow without leaving your terminal or IDE. When you get an error, all you have to do is swap Python for wtpython. When your code hits an error, you'll see a textual interface for exploring relevant answers allowing you to stay focused and ship faster! </p> <p> <a href="https://www.youtube.com/watch?v=DV3uMdsw9KE" title="Perceptive Porcupines Demo Video" target="_blank" rel="noopener"><i class="fa fa-video"> </i> Demo video</a> @@ -89,7 +89,7 @@ <h3 id="qualifier"><a href="#qualifier">The Qualifier</a></h3> <p> The qualifier is a coding challenge that you are required to complete before registering for the code jam. - This is meant as a basic assessment of your skills to ensure you have enough python knowledge to effectively contribute in a team environment. + This is meant as a basic assessment of your skills to ensure you have enough Python knowledge to effectively contribute in a team environment. </p> <p class="has-text-centered"><a class="button is-link" href="https://github.com/python-discord/cj8-qualifier" target="_blank" rel="noopener">View the Qualifier</a></p> <p> diff --git a/pydis_site/templates/events/pages/code-jams/8/frameworks.html b/pydis_site/templates/events/pages/code-jams/8/frameworks.html index 1c02e38a..d8fbe96f 100644 --- a/pydis_site/templates/events/pages/code-jams/8/frameworks.html +++ b/pydis_site/templates/events/pages/code-jams/8/frameworks.html @@ -103,7 +103,7 @@ <ul> <li><a href="https://python-prompt-toolkit.readthedocs.io/en/stable/" target="_blank">Documentation Link</a></li> <li><strong>Supports:</strong> Linux, Mac, and Windows</li> - <li>Pure python library</li> + <li>Pure Python library</li> </ul> </div> <div class="column"> diff --git a/pydis_site/templates/events/pages/code-jams/9/_index.html b/pydis_site/templates/events/pages/code-jams/9/_index.html index 3e60c387..5c094b22 100644 --- a/pydis_site/templates/events/pages/code-jams/9/_index.html +++ b/pydis_site/templates/events/pages/code-jams/9/_index.html @@ -75,7 +75,7 @@ <h3 id="qualifier"><a href="#how-to-join">The Qualifier</a></h3> <p> The qualifier is a coding challenge that you are required to complete before registering for the code jam. - This is meant as a basic assessment of your skills to ensure you have enough python knowledge to effectively contribute in a team environment. + This is meant as a basic assessment of your skills to ensure you have enough Python knowledge to effectively contribute in a team environment. </p> <p class="has-text-centered"><a class="button is-link" href="https://github.com/python-discord/code-jam-qualifier-9/" target="_blank" rel="noopener">View the Qualifier</a></p> <p> |