Skip to content

Commit

Permalink
Merge branch 'main' into fix-issue-1701
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCoffee authored Sep 16, 2024
2 parents c7cfabd + 7eac335 commit fa6e0ce
Show file tree
Hide file tree
Showing 120 changed files with 1,500 additions and 2,694 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Notify @EWDurbin for all opened Issues and Pull Requests
* @EWDurbin @JacobCoffee
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
By submitting this pull request, you agree to:
- follow the [PSF's Code of Conduct](https://www.python.org/psf/conduct/)
-->
#### Description

-

<!--
If applicable, please add in issue numbers this pull request will close, if applicable
Examples: Fixes #4321 or Closes #1234
Ensure you are using a supported keyword to properly link an issue:
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->
#### Closes

-

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.1
image: postgres:15.3
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -31,7 +31,7 @@ jobs:
sudo dpkg -i pandoc-2.17.1.1-1-amd64.deb
- uses: actions/setup-python@v5
with:
python-version: 3.9.16
python-version-file: '.python-version'
- name: Cache Python dependencies
uses: actions/cache@v4
env:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check collectstatic
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- name: Cache Python dependencies
uses: actions/cache@v4
env:
cache-name: pythondotorg-cache-pip
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt', '*-requirements.txt') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
${{ runner.os }}-${{ github.job }}-
${{ runner.os }}-
- name: Install Python dependencies
run: |
pip install -U pip setuptools wheel
pip install -r requirements.txt -r prod-requirements.txt
- name: Run Tests
run: |
DJANGO_SETTINGS_MODULE=pydotorg.settings.static python manage.py collectstatic --noinput
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.16
3.12.6
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-bookworm
FROM python:3.12.6-bookworm
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.cabotage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-bullseye
FROM python:3.12.6-bookworm
COPY --from=ewdurbin/nginx-static:1.25.x /usr/bin/nginx /usr/bin/nginx
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
Expand Down
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ default:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null\
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}'\
| sort\
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
| grep -E -v -e '^[^[:alnum:]]' -e '^$@$$'
@echo
@exit 1

.state/docker-build-web: Dockerfile dev-requirements.txt base-requirements.txt
# Build web container for this project
docker-compose build --force-rm web
docker compose build --force-rm web

# Mark the state so we don't rebuild this needlessly.
mkdir -p .state && touch .state/docker-build-web
Expand All @@ -24,35 +24,35 @@ default:

.state/db-initialized: .state/docker-build-web .state/db-migrated
# Load all fixtures
docker-compose run --rm web ./manage.py loaddata fixtures/*.json
docker compose run --rm web ./manage.py loaddata fixtures/*.json

# Mark the state so we don't rebuild this needlessly.
mkdir -p .state && touch .state/db-initialized

serve: .state/db-initialized
docker-compose up --remove-orphans
docker compose up --remove-orphans

migrations: .state/db-initialized
# Run Django makemigrations
docker-compose run --rm web ./manage.py makemigrations
docker compose run --rm web ./manage.py makemigrations

migrate: .state/docker-build-web
# Run Django migrate
docker-compose run --rm web ./manage.py migrate
docker compose run --rm web ./manage.py migrate

manage: .state/db-initialized
# Run Django manage to accept arbitrary arguments
docker-compose run --rm web ./manage.py $(filter-out $@,$(MAKECMDGOALS))
docker compose run --rm web ./manage.py $(filter-out $@,$(MAKECMDGOALS))

shell: .state/db-initialized
docker-compose run --rm web ./manage.py shell
docker compose run --rm web ./manage.py shell

clean:
docker-compose down -v
docker compose down -v
rm -f .state/docker-build-web .state/db-initialized .state/db-migrated

test: .state/db-initialized
docker-compose run --rm web ./manage.py test
docker compose run --rm web ./manage.py test

docker_shell: .state/db-initialized
docker-compose run --rm web /bin/bash
docker compose run --rm web /bin/bash
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@

### General information

This is the repository and issue tracker for [python.org](https://www.python.org).
The repository for CPython itself is at https://github.com/python/cpython, and the
issue tracker is at https://github.com/python/cpython/issues/.
This is the repository and issue tracker for [python.org](https://www.python.org).

Issues related to [Python's documentation](https://docs.python.org) can be filed in
https://github.com/python/cpython/issues/.
> [!NOTE]
> The repository for CPython itself is at https://github.com/python/cpython, and the
> issue tracker is at https://github.com/python/cpython/issues/.
>
> Similarly, issues related to [Python's documentation](https://docs.python.org) can be filed in
> https://github.com/python/cpython/issues/.
### Contributing

* Source code: https://github.com/python/pythondotorg
* Issue tracker: https://github.com/python/pythondotorg/issues
* Documentation: https://pythondotorg.readthedocs.org/
* Documentation: https://pythondotorg.readthedocs.io/
* Mailing list: [pydotorg-www](https://mail.python.org/mailman/listinfo/pydotorg-www)
* IRC: `#pydotorg` on Freenode
* Staging site: https://staging.python.org/ (`main` branch)
* License: Apache License
1 change: 0 additions & 1 deletion banners/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'banners.apps.BannersAppConfig'
35 changes: 17 additions & 18 deletions base-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
dj-database-url==0.5.0
django-pipeline==2.0.6
django-sitetree==1.18.0
django-pipeline==3.0.0 # 3.0.0 is first version that supports Django 4.2
django-sitetree==1.18.0 # >=1.17.1 is (?) first version that supports Django 4.2
django-apptemplates==1.5
django-admin-interface==0.24.2
django-translation-aliases==0.1.0
Django==2.2.28
docutils==0.12
Markdown==3.3.4
Django==4.2.16
docutils==0.21.2
Markdown==3.7
cmarkgfm==0.6.0
Pillow==9.4.0
psycopg2-binary==2.8.6
Pillow==10.4.0
psycopg2-binary==2.9.9
python3-openid==3.2.0
python-decouple==3.4
# lxml used by BeautifulSoup.
lxml==5.2.2
cssselect==1.1.0
feedparser==6.0.8
beautifulsoup4==4.11.2
feedparser==6.0.11
beautifulsoup4==4.12.3
icalendar==4.0.7
chardet==4.0.0
celery[redis]==5.3.6
django-celery-beat==2.5.0
# TODO: We may drop 'django-imagekit' completely.
django-imagekit==4.0.2
django-imagekit==5.0 # 5.0 is first version that supports Django 4.2
django-haystack==3.2.1
elasticsearch>=7,<8
# TODO: 0.14.0 only supports Django 1.8 and 1.11.
django-tastypie==0.14.3
django-tastypie==0.14.6 # 0.14.6 is first version that supports Django 4.2

pytz==2021.1
python-dateutil==2.8.2

requests[security]>=2.26.0

django-honeypot==1.0.1
django-markupfield==2.0.0
django-markupfield-helpers==0.1.1
django-honeypot==1.0.4 # 1.0.4 is first version that supports Django 4.2
django-markupfield==2.0.1

django-allauth==0.50.0
django-allauth==64.2.1

django-waffle==2.2.1

djangorestframework==3.12.2
djangorestframework==3.14.0 # 3.14.0 is first version that supports Django 4.1, 4.2 support hasnt been "released"
django-filter==2.4.0
django-ordered-model==3.4.3
django-widget-tweaks==1.4.8
django-widget-tweaks==1.5.0
django-countries==7.2.1
num2words==0.5.10
django-polymorphic==3.0.0
django-polymorphic==3.1.0 # 3.1.0 is first version that supports Django 4.0, unsure if it fully supports 4.2
sorl-thumbnail==12.7.0
django-extensions==3.1.4
django-import-export==2.7.1
Expand Down
1 change: 0 additions & 1 deletion blogs/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'blogs.apps.BlogsAppConfig'
4 changes: 3 additions & 1 deletion blogs/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ class BlogEntryAdmin(admin.ModelAdmin):
date_hierarchy = 'pub_date'
actions = ['sync_new_entries']

@admin.action(
description="Sync new blog entries"
)
def sync_new_entries(self, request, queryset):
call_command('update_blogs')
self.message_user(request, "Blog entries updated.")

sync_new_entries.short_description = "Sync new blog entries"


@admin.register(FeedAggregate)
Expand Down
26 changes: 26 additions & 0 deletions blogs/migrations/0003_alter_relatedblog_creator_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.11 on 2024-09-05 17:10

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('blogs', '0002_remove_translations_and_contributors'),
]

operations = [
migrations.AlterField(
model_name='relatedblog',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='relatedblog',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
]
4 changes: 2 additions & 2 deletions blogs/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.conf import settings
from django.template.loader import render_to_string
from django.utils.timezone import make_aware, utc
from django.utils.timezone import make_aware

from boxes.models import Box
from .models import BlogEntry, Feed
Expand All @@ -16,7 +16,7 @@ def get_all_entries(feed_url):

for e in d['entries']:
published = make_aware(
datetime.datetime(*e['published_parsed'][:7]), timezone=utc
datetime.datetime(*e['published_parsed'][:7]), timezone=datetime.timezone.utc
)

entry = {
Expand Down
1 change: 0 additions & 1 deletion boxes/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'boxes.apps.BoxesAppConfig'
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.11 on 2024-09-05 17:10

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('boxes', '0003_auto_20171101_2138'),
]

operations = [
migrations.AlterField(
model_name='box',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='box',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
]
1 change: 0 additions & 1 deletion cms/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.apps.CmsAppConfig'
1 change: 0 additions & 1 deletion codesamples/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'codesamples.apps.CodesamplesAppConfig'
26 changes: 26 additions & 0 deletions codesamples/migrations/0004_alter_codesample_creator_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.11 on 2024-09-05 17:10

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('codesamples', '0003_auto_20170821_2000'),
]

operations = [
migrations.AlterField(
model_name='codesample',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='codesample',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
]
6 changes: 2 additions & 4 deletions codesamples/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ def setUp(self):
is_published=False)

def test_published(self):
self.assertQuerysetEqual(CodeSample.objects.published(),
['<CodeSample: Copy One>'])
self.assertQuerySetEqual(CodeSample.objects.published(),['<CodeSample: Copy One>'], transform=repr)

def test_draft(self):
self.assertQuerysetEqual(CodeSample.objects.draft(),
['<CodeSample: Copy Two>'])
self.assertQuerySetEqual(CodeSample.objects.draft(),['<CodeSample: Copy Two>'], transform=repr)
1 change: 0 additions & 1 deletion community/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'community.apps.CommunityAppConfig'
Loading

0 comments on commit fa6e0ce

Please sign in to comment.