Skip to content

Commit

Permalink
Merge pull request #175 from nyaruka/updates
Browse files Browse the repository at this point in the history
Update CI test versions and dev deps
  • Loading branch information
rowanseymour authored Aug 15, 2023
2 parents de075ed + 400be20 commit 4f1470d
Show file tree
Hide file tree
Showing 31 changed files with 415 additions and 689 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ jobs:
name: Test
strategy:
matrix:
python-version: ["3.9.x", "3.10.x"]
pg-version: ["13", "14"]
django-version: ["4.0.x", "4.1.x"]
python-version: ["3.10.x", "3.11.x"]
pg-version: ["14", "15"]
django-version: ["4.1.x", "4.2.x"]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.9.x"
python-version: "3.10.x"

- name: Publish release
run: |
Expand Down
968 changes: 367 additions & 601 deletions poetry.lock

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ packages = [
repository = "http://github.com/nyaruka/smartmin"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.10"
Django = ">= 4.0, < 5.0"
celery = ">= 5.1"
pytz = "*"
Expand All @@ -32,18 +32,17 @@ xlrd = "^1.2.0"
xlwt = "^1.3.0"

[tool.poetry.dev-dependencies]
black = "^23.7.0"
coverage = {extras = ["toml"], version = "^7.2.7"}
isort = "^5.12.0"
ruff = "^0.0.278"
psycopg2-binary = "^2.9.1"
funcsigs = "^1.0.2"
flake8 = "^3.8.4"
Pillow = "^9.3.0"
codecov = "^2.1.11"
ruff = "^0.0.171"
black = "^22.10.0"
colorama = "^0.4.6"
isort = "^5.10.1"

[tool.black]
line-length = 119
line-length = 120

[tool.ruff]
line-length = 120
Expand All @@ -54,7 +53,7 @@ fix = true
[tool.isort]
multi_line_output = 3
force_grid_wrap = 0
line_length = 119
line_length = 120
include_trailing_comma = true
combine_as_imports = true
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "DJANGO", "FIRSTPARTY", "LOCALFOLDER"]
Expand Down
1 change: 0 additions & 1 deletion smartmin/csv_imports/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
Expand Down
1 change: 0 additions & 1 deletion smartmin/csv_imports/migrations/0002_auto_20161118_1920.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("csv_imports", "0001_initial"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("csv_imports", "0002_auto_20161118_1920"),
]
Expand Down
1 change: 0 additions & 1 deletion smartmin/csv_imports/migrations/0004_auto_20170223_0917.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = [
("csv_imports", "0003_importtask_task_status"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("csv_imports", "0004_auto_20170223_0917"),
Expand Down
1 change: 0 additions & 1 deletion smartmin/csv_imports/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


def generate_file_path(instance, filename):

file_path_prefix = "csv_imports/"

name, extension = os.path.splitext(filename)
Expand Down
4 changes: 1 addition & 3 deletions smartmin/management/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ def check_role_permissions(role, permissions, current_permissions):

# if this is a wildcard, then query our database for all the permissions that exist on this object
if action == "*":
for perm in Permission.objects.filter(
codename__startswith="%s_" % object, content_type__app_label=app
):
for perm in Permission.objects.filter(codename__startswith="%s_" % object, content_type__app_label=app):
codenames.append(perm.codename)
# otherwise, this is an error, continue
else:
Expand Down
9 changes: 3 additions & 6 deletions smartmin/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ class SmartModel(models.Model):
dates.
"""

is_active = models.BooleanField(
default=True, help_text="Whether this item is active, use this instead of deleting"
)
is_active = models.BooleanField(default=True, help_text="Whether this item is active, use this instead of deleting")

created_by = models.ForeignKey(
settings.AUTH_USER_MODEL,
Expand Down Expand Up @@ -81,7 +79,6 @@ def get_import_file_headers(cls, csv_file):
workbook = open_workbook(filename.name, "rb")

for sheet in workbook.sheets():

# read our header
header = []
for col in range(sheet.ncols):
Expand Down Expand Up @@ -109,7 +106,7 @@ def get_import_file_headers(cls, csv_file):
break
reader.close()

reader = open(filename.name, "rU", encoding="utf-8-sig")
reader = open(filename.name, "r", encoding="utf-8-sig")

def unicode_csv_reader(utf8_data, dialect=csv.excel, **kwargs):
csv_reader = csv.reader(utf8_data, dialect=dialect, **kwargs)
Expand Down Expand Up @@ -309,7 +306,7 @@ def import_raw_csv(cls, filename, user, import_params, log=None, import_results=
break
reader.close()

reader = open(filename.name, "rU", encoding="utf-8-sig")
reader = open(filename.name, "r", encoding="utf-8-sig")

def unicode_csv_reader(utf8_data, dialect=csv.excel, **kwargs):
csv_reader = csv.reader(utf8_data, dialect=dialect, **kwargs)
Expand Down
1 change: 0 additions & 1 deletion smartmin/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class PDFMixin(object):
"""

def render_to_response(self, context, **response_kwargs):

response = super(PDFMixin, self).render_to_response(context, **response_kwargs)

# do the actual rendering
Expand Down
1 change: 0 additions & 1 deletion smartmin/users/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
Expand Down
1 change: 0 additions & 1 deletion smartmin/users/migrations/0002_remove_failed_logins.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def noop(apps, schema_editor): # pragma: no cover


class Migration(migrations.Migration):

dependencies = [
("users", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion smartmin/users/migrations/0003_auto_20210219_1548.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("users", "0002_remove_failed_logins"),
]
Expand Down
20 changes: 4 additions & 16 deletions smartmin/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ def clean_new_password(self):
# if they specified a new password
if password and not is_password_complex(password):
raise forms.ValidationError(
_(
"Passwords must have at least 8 characters, including one uppercase, "
"one lowercase and one number"
)
_("Passwords must have at least 8 characters, including one uppercase, " "one lowercase and one number")
)

return password
Expand Down Expand Up @@ -76,10 +73,7 @@ def clean_new_password(self):

if password and not is_password_complex(password):
raise forms.ValidationError(
_(
"Passwords must have at least 8 characters, including one uppercase, "
"one lowercase and one number"
)
_("Passwords must have at least 8 characters, including one uppercase, " "one lowercase and one number")
)

if password and PasswordHistory.is_password_repeat(self.instance, password):
Expand Down Expand Up @@ -118,10 +112,7 @@ def clean_confirm_new_password(self):
password = self.cleaned_data["new_password"]
if password and not is_password_complex(password):
raise forms.ValidationError(
_(
"Passwords must have at least 8 characters, including one uppercase, "
"one lowercase and one number"
)
_("Passwords must have at least 8 characters, including one uppercase, " "one lowercase and one number")
)

if password and PasswordHistory.is_password_repeat(self.instance, password):
Expand Down Expand Up @@ -195,10 +186,7 @@ def clean_confirm_new_password(self):
password = self.cleaned_data["new_password"]
if password and not is_password_complex(password):
raise forms.ValidationError(
_(
"Passwords must have at least 8 characters, including one uppercase, "
"one lowercase and one number"
)
_("Passwords must have at least 8 characters, including one uppercase, " "one lowercase and one number")
)

if password and PasswordHistory.is_password_repeat(self.instance, password):
Expand Down
4 changes: 1 addition & 3 deletions smartmin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,6 @@ def render_to_response(self, context, **response_kwargs):
"""
# is this a select2 format response?
if self.request.GET.get("_format", "html") == "select2":

results = []
for obj in context["object_list"]:
result = None
Expand Down Expand Up @@ -772,7 +771,6 @@ def derive_filename(self):
return filename

def render_to_response(self, context, **response_kwargs):

from xlwt import Workbook

book = Workbook()
Expand Down Expand Up @@ -857,7 +855,7 @@ def get_form(self):
fields.append("loc")

# provides a hook to programmatically customize fields before rendering
for (name, field) in self.form.fields.items():
for name, field in self.form.fields.items():
field = self.customize_form_field(name, field)
self.form.fields[name] = field

Expand Down
3 changes: 1 addition & 2 deletions test_runner/blog/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django.db import models, migrations
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
Expand Down
4 changes: 2 additions & 2 deletions test_runner/blog/migrations/0002_post_uuid.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from django.db import migrations, models
import uuid

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("blog", "0001_initial"),
]
Expand Down
3 changes: 1 addition & 2 deletions test_runner/blog/migrations/0003_auto_20170223_0917.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django.db import migrations, models
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("blog", "0002_post_uuid"),
]
Expand Down
6 changes: 3 additions & 3 deletions test_runner/blog/migrations/0004_auto_20170609_0743.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.db import migrations, models
import django.utils.timezone
import uuid

import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("blog", "0003_auto_20170223_0917"),
]
Expand Down
3 changes: 1 addition & 2 deletions test_runner/blog/migrations/0005_auto_20180615_2036.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
("blog", "0004_auto_20170609_0743"),
]
Expand Down
1 change: 0 additions & 1 deletion test_runner/blog/migrations/0006_post_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("blog", "0005_auto_20180615_2036"),
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Generated by Django 4.0.1 on 2022-01-12 15:47

import django.db.models.deletion
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),
("blog", "0006_post_image"),
Expand Down
2 changes: 1 addition & 1 deletion test_runner/blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.db import models
from django.utils.timezone import now

from smartmin.models import SmartModel, ActiveManager
from smartmin.models import ActiveManager, SmartModel


class Post(SmartModel):
Expand Down
Loading

0 comments on commit 4f1470d

Please sign in to comment.