Skip to content

Commit

Permalink
Added support for python3.11, django4.0 and django4.1 (#29)
Browse files Browse the repository at this point in the history
Forced ubuntu version to 20.04 as python3.6 cannot be installed on
ubuntu22.x based on suggestion from actions/setup-python#544 (comment)

Co-authored-by: Mael Pedretti <[email protected]>
  • Loading branch information
robertmithell324 and 73VW committed Dec 15, 2022
1 parent cc68d48 commit 74902ae
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
python: ['3.6', '3.7', '3.8', '3.9', '3.10']
python: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']

steps:

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

from setuptools import setup, find_packages
from setuptools import find_packages, setup


def long_description() -> str:
Expand Down Expand Up @@ -48,6 +48,7 @@ def long_description() -> str:
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
packages=find_packages(exclude=['tests', 'tests.*']),
include_package_data=True,
Expand Down
5 changes: 2 additions & 3 deletions sms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
"""
Tools for sending text messages.
"""
from typing import Type, Union, List, Optional
from typing import List, Optional, Type, Union

from django.conf import settings # type: ignore
from django.utils.module_loading import import_string # type: ignore

from sms.backends.base import BaseSmsBackend
from sms.message import Message


__all__ = [
'Message', 'get_connection', 'send_sms'
]


def get_connection(
backend: str = None,
backend: Optional[str] = None,
fail_silently: bool = False,
**kwargs
) -> Type[BaseSmsBackend]:
Expand Down
17 changes: 11 additions & 6 deletions sms/backends/filebased.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
import datetime
import os

from typing import Optional

from django.conf import settings # type: ignore
Expand All @@ -14,18 +13,24 @@


class SmsBackend(BaseSmsBackend):
file_path: str

def __init__(
self,
*args,
file_path: Optional[str] = None,
**kwargs
) -> None:
self._fname: Optional[str] = None
if file_path is not None:
self.file_path = file_path
else:
self.file_path = getattr(settings, 'SMS_FILE_PATH', None)
self.file_path = os.path.abspath(self.file_path)
if not file_path:
file_path = getattr(settings, 'SMS_FILE_PATH', None)
if not file_path:
raise ImproperlyConfigured((
'Missin path for saving text messages'
))
self.file_path = file_path

self.file_path: str = os.path.abspath(self.file_path)
try:
os.makedirs(self.file_path, exist_ok=True)
except FileExistsError:
Expand Down
12 changes: 8 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[tox]
envlist =
py3{6,7,8,9,10}-django22
py3{6,7,8,9,10}-django31
py3{6,7,8,9,10}-django32
py3{6,7,8,9,10}-master
py3{6,7,8,9,10,11}-django22
py3{6,7,8,9,10,11}-django31
py3{6,7,8,9,10,11}-django32
py3{6,7,8,9,10,11}-django40
py3{6,7,8,9,10,11}-django41
py3{6,7,8,9,10,11}-master
mypy
pep8

Expand All @@ -23,6 +25,8 @@ deps=
django22: Django==2.2.*
django31: Django==3.1.*
django32: Django==3.2.*
django40: Django==4.0.*
django41: Django==4.1.*
django-master: https://github.com/django/django/archive/master.tar.gz

[testenv:pep8]
Expand Down

0 comments on commit 74902ae

Please sign in to comment.