Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_db

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7.0.1

- name: Install uv
uses: astral-sh/setup-uv@v10.2.0
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# syntax=docker/dockerfile:1.21.0
# syntax=docker/dockerfile:1.27.0

# ---- builder: install Python deps into an isolated venv via uv ----
FROM python:3.13-slim AS builder

COPY --from=ghcr.io/astral-sh/uv:0.12.1 /uv /uvx /usr/local/bin/
COPY --from=ghcr.io/astral-sh/uv:0.12.19 /uv /uvx /usr/local/bin/

ENV UV_LINK_MODE=copy \
UV_PROJECT_ENVIRONMENT=/opt/venv \
Expand Down
4 changes: 2 additions & 2 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tools]
python = "3.13"
task = "3.50.0"
uv = "0.12.1"
task = "3.53.1"
uv = "0.12.19"
73 changes: 39 additions & 34 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,44 @@ version = "0.1.0"
description = "Python Ireland website (python.ie / pycon.ie), built with Django and Wagtail CMS"
requires-python = "==3.13.*"
dependencies = [
"boto3",
"colander",
"defusedxml",
"delorean",
"dj-database-url",
"dj-static",
"django<6.1", # pinned to the 6.0.x branch, matches the currently deployed version
"django-compressor",
"django-extensions",
"django-libsass",
"django-modelcluster",
"django-storages",
"django-taggit",
"gunicorn",
"pandas",
"psycopg[binary]",
"pydantic",
"python-dateutil",
"pytz",
"redis",
"requests>=2.32.5",
"wagtail>=7.3.2,<7.4",
"whitenoise",
"willow",
"boto3>=1.43.102",
"colander>=2.0",
"defusedxml>=0.7.1",
"delorean>=2.0.0",
"dj-database-url>=3.1.2",
"dj-static>=0.0.6",
"django>=6.0.8,<6.1", # pinned to the 6.0.x branch, matches the currently deployed version
"django-compressor>=4.6.0",
"django-extensions>=4.1",
"django-libsass>=0.9",
"django-modelcluster>=6.5",
"django-storages>=1.14.6",
"django-taggit>=6.1.0",
"gunicorn>=26.2.0",
"pandas>=3.0.6",
"psycopg[binary]>=3.3.6",
"pydantic>=2.13.5",
"python-dateutil>=2.9.0.post0",
"pytz>=2026.4",
"redis>=8.1.0",
"requests>=2.34.2",
"wagtail>=7.3.4,<7.4",
"whitenoise>=6.12.0",
"willow>=1.12.0",
]

[dependency-groups]
dev = [
"coverage",
"django-debug-toolbar",
"fakeredis",
"isort",
"model_mommy",
"pip-audit",
"pipdeptree",
"ruff==0.15.16", # pinned: 0.16 changes the default lint rule set
"uv",
"wagtail-factories",
"coverage>=7.16.1",
"django-debug-toolbar>=8.0.0",
"fakeredis>=2.38.0",
"isort>=9.0.1",
"model_mommy>=2.0.0",
"pip-audit>=2.10.1",
"pipdeptree>=4.2.5",
"ruff==0.16.9", # pinned: ruff minor releases change the default lint rule set
"uv>=0.12.19",
"wagtail-factories>=4.5.0",
]

[tool.uv]
Expand All @@ -50,6 +50,11 @@ package = false
[tool.ruff]
target-version = "py313"

[tool.ruff.lint]
# RUF012 flags the Django/Wagtail class-attribute idioms (Meta, migrations
# operations/dependencies, content_panels) that are never mutated.
extend-ignore = ["RUF012"]

[tool.coverage.run]
branch = true
source = ["pythonie"]
6 changes: 3 additions & 3 deletions pythonie/core/factories.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import factory
import wagtail_factories
from django.utils import timezone
from factory.django import DjangoModelFactory
import wagtail_factories

from core.models import HomePage, SimplePage
from meetups.models import Meetup
from sponsors.models import SponsorshipLevel

from core.models import HomePage, SimplePage


class SponsorshipLevelFactory(DjangoModelFactory):
class Meta:
Expand Down
3 changes: 0 additions & 3 deletions pythonie/core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import modelcluster.fields
import wagtail.fields
from django.db import migrations, models
Expand Down
3 changes: 0 additions & 3 deletions pythonie/core/migrations/0002_simplepage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
Expand Down
3 changes: 0 additions & 3 deletions pythonie/core/migrations/0003_media_in_simple_page.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import wagtail.blocks
import wagtail.embeds.blocks
import wagtail.fields
Expand Down
3 changes: 0 additions & 3 deletions pythonie/core/migrations/0004_auto_20150708_1416.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import wagtail.blocks
import wagtail.embeds.blocks
import wagtail.fields
Expand Down
3 changes: 0 additions & 3 deletions pythonie/core/migrations/0005_auto_20150726_1416.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
3 changes: 0 additions & 3 deletions pythonie/core/migrations/0006_homepagesponsorrelationship.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
3 changes: 0 additions & 3 deletions pythonie/core/migrations/0007_homepage_sponsors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
3 changes: 0 additions & 3 deletions pythonie/core/migrations/0008_auto_20150821_2230.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import wagtail.blocks
import wagtail.embeds.blocks
import wagtail.fields
Expand Down
2 changes: 0 additions & 2 deletions pythonie/core/migrations/0009_auto_20160703_0857.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-03 08:57
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
10 changes: 3 additions & 7 deletions pythonie/core/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

import logging

from django.db import models
Expand Down Expand Up @@ -62,7 +60,7 @@ class PageSegment(models.Model):
]

def __str__(self):
return "{!s} on {!s}".format(self.title, self.homepage_segments.first())
return f"{self.title!s} on {self.homepage_segments.first()!s}"


class HomePageSegment(Orderable, models.Model):
Expand All @@ -84,7 +82,7 @@ class Meta:
]

def __str__(self):
return "{!s} Segment".format(self.homepage)
return f"{self.homepage!s} Segment"


class HomePageSponsorRelationship(models.Model):
Expand All @@ -97,9 +95,7 @@ class HomePageSponsorRelationship(models.Model):
level = models.ForeignKey(SponsorshipLevel, on_delete=models.CASCADE)

def __repr__(self):
return "{} {} {}".format(
self.sponsor.name, self.homepage.title, self.level.name
)
return f"{self.sponsor.name} {self.homepage.title} {self.level.name}"


class HomePage(Page, MeetupMixin, SponsorMixin):
Expand Down
3 changes: 0 additions & 3 deletions pythonie/meetups/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
3 changes: 0 additions & 3 deletions pythonie/meetups/migrations/0003_remove_meetup_announced.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations


Expand Down
7 changes: 1 addition & 6 deletions pythonie/meetups/migrations/0004_auto_20150705_1641.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import datetime

from django.db import migrations, models
Expand All @@ -16,9 +13,7 @@ class Migration(migrations.Migration):
model_name="meetup",
name="updated",
field=models.DateTimeField(
default=datetime.datetime(
1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc
)
default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.UTC)
),
preserve_default=True,
),
Expand Down
3 changes: 0 additions & 3 deletions pythonie/meetups/migrations/0005_delete_meetupupdate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations


Expand Down
2 changes: 0 additions & 2 deletions pythonie/meetups/migrations/0006_auto_20160703_0857.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-03 08:57
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
10 changes: 4 additions & 6 deletions pythonie/meetups/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import logging
from datetime import datetime
from datetime import UTC, datetime

from dateutil.relativedelta import relativedelta
from delorean import Delorean
from django.db import models
from django.utils import timezone
from sponsors.models import Sponsor
from wagtail.snippets.models import register_snippet

Expand Down Expand Up @@ -38,9 +38,7 @@ class Meetup(models.Model):
)
time = models.DateTimeField()
created = models.DateTimeField()
updated = models.DateTimeField(
default=Delorean(datetime(1970, 1, 1), timezone="UTC").datetime
)
updated = models.DateTimeField(default=datetime(1970, 1, 1, tzinfo=UTC))

rsvps = models.IntegerField(default=0)
maybe_rsvps = models.IntegerField(default=0)
Expand All @@ -57,7 +55,7 @@ def __str__(self):

@classmethod
def future_events(cls):
today = datetime.now()
today = timezone.now()
return cls.objects.filter(time__gt=today).filter(
time__lt=next_n_months(today, 3)
)
6 changes: 3 additions & 3 deletions pythonie/meetups/schema.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from datetime import datetime
from datetime import UTC, datetime

import colander
from delorean import Delorean


def int_to_datetime(value):
time = datetime.utcfromtimestamp(value / 1000)
return Delorean(time, timezone="UTC").shift("Europe/Dublin").datetime
time = datetime.fromtimestamp(value / 1000, tz=UTC)
return Delorean(time).shift("Europe/Dublin").datetime


class Meetups(colander.MappingSchema):
Expand Down
8 changes: 4 additions & 4 deletions pythonie/meetups/test_meetups.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ def test_create_meetup(self):
self.assertIsNotNone(meetup.visibility)

def test_next_n_months(self):
september = datetime(year=2015, month=9, day=1, hour=1, minute=00)
expected = datetime(year=2015, month=12, day=1, hour=1, minute=00)
september = datetime(year=2015, month=9, day=1, hour=1, minute=00, tzinfo=UTC)
expected = datetime(year=2015, month=12, day=1, hour=1, minute=00, tzinfo=UTC)
actual = next_n_months(september, 3)
self.assertEqual(expected, actual)
november = datetime(year=2015, month=10, day=1, hour=1, minute=00)
expected = datetime(year=2016, month=1, day=1, hour=1, minute=00)
november = datetime(year=2015, month=10, day=1, hour=1, minute=00, tzinfo=UTC)
expected = datetime(year=2016, month=1, day=1, hour=1, minute=00, tzinfo=UTC)
actual = next_n_months(november, 3)
self.assertEqual(expected, actual)

Expand Down
10 changes: 5 additions & 5 deletions pythonie/meetups/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

def get_content(url, params=None):
response = requests.get(url, params=params, timeout=3)
log.info("Response from meetups request: {0}".format(response))
log.info(f"Response from meetups request: {response}")
if not response:
return []
log.debug("Retrieved {} from {}".format(response.json(), url))
log.debug(f"Retrieved {response.json()} from {url}")
return response.json()


Expand All @@ -24,7 +24,7 @@ def update():
params={"group_urlname": "pythonireland", "text_format": "html", "time": ",3m"},
)
if not meetup_data:
log.warn("No meetup data returned from API")
log.warning("No meetup data returned from API")
return
log.info(meetup_data)
meetups = schema.Meetups()
Expand All @@ -40,7 +40,7 @@ def update():
meetup.waitlist_count = result.get("waitlist_count")

if result["updated"] <= meetup.updated:
log.info("Existing meetup:{!r} RSVPs updated".format(meetup))
log.info(f"Existing meetup:{meetup!r} RSVPs updated")
meetup.save()
continue

Expand All @@ -55,4 +55,4 @@ def update():
meetup.status = result.get("status")
meetup.visibility = result.get("visibility")
meetup.save()
log.info("Existing meetup:{!r} fully updated".format(meetup))
log.info(f"Existing meetup:{meetup!r} fully updated")
4 changes: 2 additions & 2 deletions pythonie/pythonie/settings/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def configure_redis(redis_url, test=False):
import redis

url = urlparse(redis_url)
log.info("Redis configured with redis_url: %s" % redis_url)
log.info("Redis configured with redis_url: %s", redis_url)
return redis.Redis(host=url.hostname, port=url.port, password=url.password)

log.warn("Redis not configured")
log.warning("Redis not configured")
Loading
Loading