Skip to content

Commit

Permalink
Add Django 5.0 to build matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
hugorodgerbrown committed Nov 15, 2023
1 parent 1f6bfc4 commit 5ef93fb
Show file tree
Hide file tree
Showing 15 changed files with 188 additions and 165 deletions.
38 changes: 0 additions & 38 deletions .flake8

This file was deleted.

76 changes: 49 additions & 27 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,41 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
toxenv: [fmt,lint,mypy]
toxenv: [fmt, lint, mypy]
env:
TOXENV: ${{ matrix.toxenv }}

steps:
- name: Check out the repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v1
- name: Set up Python (3.11)
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.11"

- name: Install and run tox
run: |
pip install tox
tox
checks:
name: Run Django checks
runs-on: ubuntu-latest
strategy:
matrix:
toxenv: ["django-checks"]
env:
TOXENV: ${{ matrix.toxenv }}

steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Set up Python (3.11)
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install and run tox
run: |
Expand All @@ -37,35 +60,34 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.9]
django: [22,32,main]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# build LTS version, next version, HEAD
django: ["32", "42", "50", "main"]
exclude:
- python: "3.8"
django: "50"
- python: "3.8"
django: "main"
- python: "3.9"
django: "50"
- python: "3.9"
django: "main"
- python: "3.10"
django: "main"
- python: "3.11"
django: "32"
- python: "3.12"
django: "32"

env:
TOXENV: py${{ matrix.python }}-django${{ matrix.django }}

# services:
# postgres:
# image: postgres:12
# env:
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# POSTGRES_DB: onfido
# # Set health checks to wait until postgres has started
# options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# # Maps tcp port 5432 on service container to the host
# - 5432:5432
TOXENV: django${{ matrix.django }}-py${{ matrix.python }}

steps:
- name: Check out the repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand Down
8 changes: 0 additions & 8 deletions .isort.cfg

This file was deleted.

32 changes: 7 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,26 @@
repos:
# python import sorting - will amend files
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.9.3
hooks:
- id: isort

# python code formatting - will amend files
- repo: https://github.com/ambv/black
rev: 21.9b0
rev: 23.10.1
hooks:
- id: black

- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
hooks:
- id: pyupgrade

# Flake8 includes pyflakes, pycodestyle, mccabe, pydocstyle, bandit
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: "v0.1.5"
hooks:
- id: flake8
additional_dependencies:
- flake8-bandit
- flake8-blind-except
- flake8-docstrings
- flake8-logging-format
- flake8-print
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

# python static type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
rev: v1.7.0
hooks:
- id: mypy
# additional_dependencies:
args:
- --disallow-untyped-defs
- --disallow-incomplete-defs
- --check-untyped-defs
- --no-implicit-optional
- --ignore-missing-imports
- --follow-imports=silent
exclude: ^tests
66 changes: 66 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
line-length = 88
ignore = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in __init__
"D203", # 1 blank line required before class docstring
"D212", # Multi-line docstring summary should start at the first line
"D213", # Multi-line docstring summary should start at the second line
"D404", # First word of the docstring should not be "This"
"D405", # Section name should be properly capitalized
"D406", # Section name should end with a newline
"D407", # Missing dashed underline after section
"D410", # Missing blank line after section
"D411", # Missing blank line before section
"D412", # No blank lines allowed between a section header and its content
"D416", # Section name should end with a colon
"D417",
"D417", # Missing argument description in the docstring
]
select = [
"A", # flake8 builtins
"C9", # mcabe
"D", # pydocstyle
"E", # pycodestyle (errors)
"F", # Pyflakes
"I", # isort
"S", # flake8-bandit
"T2", # flake8-print
"W", # pycodestype (warnings)
]

[isort]
combine-as-imports = true

[mccabe]
max-complexity = 8

[per-file-ignores]
"*tests/*" = [
"D205", # 1 blank line required between summary line and description
"D400", # First line should end with a period
"D401", # First line should be in imperative mood
"D415", # First line should end with a period, question mark, or exclamation point
"E501", # Line too long
"E731", # Do not assign a lambda expression, use a def
"S101", # Use of assert detected
"S105", # Possible hardcoded password
"S106", # Possible hardcoded password
"S113", # Probable use of requests call with timeout set to {value}
]
"*/migrations/*" = [
"E501", # Line too long
]
"*/settings.py" = [
"F403", # from {name} import * used; unable to detect undefined names
"F405", # {name} may be undefined, or defined from star imports:
]
"*/settings/*" = [
"F403", # from {name} import * used; unable to detect undefined names
"F405", # {name} may be undefined, or defined from star imports:
]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 YunoJuno Ltd
Copyright (c) 2023 YunoJuno Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 1 addition & 0 deletions example/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
class ExampleAppConfig(AppConfig):
name = "example"
verbose_name = "Sample Cats app "
default_auto_field = "django.db.models.AutoField"
1 change: 0 additions & 1 deletion example/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand Down
37 changes: 17 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-s3-upload"
version = "0.4"
version = "1.0"
description = "Integrates direct client-side uploading to s3 with Django."
authors = ["YunoJuno <code@yunojuno.com>"]
license = "MIT"
Expand All @@ -10,46 +10,43 @@ homepage = "https://github.com/yunojuno/django-s3-upload"
repository = "https://github.com/yunojuno/django-s3-upload"
documentation = "https://github.com/yunojuno/django-s3-upload"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
packages = [{ include = "s3upload" }]

[tool.poetry.dependencies]
python = "^3.7"
django = "^2.2 || ^3.0 || ^4.0"
python = "^3.8"
django = "^3.2 || ^4.0 || ^5.0"
boto3 = "^1.14"

[tool.poetry.dev-dependencies]
black = {version = "*", allow-prereleases = true}
[tool.poetry.groups.test.dependencies]
coverage = "*"
flake8 = "*"
flake8-bandit = "*"
flake8-blind-except = "*"
flake8-docstrings = "*"
flake8-logging-format = "*"
flake8-print = "*"
freezegun = "*"
isort = "*"
mypy = "*"
pre-commit = "*"
pytest = "*"
pytest-cov = "*"
pytest-django = "*"
tox = "*"

[tool.poetry.group.dev.dependencies]
black = "*"
coverage = "*"
mypy = "*"
pre-commit = "*"
ruff = "*"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
1 change: 0 additions & 1 deletion s3upload/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "s3upload.apps.S3UploadAppConfig"
1 change: 1 addition & 0 deletions s3upload/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
class S3UploadAppConfig(AppConfig):
name = "s3upload"
verbose_name = "S3 Uploads"
default_auto_field = "django.db.models.AutoField"
1 change: 0 additions & 1 deletion s3upload/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

@require_POST
def get_upload_params(request: HttpRequest) -> JsonResponse: # noqa: C901

content_type = request.POST["type"]
filename = get_valid_filename(request.POST["name"])
dest = settings.S3UPLOAD_DESTINATIONS[request.POST["dest"]]
Expand Down
2 changes: 1 addition & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@


# used by the example app
def create_filename(filename):
def create_filename(filename: str) -> str:
ext = filename.split(".")[-1]
filename = "{}.{}".format(uuid.uuid4().hex, ext)
return path.join("custom", filename)
Expand Down
Loading

0 comments on commit 5ef93fb

Please sign in to comment.