Skip to content
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
60dba04
Added Ruff, added ignores for all reported issues
Oct 10, 2024
b9f0df6
Unnecessary '__future__' import 'absolute_import' for target Python v…
Oct 10, 2024
7bbbbfa
Use format specifiers instead of percent format
Oct 10, 2024
41fa9d8
Added per file ignores for S106
Oct 10, 2024
62c9639
Use a single 'with' statement with multiple contexts instead of neste…
Oct 10, 2024
7f2cc37
Import block is un-sorted or un-formatted
Oct 10, 2024
028e2f8
module imported but unused
Oct 10, 2024
5d73f73
Local variable is assigned to but never used
Oct 10, 2024
1424b86
Use f-string instead of 'format' call
Oct 10, 2024
0ebb5e6
Fixed exceptions raised in exception handlers
Oct 10, 2024
c7a687b
W291 no longer being thrown, fixed previously
Oct 10, 2024
e7e29d3
Removed pip stuff
Oct 10, 2024
3fa24d2
Removed pip stuff
Oct 10, 2024
e6b75ed
Merge branch 'repo-consistency' of github.com:praekeltfoundation/remi…
Oct 10, 2024
3fb8683
Updated Docker config
Oct 10, 2024
bbd6d3b
Updated Docker config
Oct 10, 2024
b64b807
Updated CI
Oct 24, 2024
1114d2a
Removed global S105 & 6, added inlines
Oct 24, 2024
393488b
Formatting
Oct 24, 2024
bd68c17
Use latest version of poetry
Oct 24, 2024
f44cdff
Update python to 3.10, some ruff fixes
Oct 24, 2024
55034e5
Updated lock file
Oct 24, 2024
63c6cf3
Revert back to python 3.9
Oct 24, 2024
1ab34db
Remove poetry and add uv
Mar 26, 2025
08ede15
Updated python version specifier
Mar 26, 2025
ca731f9
CI changes
Mar 26, 2025
45dd0dc
Updated CI
Mar 26, 2025
de5b3ab
Updated CI
Mar 26, 2025
0cba67e
Fix incorrect steps
Mar 26, 2025
908a501
Fixed issue in test yaml
Mar 26, 2025
84da2cf
Bumped to python 3.10
Mar 26, 2025
52e585c
Change run migrations
Mar 26, 2025
1f6cb1f
Remove setup.cfg
Mar 26, 2025
055ce82
Update ruff settings
Mar 26, 2025
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/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
- master

- repo-consistency
jobs:
build:
runs-on: ubuntu-latest
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,25 @@ jobs:
env:
DATABASE_URL: postgres://postgres:postgres@localhost/reminder_scheduler
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5.0.0
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependancies
run: pip install -r requirements.txt -r requirements-dev.txt
- uses: abatilo/actions-poetry@v3
- name: Install dependencies
id: install-deps
run: |
poetry install
- name: Check formatting
# Lints/tests should always run, even if other lints/tests have failed.
if: success() || failure() && steps.install-deps.outcome == 'success'
run: |
poetry run ruff format --check
- name: Lint
if: success() || failure() && steps.install-deps.outcome == 'success'
run: |
poetry run ruff check
- name: Run tests
if: success() || failure() && steps.install-deps.outcome == 'success'
run: |
python manage.py makemigrations --check
pytest
poetry run pytest -vv
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
FROM ghcr.io/praekeltfoundation/docker-django-bootstrap-nw:py3.9

COPY ./requirements.txt /app/
COPY ./setup.py /app/

RUN pip install -r /app/requirements.txt
FROM ghcr.io/praekeltfoundation/docker-django-bootstrap-nw:py3.10-buster

RUN pip install poetry==1.8.3
Comment thread
fritzbrand marked this conversation as resolved.
Outdated
COPY . /app
RUN poetry config virtualenvs.create false \
&& poetry install --no-dev --no-interaction --no-ansi --no-cache

# temporary untill there is a new PyCap Release
ENV DJANGO_SETTINGS_MODULE "config.settings.production"
Expand Down
2 changes: 1 addition & 1 deletion config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .celery import app as celery_app

__all__ = ('celery_app',)
__all__ = ("celery_app",)
6 changes: 3 additions & 3 deletions config/celery.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import os

import sentry_sdk
Expand All @@ -10,7 +8,7 @@
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")

app = Celery('')
app = Celery("")

# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
Expand All @@ -19,10 +17,12 @@
app.config_from_object("django.conf:settings")
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)


@app.task(bind=True)
def debug_task(self):
print("Request: {0!r}".format(self.request)) # noqa


# only connect to sentry if dsn is supplied
if settings.SENTRY_DSN:
sentry_sdk.init(dsn=settings.SENTRY_DSN, integrations=[CeleryIntegration()])
17 changes: 8 additions & 9 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import dj_database_url
import environ
from celery.schedules import crontab
from kombu import Exchange, Queue

root = environ.Path(__file__) - 3
env = environ.Env(DEBUG=(bool, False))
Expand Down Expand Up @@ -85,7 +84,7 @@

DATABASES = {
"default": dj_database_url.config(
default="sqlite:///%s" % (join(BASE_DIR, "db.sqlite3"),)
default="sqlite:///{}".format(join(BASE_DIR, "db.sqlite3"))
Comment thread
KaitCrawford marked this conversation as resolved.
)
}

Expand Down Expand Up @@ -133,8 +132,8 @@
SENTRY_DSN = env.str("SENTRY_DSN", "")

REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 10
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
"PAGE_SIZE": 10,
}

# Celery configuration options
Expand All @@ -152,15 +151,15 @@

CELERY_ALWAYS_EAGER = False

CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = "json"
CELERY_RESULT_SERIALIZER = "json"
CELERY_ACCEPT_CONTENT = ["json"]

CELERYBEAT_SCHEDULE = {
"reminder_check": {
"task": 'scheduler.tasks.check_for_scheduled_reminders',
"task": "scheduler.tasks.check_for_scheduled_reminders",
"schedule": crontab(minute="*"),
"kwargs":{},
"kwargs": {},
},
}

Expand Down
2 changes: 1 addition & 1 deletion config/settings/test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .base import * # noqa

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "TESTSEKRET"
SECRET_KEY = "TESTSEKRET" # noqa: S105 - Fake password/token for test purposes

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand Down
2 changes: 1 addition & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
urlpatterns = [
path("admin/", admin.site.urls),
path("", include("scheduler.urls")), # To be removed
path("scheduler/", include("scheduler.urls")), # To be removed
path("scheduler/", include("scheduler.urls")), # To be removed
path("quickreplies/", include("quickreplies.urls")),
path("rapidpro_api/", include("rapidpro_api.urls")),
]
1 change: 1 addition & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""

import os
import sys

Expand Down
Loading