Skip to content

Commit c52abaf

Browse files
committed
Merge remote-tracking branch 'upstream/main' into release
2 parents 3f237d8 + d4f9b5b commit c52abaf

File tree

18 files changed

+99
-43
lines changed

18 files changed

+99
-43
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
12+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1313

1414
steps:
15-
- uses: actions/checkout@v1
15+
- uses: actions/checkout@v4
1616
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v2
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: ${{ matrix.python-version }}
2020
- name: Install dependencies
2121
run: |
2222
python -m pip install --upgrade pip
23-
pip install tox tox-gh-actions flake8 black
23+
pip install tox tox-gh-actions black==22.12.0 isort==5.12.0 ruff==0.0.270
24+
2425
- name: Lint
25-
run: ./pep8.sh
26+
run: ./lint.sh
2627
- name: Test with tox
2728
run: tox

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Upstream: https://pypi.org/project/django-binary-database-files/
77
Django Binary Database Files
88
============================
99

10-
[![](https://img.shields.io/pypi/v/django-binary-database-files.svg)](https://pypi.python.org/pypi/django-binary-database-files) [![Build Status](https://img.shields.io/travis/kimetrica/django-binary-database-files.svg?branch=master)](https://travis-ci.org/kimetrica/django-binary-database-files/) [![](https://pyup.io/repos/github/kimetrica/django-binary-database-files/shield.svg)](https://pyup.io/repos/github/kimetrica/django-binary-database-files)
10+
[![](https://img.shields.io/pypi/v/django-binary-database-files.svg)](https://pypi.python.org/pypi/django-binary-database-files) [![Build Status](https://github.com/Kimetrica/django-binary-database-files/actions/workflows/test.yml/badge.svg)](https://github.com/kimetrica/django-binary-database-files/actions) [![](https://pyup.io/repos/github/kimetrica/django-binary-database-files/shield.svg)](https://pyup.io/repos/github/kimetrica/django-binary-database-files)
1111

1212
This is a storage system for Django that stores uploaded
1313
files in binary fields in the database. Files can be served from the database
@@ -101,27 +101,27 @@ Development
101101

102102
Code should be linted with:
103103

104-
./pep8.sh
104+
./lint.sh
105105

106106
Tests require the Python development headers to be installed, which you can install on Ubuntu with:
107107

108-
sudo apt-get install python3-dev python3.6-dev
108+
sudo apt-get install python3.12-minimal python3.12-dev
109109

110110
To run unittests across multiple Python versions, install:
111111

112-
sudo apt-get install python3.6-minimal python3.6-dev python3.7-minimal python3.7-dev
112+
sudo apt-get install python3.10-minimal python3.10-dev python3.11-minimal python3.11-dev python3.12-minimal python3.12-dev
113113

114114
To run all [tests](http://tox.readthedocs.org/en/latest/):
115115

116116
export TESTNAME=; tox
117117

118-
To run tests for a specific environment (e.g. Python 3.6 with Django 2.2):
118+
To run tests for a specific environment (e.g. Python 3.12 with Django 5.0):
119119

120-
export TESTNAME=; tox -e py36-django22
120+
export TESTNAME=; tox -e py312-django50
121121

122122
To run a specific test:
123123

124-
export TESTNAME=.test_adding_file; tox -e py36-django22
124+
export TESTNAME=.test_adding_file; tox -e py312-django50
125125

126126
To build and deploy a versioned package to PyPI, verify [all unittests are passing](https://travis-ci.com/kimetrica/django-binary-database-files/), then increase (and commit) the version number in `binary_database_files/__init__.py` and then run:
127127

binary_database_files/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = (1, 0, 17, "post1")
1+
VERSION = (1, 0, 18)
22
__version__ = ".".join(map(str, VERSION))
33

44
default_app_config = "binary_database_files.apps.DatabaseFilesAppConfig"

binary_database_files/management/commands/database_files_cleanup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
from django.apps import apps
12
from django.conf import settings
23
from django.core.files.storage import default_storage
34
from django.core.management.base import BaseCommand
45
from django.db.models import FileField, ImageField
5-
from django.apps import apps
66

77
from binary_database_files.models import File
88

binary_database_files/management/commands/database_files_load.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import os
22

3+
from django.apps import apps
34
from django.conf import settings
45
from django.core.management.base import BaseCommand
56
from django.db.models import FileField, ImageField
6-
from django.apps import apps
77

88

99
class Command(BaseCommand):

binary_database_files/migrations/0001_initial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generated by Django 1.9.1 on 2016-10-11 18:11
2-
from django.db import migrations, models
32
import django.utils.timezone
3+
from django.db import migrations, models
44

55

66
class Migration(migrations.Migration):

binary_database_files/models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from django.conf import settings
22
from django.db import models
3-
from django.utils import timezone
4-
53
from django.db.models import BinaryField
4+
from django.utils import timezone
65

76
from binary_database_files import utils
8-
from binary_database_files.utils import write_file, is_fresh
97
from binary_database_files.manager import FileManager
8+
from binary_database_files.utils import is_fresh, write_file
109

1110

1211
class File(models.Model):

binary_database_files/storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""Custom storage backend that stores files in the database to facilitate scaling."""
22
import os
3-
from io import UnsupportedOperation, BytesIO
3+
from io import BytesIO, UnsupportedOperation
44

55
from django.conf import settings
66
from django.core import files
77
from django.core.files.storage import FileSystemStorage
88
from django.utils._os import safe_join
99

1010
from binary_database_files import models
11-
from binary_database_files import utils
1211
from binary_database_files import settings as _settings
12+
from binary_database_files import utils
1313

1414

1515
class DatabaseFile(files.File):

binary_database_files/tests/tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1+
import base64
12
import functools
23
import os
34
import shutil
45
import tempfile
5-
import base64
66
from io import BytesIO
77
from zipfile import ZipFile
88

99
from django.conf import settings
1010
from django.core import files
1111
from django.core.files import File as DjangoFile
12+
from django.core.files.base import ContentFile
1213
from django.core.files.storage import default_storage
1314
from django.core.files.temp import NamedTemporaryFile
1415
from django.core.management import call_command
1516
from django.db import models
1617
from django.test import TestCase, override_settings
17-
from django.core.files.base import ContentFile
1818

19+
from binary_database_files import utils
1920
from binary_database_files.models import File
2021
from binary_database_files.storage import DatabaseStorage
2122
from binary_database_files.tests.models import Thing
22-
from binary_database_files import utils
2323

2424
DIR = os.path.abspath(os.path.split(__file__)[0])
2525

binary_database_files/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.urls import re_path
2+
23
from binary_database_files import views
34

45
urlpatterns = [

binary_database_files/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import os
21
import hashlib
2+
import os
33

44
from django.conf import settings
5+
56
from binary_database_files import settings as _settings
67

78

binary_database_files/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from django.views.decorators.cache import cache_control
77
from django.views.static import serve as django_serve
88

9-
from binary_database_files.models import File
109
from binary_database_files import settings as _settings
10+
from binary_database_files.models import File
1111

1212

1313
@cache_control(max_age=86400)

lint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
ruff binary_database_files
3+
black --check binary_database_files
4+
isort --check binary_database_files

pep8.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

pip-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Django>=2.2,<5
1+
Django>=2.2,<6

pyproject.toml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
[tool.ruff]
2+
line-length = 119 # Allow longer lines for ruff than black and isort, for comments and docstrings
3+
target-version = 'py310'
4+
exclude = [
5+
'.eggs', # exclude a few common directories in the
6+
'.git', # root of the project
7+
'.history',
8+
'.hg',
9+
'.mypy_cache',
10+
'.tox',
11+
'.venv',
12+
'_build',
13+
'migrations',
14+
'node_modules',
15+
'buck-out',
16+
'build',
17+
'builds',
18+
'dist',
19+
]
20+
21+
[tool.ruff.mccabe]
22+
# Unlike Flake8, default to a complexity level of 10.
23+
max-complexity = 10
24+
25+
[tool.ruff.flake8-quotes]
26+
docstring-quotes = "double"
27+
28+
[tool.black]
29+
line-length = 88
30+
target-version = ['py310']
31+
include = '\.pyi?$'
32+
exclude = '''
33+
(
34+
/(
35+
\.eggs # exclude a few common directories in the
36+
| \.git # root of the project
37+
| \.history
38+
| \.hg
39+
| \.mypy_cache
40+
| .ruff_cache
41+
| \.tox
42+
| \.venv
43+
| _build
44+
| node_modules
45+
| buck-out
46+
| build
47+
| dist
48+
)/
49+
)
50+
'''
51+
52+
[tool.isort]
53+
profile = "black"
54+
src_paths = ["binary_database_files"]
55+
line_length = 88

setup.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
#!/usr/bin/env python
22
import io
33
import os
4-
from setuptools import setup, find_packages
4+
5+
from setuptools import find_packages, setup
56

67
import binary_database_files
78

89
CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
910
DESCRIPTION = (
1011
"A storage system for Django that stores uploaded files in both the "
1112
"database and file system."
12-
"Upstream: https://pypi.org/project/django-binary-database-files/ ."
13-
"+Python 3.1x."
1413
)
1514

1615

@@ -32,7 +31,7 @@ def get_reqs(*fns):
3231
long_description = DESCRIPTION
3332

3433
setup(
35-
name="django-binary-database-files-dimaqq-py31x",
34+
name="django-binary-database-files",
3635
version=binary_database_files.__version__,
3736
description=DESCRIPTION,
3837
long_description=long_description,
@@ -48,21 +47,21 @@ def get_reqs(*fns):
4847
"License :: OSI Approved :: BSD License",
4948
"Operating System :: OS Independent",
5049
"Programming Language :: Python",
51-
"Programming Language :: Python :: 3.6",
52-
"Programming Language :: Python :: 3.7",
5350
"Programming Language :: Python :: 3.8",
5451
"Programming Language :: Python :: 3.9",
5552
"Programming Language :: Python :: 3.10",
5653
"Programming Language :: Python :: 3.11",
54+
"Programming Language :: Python :: 3.12",
5755
"Framework :: Django :: 2.2",
5856
"Framework :: Django :: 3.0",
5957
"Framework :: Django :: 3.1",
6058
"Framework :: Django :: 3.2",
6159
"Framework :: Django :: 4.0",
60+
"Framework :: Django :: 5.0",
6261
],
6362
install_requires=get_reqs(
6463
"pip-requirements.txt",
6564
),
6665
tests_require=get_reqs("pip-requirements-test.txt"),
67-
python_requires=">=3.6,<4",
66+
python_requires=">=3.6,<3.13",
6867
)

tox.ini

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,30 @@ ignore = W503, E203 # See https://github.com/PyCQA/pycodestyle/issues/373
44
max-line-length=160
55

66
[tox]
7-
envlist = py{36,37}-django{22},py{36,37,38}-django{30},py{36,37,38,39,310,311}-django{31},py{36,37,38,39,310,311}-django{32},py{38,39,310,311}-django{40}
7+
envlist = py{38,39,310,311,312}-django{32,40},py{310,311,312}-django{50}
88
recreate = True
99

1010
[gh-actions]
1111
python =
12-
3.6: py36
13-
3.7: py37
1412
3.8: py38
1513
3.9: py39
1614
3.10: py310
1715
3.11: py311
16+
3.12: py312
1817

1918
[testenv]
2019
basepython =
21-
py36: python3.6
22-
py37: python3.7
2320
py38: python3.8
2421
py39: python3.9
2522
py310: python3.10
2623
py311: python3.11
24+
py312: python3.12
2725
deps =
2826
-r{toxinidir}/pip-requirements-test.txt
2927
django22: Django>=2.2,<2.3
3028
django30: Django>=3.0,<3.1
3129
django31: Django>=3.1,<3.2
3230
django32: Django>=3.2,<3.3
33-
django40: Django>=4.0,<4.1
31+
django40: Django>=4.0,<5.0
32+
django50: Django>=5.0,<6.0
3433
commands = django-admin test --traceback --pythonpath=. --settings=binary_database_files.tests.settings binary_database_files.tests.tests.DatabaseFilesTestCase{env:TESTNAME:}

0 commit comments

Comments
 (0)