Skip to content

Commit 563348c

Browse files
authored
Django 41x (#166)
* Drop support for Django 3.1 * Support Django up to 4.1 * Add support for Python 3.11 * Release v1.8.0
1 parent 1fc5932 commit 563348c

File tree

15 files changed

+617
-557
lines changed

15 files changed

+617
-557
lines changed

.flake8

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,28 @@
11
[flake8]
22
max-line-length = 88
33
max-complexity = 42
4-
# http://flake8.pycqa.org/en/2.5.5/warnings.html#warning-error-codes
54
ignore =
6-
# pydocstyle - docstring conventions (PEP257)
7-
D100 # Missing docstring in public module
8-
D101 # Missing docstring in public class
9-
D102 # Missing docstring in public method
10-
D103 # Missing docstring in public function
11-
D104 # Missing docstring in public package
12-
D105 # Missing docstring in magic method
13-
D106 # Missing docstring in public nested class
14-
D107 # Missing docstring in __init__
15-
D403 # First word of the first line should be properly capitalized
16-
D412 # No blank lines allowed between a section header and its content
17-
# pycodestyle - style checker (PEP8)
18-
W503 # line break before binary operator
19-
# the following are ignored in CI using --extend-ignore option:
20-
D205 # [pydocstyle] 1 blank line required between summary line and description
21-
D400 # [pydocstyle] First line should end with a period
22-
S404 # Consider possible security implications associated with the subprocess module.
23-
S603 # subprocess call - check for execution of untrusted input.
24-
D401 # [pydocstyle] First line should be in imperative mood
25-
; S308 # [bandit] Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
26-
; S703 # [bandit] Potential XSS on mark_safe function.
27-
S101 # use of assert
28-
5+
D100
6+
D101
7+
D102
8+
D103
9+
D104
10+
D105
11+
D106
12+
D107
13+
D403
14+
D412
15+
W503
16+
D205
17+
D400
18+
S404
19+
S603
20+
D401
21+
S101
22+
2923
per-file-ignores =
30-
; D205 - 1 blank line required between summary line and description
31-
; D400 - First line should end with a period
32-
; D401 - First line should be in imperative mood
33-
; S101 # use of assert
34-
; S106 - hard-coded password
35-
; E501 - line-length
36-
; E731 - assigning a lambda to a variable
3724
*tests/*:D205,D400,D401,S101,S106,E501,E731
3825
*/migrations/*:E501
39-
; F403 - unable to detect undefined names
40-
; F405 - may be undefined, or defined from star imports
4126
*/settings.py:F403,F405
4227
*/settings/*:F403,F405
4328
*/compat.py:F401

.github/workflows/tox.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ jobs:
2020

2121
steps:
2222
- name: Check out the repository
23-
uses: actions/checkout@v2
23+
uses: actions/checkout@v3
2424

25-
- name: Set up Python 3.9
26-
uses: actions/setup-python@v2
25+
- name: Set up Python 3.10
26+
uses: actions/setup-python@v4
2727
with:
28-
python-version: 3.9
28+
python-version: "3.10"
2929

3030
- name: Install and run tox
3131
run: |
@@ -37,23 +37,23 @@ jobs:
3737
runs-on: ubuntu-latest
3838
strategy:
3939
matrix:
40-
python-version: ['3.8', '3.9', '3.10']
41-
django-version: ['30', '31', '32', '40', 'master']
40+
python-version: ['3.8', '3.9', '3.10', '3.11']
41+
django-version: ['32', '40', '4.1']
4242

4343
env:
4444
TOXENV: py${{ matrix.python-version }}-django${{ matrix.django-version }}
4545

4646
services:
4747
cassandra:
48-
image: cassandra:3.11.11
48+
image: scylladb/scylla:5.1.2
4949
ports:
5050
- 9042:9042
5151
steps:
5252
- name: Check out the repository
53-
uses: actions/checkout@v2
53+
uses: actions/checkout@v3
5454

5555
- name: Set up Python ${{ matrix.python-version }}
56-
uses: actions/setup-python@v2
56+
uses: actions/setup-python@v4
5757
with:
5858
python-version: ${{ matrix.python-version }}
5959

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014-2022, Rafał Furmański <r.furmanski@gmail.com>
1+
Copyright (c) 2014-2023, Rafał Furmański <r.furmanski@gmail.com>
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ To connect to a hosted Cassandra cluster that provides a secure connection bundl
102102
The documentation can be found online [here](http://r4fek.github.io/django-cassandra-engine/).
103103

104104
## License ##
105-
Copyright (c) 2014-2022, [Rafał Furmański](https://linkedin.com/in/furmanski).
105+
Copyright (c) 2014-2023, [Rafał Furmański](https://linkedin.com/in/furmanski).
106106

107107
All rights reserved. Licensed under BSD 2-Clause License.

django_cassandra_engine/base/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class NotSupportedError(DatabaseError):
4949

5050

5151
class DatabaseWrapper(BaseDatabaseWrapper):
52-
5352
Database = Database
5453
vendor = "cassandra"
5554

django_cassandra_engine/base/creation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ def create_test_db(self, verbosity=1, autoclobber=False, **kwargs):
3636
if verbosity >= 2:
3737
test_db_repr = " ('%s')" % test_database_name
3838
logger.info(
39-
"Creating test database for alias '%s'%s..."
40-
% (self.connection.alias, test_db_repr)
39+
"Creating test database for alias '%s'%s...",
40+
self.connection.alias,
41+
test_db_repr,
4142
)
4243

4344
options = self.connection.settings_dict.get("OPTIONS", {})
@@ -76,7 +77,7 @@ def create_test_db(self, verbosity=1, autoclobber=False, **kwargs):
7677
# restore the original connection options
7778
if not connection_options_copy.get("schema_metadata_enabled", True):
7879
logger.info(
79-
"Disabling metadata on %s" % self.connection.settings_dict["NAME"]
80+
"Disabling metadata on %s", self.connection.settings_dict["NAME"]
8081
)
8182
options["connection"]["schema_metadata_enabled"] = connection_options_copy[
8283
"schema_metadata_enabled"
@@ -87,7 +88,6 @@ def create_test_db(self, verbosity=1, autoclobber=False, **kwargs):
8788
return test_database_name
8889

8990
def _destroy_test_db(self, test_database_name, verbosity=1, **kwargs):
90-
9191
drop_keyspace(test_database_name, connections=[self.connection.alias])
9292

9393
def set_models_keyspace(self, keyspace):

django_cassandra_engine/base/features.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from functools import cached_property
2+
13
from django.db.backends.base.features import BaseDatabaseFeatures
24

35

@@ -10,3 +12,7 @@ class CassandraDatabaseFeatures(BaseDatabaseFeatures):
1012
uses_savepoints = False
1113
requires_rollback_on_dirty_transaction = False
1214
atomic_transactions = True
15+
16+
@cached_property
17+
def supports_transactions(self):
18+
return False

django_cassandra_engine/management/commands/sync_cassandra.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def sync(self, alias):
8787
management.sync_table(model, keyspaces=[keyspace], connections=[alias])
8888

8989
def handle(self, **options):
90-
9190
self._import_management()
9291

9392
database = options.get("database")

django_cassandra_engine/rest/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def get_field_kwargs(self, field_name, model_field):
7575
if model_field.has_default or model_field.blank or model_field.null:
7676
kwargs["required"] = False
7777

78-
if model_field.null and not isinstance(model_field, models.NullBooleanField):
78+
if model_field.null:
7979
kwargs["allow_null"] = True
8080

8181
if model_field.blank and (

docs/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Django Cassandra Engine - CHANGELOG
22

3+
## Version 1.8.0 (02.02.2023)
4+
5+
* Drop support for Django 3.1
6+
* Support Django up to 4.1
7+
* Add support for Python 3.11
8+
39
## Version 1.7.0 (11.01.2022)
410

511
* Fix(command/dbshell): Avoid raise TypeError when django-3.2 pass `options['parameters']` (#154) - thanks @icycandle!

0 commit comments

Comments
 (0)