Skip to content

Commit b076394

Browse files
Merge branch 'main' into bast0006-new-infraction-filters
2 parents 7a5a032 + 03c787b commit b076394

File tree

7 files changed

+42
-34
lines changed

7 files changed

+42
-34
lines changed

docs/setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ Make sure you add the following to your hosts file:
8282
```
8383
When trying to access the site, you'll be using the domains above instead of the usual `localhost:8000`.
8484

85-
Finally, you will need to set the environment variable `DEBUG=1`. When using `pipenv`, you can
86-
set put this into an `.env` file to have it exported automatically. It's also recommended to
85+
Finally, you will need to set the environment variable `DEBUG=1`. If you have `python-dotenv` installed, you can put this into a
86+
`.env` file to have it exported automatically. It's also recommended to
8787
export `LOG_LEVEL=INFO` when using `DEBUG=1` if you don't want super verbose logs.
8888

8989
To run the server, run `python manage.py runserver`. If it gives you an error saying

pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,29 @@ icon: fab fa-github
66

77
> **Note:** The process varies depending on your choice of code editor / IDE, so refer to one of the following guides:
88
9-
- [Cloning with PyCharm](#cloning-with-pycharm)
109
- [Cloning with the command line](#cloning-with-the-command-line)
10+
- [Cloning with PyCharm](#cloning-with-pycharm)
1111

1212
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).
1313

1414
---
1515

16-
## Cloning with PyCharm
17-
1. Load up PyCharm and click `Get from VCS`.<br>
18-
![Create Project in PyCharm](/static/images/content/contributing/pycharm_create_project.png)
19-
2. Enter the URL of your forked repository.
20-
3. Change the directory if you desire and click `Clone`.<br>
21-
![Clone Git Project in Pycharm](/static/images/content/contributing/pycharm_checkout.png)
22-
23-
---
24-
2516
## Cloning with the command line
17+
2618
1. Clone your forked repository using `git clone` followed by your fork's Git URL. Then, change your working directory to the repository.
19+
2720
```shell
2821
$ git clone https://github.com/<your username>/sir-lancebot
2922
...
3023
$ cd sir-lancebot
3124
```
25+
26+
---
27+
28+
## Cloning with PyCharm
29+
30+
1. Load up PyCharm and click `Get from VCS`.<br>
31+
![Create Project in PyCharm](/static/images/content/contributing/pycharm_create_project.png)
32+
2. Enter the URL of your forked repository.
33+
3. Change the directory if you desire and click `Clone`.<br>
34+
![Clone Git Project in Pycharm](/static/images/content/contributing/pycharm_checkout.png)

pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ If the linter complains, the commit is aborted so that you can fix the linting e
4040
That way, you never commit the problematic code in the first place!
4141

4242
Please refer to the project-specific documentation to see how to setup and run those tools.
43-
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`.
43+
In most cases, you can install pre-commit using `poetry run task precommit`, and lint using `poetry run task lint`.
4444

4545
## Type Hinting
4646

pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,36 @@ icon: fab fa-python
66

77
> **Note:** The process varies depending on your choice of code editor / IDE, so refer to one of the following guides:
88
9-
- [Installing dependencies with PyCharm](#installing-dependencies-with-pycharm)
109
- [Installing dependencies with the command line](#installing-dependencies-with-the-command-line)
10+
- [Installing dependencies with PyCharm](#installing-dependencies-with-pycharm)
1111

1212
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.
1313
You should have already cloned your fork as described in [**Cloning a Repository**](../cloning-repository).
1414

1515
---
1616

17-
## Installing dependencies with PyCharm
18-
1. Load up your project in PyCharm.
19-
2. Go to the Project Settings by clicking `File`, then `Settings...`. Alternatively, use the shortcut key: `Ctrl+Alt+S` (`command+comma` on Mac OS).
20-
3. Install the [poetry plugin](https://plugins.jetbrains.com/plugin/14307-poetry).
21-
4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`.<br/>
22-
![PyCharm Interpreter Settings](/static/images/content/contributing/pycharm_interpreter.png)<br/>
23-
5. Click `Poetry Environment`, then click `OK`.<br/>
24-
![PyCharm Pipenv Environment](/static/images/content/contributing/pycharm_poetry.png)<br/>
25-
6. PyCharm will automatically install the packages required into a virtual environment.<br/>
26-
![PyCharm Project Interpreter](/static/images/content/contributing/pycharm_poetry_success.png)
27-
28-
---
29-
3017
## Installing dependencies with the command line
18+
3119
1. Make sure you are in the root project directory. This directory will always have a file titled `README.md`.
3220
2. Install project and development dependencies. Remember to also set up pre-commit hooks to ensure your pushed commits will never fail linting.
33-
---
3421

22+
---
3523

3624
```shell
3725
$ poetry install
3826
$ poetry run task precommit
3927
```
28+
29+
---
30+
31+
## Installing dependencies with PyCharm
32+
33+
1. Load up your project in PyCharm.
34+
2. Go to the Project Settings by clicking `File`, then `Settings...`. Alternatively, use the shortcut key: `Ctrl+Alt+S` (`command+comma` on Mac OS).
35+
3. Install the [poetry plugin](https://plugins.jetbrains.com/plugin/14307-poetry).
36+
4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`.<br/>
37+
![PyCharm Interpreter Settings](/static/images/content/contributing/pycharm_interpreter.png)<br/>
38+
5. Click `Poetry Environment`, then click `OK`.<br/>
39+
![PyCharm Poetry Environment](/static/images/content/contributing/pycharm_poetry.png)<br/>
40+
6. PyCharm will automatically install the packages required into a virtual environment.<br/>
41+
![PyCharm Project Interpreter](/static/images/content/contributing/pycharm_poetry_success.png)

pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ toc: 1
77

88
# Requirements
99

10-
- [Python 3.8](https://www.python.org/downloads/)
11-
- [Pipenv](https://github.com/pypa/pipenv#installation)
12-
- `pip install pipenv`
10+
- [Python 3.9](https://www.python.org/downloads/)
11+
- [Poetry](https://python-poetry.org/docs/#installation)
12+
- `pip install poetry`
1313
- [Git](https://git-scm.com/downloads)
1414
- [Windows](https://git-scm.com/download/win)
1515
- [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
122122

123123
### Webserver
124124

125-
Starting the webserver is done simply through pipenv:
125+
Starting the webserver is done simply through poetry:
126126

127127
```shell
128-
pipenv run start
128+
poetry run task start
129129
```
130130

131131
---

pydis_site/apps/home/views/home.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from django.views import View
1010

1111
from pydis_site.apps.home.models import RepositoryMetadata
12+
from pydis_site.constants import GITHUB_TOKEN
1213

1314
log = logging.getLogger(__name__)
1415

@@ -18,6 +19,7 @@ class HomeView(View):
1819

1920
github_api = "https://api.github.com/users/python-discord/repos?per_page=100"
2021
repository_cache_ttl = 3600
22+
headers = {"Authorization": f"token {GITHUB_TOKEN}"}
2123

2224
# Which of our GitHub repos should be displayed on the front page, and in which order?
2325
repos = [
@@ -42,7 +44,7 @@ def _get_api_data(self) -> Dict[str, Dict[str, str]]:
4244
repo_dict = {}
4345

4446
# Fetch the data from the GitHub API
45-
api_data: List[dict] = requests.get(self.github_api).json()
47+
api_data: List[dict] = requests.get(self.github_api, headers=self.headers).json()
4648

4749
# Process the API data into our dict
4850
for repo in api_data:

pydis_site/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import os
22

33
GIT_SHA = os.environ.get("GIT_SHA", "development")
4+
GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN")

0 commit comments

Comments
 (0)