From ad1a90b48f88a323c28c742034b70436d1e70a81 Mon Sep 17 00:00:00 2001 From: ToxicKidz Date: Sat, 22 May 2021 18:23:14 -0400 Subject: chore: Update guides to use poetry instead of pipenv --- docs/setup.md | 4 ++-- .../contributing-guidelines/supplemental-information.md | 2 +- .../contributing/installing-project-dependencies.md | 2 +- .../content/resources/guides/pydis-guides/contributing/site.md | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/setup.md b/docs/setup.md index d992067e..d88021cc 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -82,8 +82,8 @@ Make sure you add the following to your hosts file: ``` When trying to access the site, you'll be using the domains above instead of the usual `localhost:8000`. -Finally, you will need to set the environment variable `DEBUG=1`. When using `pipenv`, you can -set put this into an `.env` file to have it exported automatically. It's also recommended to +Finally, you will need to set the environment variable `DEBUG=1`. If you have `python-dotenv` installed, you can put this into a + `.env` file to have it exported automatically. It's also recommended to export `LOG_LEVEL=INFO` when using `DEBUG=1` if you don't want super verbose logs. To run the server, run `python manage.py runserver`. If it gives you an error saying diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md index 24dc9aa9..70d47563 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md @@ -40,7 +40,7 @@ If the linter complains, the commit is aborted so that you can fix the linting e That way, you never commit the problematic code in the first place! Please refer to the project-specific documentation to see how to setup and run those tools. -In most cases, you can install pre-commit using `pipenv run precommit` or `poetry run task precommit`, and lint using `pipenv run lint` or `poetry run task lint`. +In most cases, you can install pre-commit using `poetry run task precommit`, and lint using `poetry run task lint`. ## Type Hinting diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md index 653b71aa..bd7efe67 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md @@ -21,7 +21,7 @@ You should have already cloned your fork as described in [**Cloning a Repository 4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`.
![PyCharm Interpreter Settings](/static/images/content/contributing/pycharm_interpreter.png)
5. Click `Poetry Environment`, then click `OK`.
-![PyCharm Pipenv Environment](/static/images/content/contributing/pycharm_poetry.png)
+![PyCharm Poetry Environment](/static/images/content/contributing/pycharm_poetry.png)
6. PyCharm will automatically install the packages required into a virtual environment.
![PyCharm Project Interpreter](/static/images/content/contributing/pycharm_poetry_success.png) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index 75d27d99..899fd236 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -7,9 +7,9 @@ toc: 1 # Requirements -- [Python 3.8](https://www.python.org/downloads/) -- [Pipenv](https://github.com/pypa/pipenv#installation) - - `pip install pipenv` +- [Python 3.9](https://www.python.org/downloads/) +- [Poetry](https://python-poetry.org/docs/#installation) + - `pip install poetry` - [Git](https://git-scm.com/downloads) - [Windows](https://git-scm.com/download/win) - [MacOS](https://git-scm.com/download/mac) or `brew install git` @@ -122,10 +122,10 @@ If you're not using Docker, then use [pg_ctl](https://www.postgresql.org/docs/cu ### Webserver -Starting the webserver is done simply through pipenv: +Starting the webserver is done simply through poetry: ```shell -pipenv run start +poetry run task start ``` --- -- cgit v1.2.3 From a3c96d2e92af9004450b746ec27137a2e7aa256e Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 23 May 2021 16:17:10 +0100 Subject: Authenticate with the github api to avoid rate limits --- pydis_site/apps/home/views/home.py | 4 +++- pydis_site/constants.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pydis_site/apps/home/views/home.py b/pydis_site/apps/home/views/home.py index e77772fb..b3767d37 100644 --- a/pydis_site/apps/home/views/home.py +++ b/pydis_site/apps/home/views/home.py @@ -9,6 +9,7 @@ from django.utils import timezone from django.views import View from pydis_site.apps.home.models import RepositoryMetadata +from pydis_site.constants import GITHUB_TOKEN log = logging.getLogger(__name__) @@ -18,6 +19,7 @@ class HomeView(View): github_api = "https://api.github.com/users/python-discord/repos?per_page=100" repository_cache_ttl = 3600 + headers = {"Authorization": f"token {GITHUB_TOKEN}"} # Which of our GitHub repos should be displayed on the front page, and in which order? repos = [ @@ -42,7 +44,7 @@ class HomeView(View): repo_dict = {} # Fetch the data from the GitHub API - api_data: List[dict] = requests.get(self.github_api).json() + api_data: List[dict] = requests.get(self.github_api, headers=self.headers).json() # Process the API data into our dict for repo in api_data: diff --git a/pydis_site/constants.py b/pydis_site/constants.py index c7ab5db0..e6a63d12 100644 --- a/pydis_site/constants.py +++ b/pydis_site/constants.py @@ -1,3 +1,4 @@ import os GIT_SHA = os.environ.get("GIT_SHA", "development") +GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN") -- cgit v1.2.3 From 4158e52375c0c47fd29cfc18be3b19e8e6939541 Mon Sep 17 00:00:00 2001 From: Soham Banerjee Date: Mon, 31 May 2021 16:13:50 +0530 Subject: command line instructions moved up --- .../contributing/cloning-repository.md | 21 ++++++++------- .../installing-project-dependencies.md | 30 ++++++++++++---------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md index fad54374..1acb5400 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md @@ -13,19 +13,22 @@ The following will use the [Sir-Lancebot](https://github.com/python-discord/sir- --- -## Cloning with PyCharm -1. Load up PyCharm and click `Get from VCS`.
-![Create Project in PyCharm](/static/images/content/contributing/pycharm_create_project.png) -2. Enter the URL of your forked repository. -3. Change the directory if you desire and click `Clone`.
-![Clone Git Project in Pycharm](/static/images/content/contributing/pycharm_checkout.png) - ---- - ## Cloning with the command line + 1. Clone your forked repository using `git clone` followed by your fork's Git URL. Then, change your working directory to the repository. + ```shell $ git clone https://github.com//sir-lancebot ... $ cd sir-lancebot ``` + +--- + +## Cloning with PyCharm + +1. Load up PyCharm and click `Get from VCS`.
+ ![Create Project in PyCharm](/static/images/content/contributing/pycharm_create_project.png) +2. Enter the URL of your forked repository. +3. Change the directory if you desire and click `Clone`.
+ ![Clone Git Project in Pycharm](/static/images/content/contributing/pycharm_checkout.png) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md index bd7efe67..ea991d15 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md @@ -14,26 +14,28 @@ You should have already cloned your fork as described in [**Cloning a Repository --- -## Installing dependencies with PyCharm -1. Load up your project in PyCharm. -2. Go to the Project Settings by clicking `File`, then `Settings...`. Alternatively, use the shortcut key: `Ctrl+Alt+S` (`command+comma` on Mac OS). -3. Install the [poetry plugin](https://plugins.jetbrains.com/plugin/14307-poetry). -4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`.
-![PyCharm Interpreter Settings](/static/images/content/contributing/pycharm_interpreter.png)
-5. Click `Poetry Environment`, then click `OK`.
-![PyCharm Poetry Environment](/static/images/content/contributing/pycharm_poetry.png)
-6. PyCharm will automatically install the packages required into a virtual environment.
-![PyCharm Project Interpreter](/static/images/content/contributing/pycharm_poetry_success.png) - ---- - ## Installing dependencies with the command line + 1. Make sure you are in the root project directory. This directory will always have a file titled `README.md`. 2. Install project and development dependencies. Remember to also set up pre-commit hooks to ensure your pushed commits will never fail linting. ---- +--- ```shell $ poetry install $ poetry run task precommit ``` + +--- + +## Installing dependencies with PyCharm + +1. Load up your project in PyCharm. +2. Go to the Project Settings by clicking `File`, then `Settings...`. Alternatively, use the shortcut key: `Ctrl+Alt+S` (`command+comma` on Mac OS). +3. Install the [poetry plugin](https://plugins.jetbrains.com/plugin/14307-poetry). +4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`.
+ ![PyCharm Interpreter Settings](/static/images/content/contributing/pycharm_interpreter.png)
+5. Click `Poetry Environment`, then click `OK`.
+ ![PyCharm Poetry Environment](/static/images/content/contributing/pycharm_poetry.png)
+6. PyCharm will automatically install the packages required into a virtual environment.
+ ![PyCharm Project Interpreter](/static/images/content/contributing/pycharm_poetry_success.png) -- cgit v1.2.3 From d70d90c1f34f7dd2dbfdd63c2edac1ac05a5a5af Mon Sep 17 00:00:00 2001 From: Soham Banerjee Date: Mon, 31 May 2021 16:57:50 +0530 Subject: table of contents updated --- .../resources/guides/pydis-guides/contributing/cloning-repository.md | 2 +- .../guides/pydis-guides/contributing/installing-project-dependencies.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md index 1acb5400..23d525b8 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md @@ -6,8 +6,8 @@ icon: fab fa-github > **Note:** The process varies depending on your choice of code editor / IDE, so refer to one of the following guides: -- [Cloning with PyCharm](#cloning-with-pycharm) - [Cloning with the command line](#cloning-with-the-command-line) +- [Cloning with PyCharm](#cloning-with-pycharm) The following will use the [Sir-Lancebot](https://github.com/python-discord/sir-lancebot/) repository as an example, but the steps are the same for all other repositories. You should have already retrieved your fork's Git URL as described in [**Creating a Fork**](../forking-repository). diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md index ea991d15..26d6de30 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md @@ -6,8 +6,8 @@ icon: fab fa-python > **Note:** The process varies depending on your choice of code editor / IDE, so refer to one of the following guides: -- [Installing dependencies with PyCharm](#installing-dependencies-with-pycharm) - [Installing dependencies with the command line](#installing-dependencies-with-the-command-line) +- [Installing dependencies with PyCharm](#installing-dependencies-with-pycharm) The following will use the [Sir-Lancebot](https://github.com/python-discord/sir-lancebot/) repository as an example, but the steps are the same for all other repositories. You should have already cloned your fork as described in [**Cloning a Repository**](../cloning-repository). -- cgit v1.2.3