Skip to content

Commit e1a4697

Browse files
authored
Merge branch 'main' into patch-1
2 parents 9a97687 + e89f46d commit e1a4697

File tree

198 files changed

+5886
-2395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+5886
-2395
lines changed

.github/ISSUE_TEMPLATE/feature_request.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ This is the repository and issue tracker for https://www.python.org
88
website.
99
1010
If you're looking to file an issue with CPython itself, please go to
11-
https://bugs.python.org
11+
https://github.com/python/cpython/issues/new/choose
1212
1313
Issues related to Python's documentation (https://docs.python.org) can
14-
also be filed in https://bugs.python.org, by selecting the
15-
"Documentation" component.
14+
also be filed at https://github.com/python/cpython/issues/new?assignees=&labels=docs&template=documentation.md.
1615
-->
1716

1817
**Is your feature request related to a problem? Please describe.**

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ updates:
1919
- dependency-name: lxml
2020
versions:
2121
- 4.6.2
22+
- package-ecosystem: github-actions
23+
directory: "/"
24+
groups:
25+
github-actions:
26+
patterns:
27+
- "*" # Group all Actions updates into a single larger pull request
28+
schedule:
29+
interval: daily

.github/workflows/ci.yml

+22-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
runs-on: ubuntu-latest
66
services:
77
postgres:
8-
image: postgres:10.1
8+
image: postgres:15.3
99
env:
1010
POSTGRES_USER: postgres
1111
POSTGRES_PASSWORD: postgres
@@ -16,12 +16,24 @@ jobs:
1616
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
1717
steps:
1818
- name: Check out repository
19-
uses: actions/checkout@v2
20-
- uses: actions/setup-python@v2
19+
uses: actions/checkout@v4
20+
- name: Install platform dependencies
21+
run: |
22+
sudo apt -y update
23+
sudo apt -y install --no-install-recommends \
24+
texlive-latex-base \
25+
texlive-latex-recommended \
26+
texlive-plain-generic \
27+
lmodern
28+
- name: Install pandoc
29+
run: |
30+
wget https://github.com/jgm/pandoc/releases/download/2.17.1.1/pandoc-2.17.1.1-1-amd64.deb
31+
sudo dpkg -i pandoc-2.17.1.1-1-amd64.deb
32+
- uses: actions/setup-python@v5
2133
with:
22-
python-version: 3.9.6
34+
python-version: 3.9.16
2335
- name: Cache Python dependencies
24-
uses: actions/cache@v2
36+
uses: actions/cache@v4
2537
env:
2638
cache-name: pythondotorg-cache-pip
2739
with:
@@ -35,6 +47,11 @@ jobs:
3547
run: |
3648
pip install -U pip setuptools wheel
3749
pip install -r dev-requirements.txt
50+
- name: Check for ungenerated database migrations
51+
run: |
52+
python manage.py makemigrations --check --dry-run
53+
env:
54+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/pythonorg
3855
- name: Run Tests
3956
run: |
4057
python -Wd -m coverage run manage.py test -v2

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# $ git config --global core.excludesfile ~/.gitignore_global
1111

1212
.sass-cache/
13+
docs/build
1314
media/*
1415
static-root/
1516
static/stylesheets/mq.css
@@ -25,3 +26,4 @@ __pycache__
2526
.env
2627
.DS_Store
2728
.envrc
29+
.state/

.python-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.9.6
1+
3.9.16

.readthedocs.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
# Project page: https://readthedocs.org/projects/pythondotorg/
4+
5+
version: 2
6+
7+
build:
8+
os: ubuntu-22.04
9+
tools:
10+
python: "3"
11+
12+
commands:
13+
- python -m pip install -r docs-requirements.txt
14+
- make -C docs html JOBS=$(nproc) BUILDDIR=_readthedocs
15+
- mv docs/_readthedocs _readthedocs

Aptfile

Whitespace-only changes.

Dockerfile

+41-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,48 @@
1-
FROM python:3.9-bullseye
1+
FROM python:3.9-bookworm
22
ENV PYTHONUNBUFFERED=1
33
ENV PYTHONDONTWRITEBYTECODE=1
4+
5+
# By default, Docker has special steps to avoid keeping APT caches in the layers, which
6+
# is good, but in our case, we're going to mount a special cache volume (kept between
7+
# builds), so we WANT the cache to persist.
8+
RUN set -eux; \
9+
rm -f /etc/apt/apt.conf.d/docker-clean; \
10+
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache;
11+
12+
# Install System level build requirements, this is done before
13+
# everything else because these are rarely ever going to change.
14+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
15+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
16+
set -x \
17+
&& apt-get update \
18+
&& apt-get install --no-install-recommends -y \
19+
texlive-latex-base \
20+
texlive-latex-recommended \
21+
texlive-fonts-recommended \
22+
texlive-plain-generic \
23+
lmodern
24+
25+
RUN case $(uname -m) in \
26+
"x86_64") ARCH=amd64 ;; \
27+
"aarch64") ARCH=arm64 ;; \
28+
esac \
29+
&& wget --quiet https://github.com/jgm/pandoc/releases/download/2.17.1.1/pandoc-2.17.1.1-1-${ARCH}.deb \
30+
&& dpkg -i pandoc-2.17.1.1-1-${ARCH}.deb
31+
432
RUN mkdir /code
533
WORKDIR /code
34+
635
COPY dev-requirements.txt /code/
736
COPY base-requirements.txt /code/
8-
RUN pip install -r dev-requirements.txt
37+
COPY prod-requirements.txt /code/
38+
COPY requirements.txt /code/
39+
40+
RUN pip --no-cache-dir --disable-pip-version-check install --upgrade pip setuptools wheel
41+
42+
RUN --mount=type=cache,target=/root/.cache/pip \
43+
set -x \
44+
&& pip --disable-pip-version-check \
45+
install \
46+
-r dev-requirements.txt
47+
948
COPY . /code/

Dockerfile.cabotage

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM python:3.9-bullseye
2+
COPY --from=ewdurbin/nginx-static:1.25.x /usr/bin/nginx /usr/bin/nginx
3+
ENV PYTHONUNBUFFERED=1
4+
ENV PYTHONDONTWRITEBYTECODE=1
5+
6+
# By default, Docker has special steps to avoid keeping APT caches in the layers, which
7+
# is good, but in our case, we're going to mount a special cache volume (kept between
8+
# builds), so we WANT the cache to persist.
9+
RUN set -eux; \
10+
rm -f /etc/apt/apt.conf.d/docker-clean; \
11+
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache;
12+
13+
# Install System level build requirements, this is done before
14+
# everything else because these are rarely ever going to change.
15+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
16+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
17+
set -x \
18+
&& apt-get update \
19+
&& apt-get install --no-install-recommends -y \
20+
texlive-latex-base \
21+
texlive-latex-recommended \
22+
texlive-fonts-recommended \
23+
texlive-plain-generic \
24+
lmodern
25+
26+
RUN case $(uname -m) in \
27+
"x86_64") ARCH=amd64 ;; \
28+
"aarch64") ARCH=arm64 ;; \
29+
esac \
30+
&& wget --quiet https://github.com/jgm/pandoc/releases/download/2.17.1.1/pandoc-2.17.1.1-1-${ARCH}.deb \
31+
&& dpkg -i pandoc-2.17.1.1-1-${ARCH}.deb
32+
33+
RUN mkdir /code
34+
WORKDIR /code
35+
36+
COPY dev-requirements.txt /code/
37+
COPY base-requirements.txt /code/
38+
COPY prod-requirements.txt /code/
39+
COPY requirements.txt /code/
40+
41+
RUN pip --no-cache-dir --disable-pip-version-check install --upgrade pip setuptools wheel
42+
43+
RUN --mount=type=cache,target=/root/.cache/pip \
44+
set -x \
45+
&& pip --disable-pip-version-check \
46+
install \
47+
-r requirements.txt -r prod-requirements.txt
48+
COPY . /code/
49+
RUN DJANGO_SETTINGS_MODULE=pydotorg.settings.static python manage.py collectstatic --noinput

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,9 @@ shell: .state/db-initialized
5050
clean:
5151
docker-compose down -v
5252
rm -f .state/docker-build-web .state/db-initialized .state/db-migrated
53+
54+
test: .state/db-initialized
55+
docker-compose run --rm web ./manage.py test
56+
57+
docker_shell: .state/db-initialized
58+
docker-compose run --rm web /bin/bash

Procfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
release: python manage.py migrate --noinput
22
web: bin/start-nginx gunicorn -c gunicorn.conf pydotorg.wsgi
3+
worker: celery -A pydotorg worker -l INFO
4+
worker-beat: celery -A pydotorg beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# python.org
22

3-
[![Build Status](https://travis-ci.org/python/pythondotorg.svg?branch=main)](https://travis-ci.org/python/pythondotorg)
3+
[![CI](https://github.com/python/pythondotorg/actions/workflows/ci.yml/badge.svg)](https://github.com/python/pythondotorg/actions/workflows/ci.yml)
44
[![Documentation Status](https://readthedocs.org/projects/pythondotorg/badge/?version=latest)](https://pythondotorg.readthedocs.io/?badge=latest)
55

66
### General information

banners/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
default_app_config = 'banners.apps.BannersAppConfig'

base-requirements.txt

+25-20
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,56 @@
11
dj-database-url==0.5.0
2-
django-pipeline==2.0.6
3-
django-sitetree==1.17.0
4-
Django==2.2.24
2+
django-pipeline==3.0.0 # 3.0.0 is first version that supports Django 4.2
3+
django-sitetree==1.18.0 # >=1.17.1 is (?) first version that supports Django 4.2
4+
django-apptemplates==1.5
5+
django-admin-interface==0.24.2
6+
django-translation-aliases==0.1.0
7+
Django==4.2.16
58
docutils==0.12
69
Markdown==3.3.4
710
cmarkgfm==0.6.0
8-
Pillow==8.3.1
11+
Pillow==9.4.0
912
psycopg2-binary==2.8.6
1013
python3-openid==3.2.0
1114
python-decouple==3.4
1215
# lxml used by BeautifulSoup.
13-
lxml==4.6.3
16+
lxml==5.2.2
1417
cssselect==1.1.0
1518
feedparser==6.0.8
16-
beautifulsoup4==4.9.3
19+
beautifulsoup4==4.11.2
1720
icalendar==4.0.7
1821
chardet==4.0.0
22+
celery[redis]==5.3.6
23+
django-celery-beat==2.5.0
1924
# TODO: We may drop 'django-imagekit' completely.
20-
django-imagekit==4.0.2
21-
django-haystack==3.0
22-
elasticsearch>=5,<6
25+
django-imagekit==5.0 # 5.0 is first version that supports Django 4.2
26+
django-haystack==3.2.1
27+
elasticsearch>=7,<8
2328
# TODO: 0.14.0 only supports Django 1.8 and 1.11.
24-
django-tastypie==0.14.3
29+
django-tastypie==0.14.6 # 0.14.6 is first version that supports Django 4.2
2530

2631
pytz==2021.1
2732
python-dateutil==2.8.2
2833

2934
requests[security]>=2.26.0
3035

31-
django-honeypot==1.0.1
32-
django-markupfield==2.0.0
33-
django-markupfield-helpers==0.1.1
36+
django-honeypot==1.0.4 # 1.0.4 is first version that supports Django 4.2
37+
django-markupfield==2.0.1
3438

35-
django-allauth==0.41.0
39+
django-allauth==0.57.2 # 0.55.0 is first version that supports Django 4.2
3640

3741
django-waffle==2.2.1
3842

39-
djangorestframework==3.12.2
43+
djangorestframework==3.14.0 # 3.14.0 is first version that supports Django 4.1, 4.2 support hasnt been "released"
4044
django-filter==2.4.0
4145
django-ordered-model==3.4.3
4246
django-widget-tweaks==1.4.8
4347
django-countries==7.2.1
44-
xhtml2pdf==0.2.5
45-
django-easy-pdf3==0.1.2
4648
num2words==0.5.10
47-
django-polymorphic==3.0.0
49+
django-polymorphic==3.1.0 # 3.1.0 is first version that supports Django 4.0, unsure if it fully supports 4.2
4850
sorl-thumbnail==12.7.0
49-
docxtpl==0.12.0
50-
reportlab==3.6.6
5151
django-extensions==3.1.4
52+
django-import-export==2.7.1
53+
54+
pypandoc==1.12
55+
panflute==2.3.0
56+
Unidecode==1.3.8

bin/start-nginx

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env bash
2+
3+
psmgr=/tmp/nginx-buildpack-wait
4+
rm -f $psmgr
5+
mkfifo $psmgr
6+
7+
n=1
8+
while getopts :f option ${@:1:2}
9+
do
10+
case "${option}"
11+
in
12+
f) FORCE=$OPTIND; n=$((n+1));;
13+
esac
14+
done
15+
16+
# Initialize log directory.
17+
mkdir -p /tmp/logs/nginx
18+
touch /tmp/logs/nginx/access.log /tmp/logs/nginx/error.log
19+
echo 'buildpack=nginx at=logs-initialized'
20+
21+
# Start log redirection.
22+
(
23+
# Redirect nginx logs to stdout.
24+
tail -qF -n 0 /tmp/logs/nginx/*.log
25+
echo 'logs' >$psmgr
26+
) &
27+
28+
# Start App Server
29+
(
30+
# Take the command passed to this bin and start it.
31+
# E.g. bin/start-nginx bundle exec unicorn -c config/unicorn.rb
32+
COMMAND=${@:$n}
33+
echo "buildpack=nginx at=start-app cmd=$COMMAND"
34+
$COMMAND
35+
echo 'app' >$psmgr
36+
) &
37+
38+
if [[ -z "$FORCE" ]]
39+
then
40+
FILE="/tmp/app-initialized"
41+
42+
# We block on app-initialized so that when nginx binds to $PORT
43+
# are app is ready for traffic.
44+
while [[ ! -f "$FILE" ]]
45+
do
46+
echo 'buildpack=nginx at=app-initialization'
47+
sleep 1
48+
done
49+
echo 'buildpack=nginx at=app-initialized'
50+
fi
51+
52+
# Start nginx
53+
(
54+
# We expect nginx to run in foreground.
55+
# We also expect a socket to be at /tmp/nginx.socket.
56+
echo 'buildpack=nginx at=nginx-start'
57+
cd /tmp
58+
/usr/bin/nginx -p . -c /code/config/nginx.conf
59+
echo 'nginx' >$psmgr
60+
) &
61+
62+
# This read will block the process waiting on a msg to be put into the fifo.
63+
# If any of the processes defined above should exit,
64+
# a msg will be put into the fifo causing the read operation
65+
# to un-block. The process putting the msg into the fifo
66+
# will use it's process name as a msg so that we can print the offending
67+
# process to stdout.
68+
read exit_process <$psmgr
69+
echo "buildpack=nginx at=exit process=$exit_process"
70+
exit 1

blogs/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
default_app_config = 'blogs.apps.BlogsAppConfig'

blogs/admin.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ class BlogEntryAdmin(admin.ModelAdmin):
1010
date_hierarchy = 'pub_date'
1111
actions = ['sync_new_entries']
1212

13+
@admin.action(
14+
description="Sync new blog entries"
15+
)
1316
def sync_new_entries(self, request, queryset):
1417
call_command('update_blogs')
1518
self.message_user(request, "Blog entries updated.")
1619

17-
sync_new_entries.short_description = "Sync new blog entries"
1820

1921

2022
@admin.register(FeedAggregate)

0 commit comments

Comments
 (0)