Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/factory-boy-3.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCoffee authored Sep 17, 2024
2 parents 3901ee9 + 6b4c681 commit 45df4f5
Show file tree
Hide file tree
Showing 55 changed files with 370 additions and 2,520 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

-

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

### 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

Expand All @@ -19,5 +21,4 @@ https://github.com/python/cpython/issues/.
* 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
20 changes: 10 additions & 10 deletions base-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ django-apptemplates==1.5
django-admin-interface==0.24.2
django-translation-aliases==0.1.0
Django==4.2.16
docutils==0.12
Markdown==3.3.4
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
Expand All @@ -36,14 +36,14 @@ requests[security]>=2.26.0
django-honeypot==1.0.4 # 1.0.4 is first version that supports Django 4.2
django-markupfield==2.0.1

django-allauth==0.57.2 # 0.55.0 is first version that supports Django 4.2
django-allauth==64.2.1

django-waffle==2.2.1

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-ordered-model==3.7.4
django-widget-tweaks==1.5.0
django-countries==7.2.1
num2words==0.5.10
django-polymorphic==3.1.0 # 3.1.0 is first version that supports Django 4.0, unsure if it fully supports 4.2
Expand All @@ -52,5 +52,5 @@ django-extensions==3.1.4
django-import-export==2.7.1

pypandoc==1.12
panflute==2.3.0
panflute==2.3.1
Unidecode==1.3.8
4 changes: 2 additions & 2 deletions docs/source/administration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Pages are individual entire pages of markup content. They are require ``Title``
:Is Published: Controls whether or not the page is visible on the site.
:Template Name: By default Pages use the template ``templates/pages/default.html`` to use a different template enter the template path here.

.. note:: Pages are automatically purge from Fastly.com upon save.
.. note:: Pages are automatically purged from Fastly.com upon save.

.. _boxes:

Expand Down Expand Up @@ -82,7 +82,7 @@ Release Files have a checkbox named 'Download button' that determines which bina
Jobs
----

The jobs application is using to display Python jobs on the site. The data items should be fairly self explanatory. There are a couple of things to keep in mind. Logged in users of the site can submit jobs for review.
The jobs application is used to display Python jobs on the site. The data items should be fairly self explanatory. There are a couple of things to keep in mind. Logged in users of the site can submit jobs for review.

:Status: Jobs enter the system in 'review' status after the submitter has entered them. Only jobs in the 'approved' state are displayed on the site.
:Featured: Featured jobs are displayed more prominently on the landing page.
Expand Down
6 changes: 3 additions & 3 deletions downloads/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def test_is_version_at_least(self):

release_38 = Release.objects.create(name='Python 3.8.0')
self.assertFalse(release_38.is_version_at_least_3_9)
self.assert_(release_38.is_version_at_least_3_5)
self.assertTrue(release_38.is_version_at_least_3_5)

release_310 = Release.objects.create(name='Python 3.10.0')
self.assert_(release_310.is_version_at_least_3_9)
self.assert_(release_310.is_version_at_least_3_5)
self.assertTrue(release_310.is_version_at_least_3_9)
self.assertTrue(release_310.is_version_at_least_3_5)
3 changes: 1 addition & 2 deletions downloads/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
from django.urls import reverse
from django.test import TestCase, override_settings

from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase

from .base import BaseDownloadTests, DownloadMixin
from ..models import OS, Release
from ..models import Release
from pages.factories import PageFactory
from pydotorg.drf import BaseAPITestCase
from users.factories import UserFactory
Expand Down
8 changes: 7 additions & 1 deletion events/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ def import_occurrence(self, event, event_data):
# but won't add any timezone information. We will convert them to
# aware datetime objects manually.
dt_start = extract_date_or_datetime(event_data['DTSTART'].dt)
dt_end = extract_date_or_datetime(event_data['DTEND'].dt)
if 'DTEND' in event_data:
# DTEND is not always set on events, in particular it seems that
# events which have the same start and end time, don't provide
# DTEND. See #2021.
dt_end = extract_date_or_datetime(event_data['DTEND'].dt)
else:
dt_end = dt_start

# Let's mark those occurrences as 'all-day'.
all_day = (
Expand Down
6 changes: 3 additions & 3 deletions events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class OccurringRule(RuleMixin, models.Model):

def __str__(self):
strftime = settings.SHORT_DATETIME_FORMAT
return f'{self.event.title} {date(self.dt_start.strftime, strftime)} - {date(self.dt_end.strftime, strftime)}'
return f'{self.event.title} {date(self.dt_start, strftime)} - {date(self.dt_end, strftime)}'

@property
def begin(self):
Expand Down Expand Up @@ -283,8 +283,8 @@ class RecurringRule(RuleMixin, models.Model):
all_day = models.BooleanField(default=False)

def __str__(self):
strftime = settings.SHORT_DATETIME_FORMAT
return f'{self.event.title} every {timedelta_nice_repr(self.interval)} since {date(self.dt_start.strftime, strftime)}'
return (f'{self.event.title} every {timedelta_nice_repr(self.freq_interval_as_timedelta)} since '
f'{date(self.dt_start, settings.SHORT_DATETIME_FORMAT)}')

def to_rrule(self):
return rrule(
Expand Down
4 changes: 2 additions & 2 deletions fixtures/boxes.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@
"created": "2014-02-13T17:37:50.862Z",
"updated": "2014-02-16T23:01:04.762Z",
"label": "widget-weneedyou",
"content": "<h2 class=\"widget-title\"><span class=\"prompt\">&gt;&gt;&gt;</span> <a href=\"#\">Python Needs You</a></h2>\r\n<p>Open source software is made better when users can easily contribute code and documentation to fix bugs and add features. Python strongly encourages community involvement in improving the software. <a href=\"//docs.python.org/devguide\">Learn more</a> about how to make Python better for everyone.</p>\r\n<p class=\"click-these\">\r\n <a class=\"button\" href=\"//docs.python.org/devguide/#contributing\">Contribute to Python</a>\r\n <a class=\"button\" href=\"//bugs.python.org\">Bug Tracker</a>\r\n</p>",
"content": "<h2 class=\"widget-title\"><span class=\"prompt\">&gt;&gt;&gt;</span> <a href=\"#\">Python Needs You</a></h2>\r\n<p>Open source software is made better when users can easily contribute code and documentation to fix bugs and add features. Python strongly encourages community involvement in improving the software. <a href=\"//docs.python.org/devguide\">Learn more</a> about how to make Python better for everyone.</p>\r\n<p class=\"click-these\">\r\n <a class=\"button\" href=\"//docs.python.org/devguide/#contributing\">Contribute to Python</a>\r\n <a class=\"button\" href=\"//github.com/python/cpython/issues\">Bug Tracker</a>\r\n</p>",
"content_markup_type": "html",
"_content_rendered": "<h2 class=\"widget-title\"><span class=\"prompt\">&gt;&gt;&gt;</span> <a href=\"#\">Python Needs You</a></h2>\r\n<p>Open source software is made better when users can easily contribute code and documentation to fix bugs and add features. Python strongly encourages community involvement in improving the software. <a href=\"//docs.python.org/devguide\">Learn more</a> about how to make Python better for everyone.</p>\r\n<p class=\"click-these\">\r\n <a class=\"button\" href=\"//docs.python.org/devguide/#contributing\">Contribute to Python</a>\r\n <a class=\"button\" href=\"//bugs.python.org\">Bug Tracker</a>\r\n</p>"
"_content_rendered": "<h2 class=\"widget-title\"><span class=\"prompt\">&gt;&gt;&gt;</span> <a href=\"#\">Python Needs You</a></h2>\r\n<p>Open source software is made better when users can easily contribute code and documentation to fix bugs and add features. Python strongly encourages community involvement in improving the software. <a href=\"//docs.python.org/devguide\">Learn more</a> about how to make Python better for everyone.</p>\r\n<p class=\"click-these\">\r\n <a class=\"button\" href=\"//docs.python.org/devguide/#contributing\">Contribute to Python</a>\r\n <a class=\"button\" href=\"//github.com/python/cpython/issues\">Bug Tracker</a>\r\n</p>"
}
},
{
Expand Down
22 changes: 22 additions & 0 deletions infra/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 26 additions & 2 deletions infra/cdn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,29 @@ N/A
## Requirements

Tested on
- Tested on Terraform 1.8.5
- Fastly provider 5.13.0
- Tested on Terraform 1.9.5
- Fastly provider 5.13.0

# Fastly's NGWAF

This module also conditionally can set up the Fastly Next-Gen Web Application Firewall (NGWAF)
for our Fastly services related to python.org / test.python.org.

## Usage

```hcl
module "fastly_production" {
source = "./cdn"
...
activate_ngwaf_service = true
...
}
```

## Requirements

Tested on
- Terraform 1.9.5
- Fastly provider 5.13.0
- SigSci provider 3.3.0
Loading

0 comments on commit 45df4f5

Please sign in to comment.