Skip to content

Commit

Permalink
Django 41x (#166)
Browse files Browse the repository at this point in the history
* Drop support for Django 3.1
* Support Django up to 4.1
* Add support for Python 3.11
* Release v1.8.0
  • Loading branch information
r4fek authored Feb 2, 2023
1 parent 1fc5932 commit 563348c
Show file tree
Hide file tree
Showing 15 changed files with 617 additions and 557 deletions.
51 changes: 18 additions & 33 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,43 +1,28 @@
[flake8]
max-line-length = 88
max-complexity = 42
# http://flake8.pycqa.org/en/2.5.5/warnings.html#warning-error-codes
ignore =
# pydocstyle - docstring conventions (PEP257)
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__
D403 # First word of the first line should be properly capitalized
D412 # No blank lines allowed between a section header and its content
# pycodestyle - style checker (PEP8)
W503 # line break before binary operator
# the following are ignored in CI using --extend-ignore option:
D205 # [pydocstyle] 1 blank line required between summary line and description
D400 # [pydocstyle] First line should end with a period
S404 # Consider possible security implications associated with the subprocess module.
S603 # subprocess call - check for execution of untrusted input.
D401 # [pydocstyle] First line should be in imperative mood
; S308 # [bandit] Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
; S703 # [bandit] Potential XSS on mark_safe function.
S101 # use of assert

D100
D101
D102
D103
D104
D105
D106
D107
D403
D412
W503
D205
D400
S404
S603
D401
S101

per-file-ignores =
; 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
; S101 # use of assert
; S106 - hard-coded password
; E501 - line-length
; E731 - assigning a lambda to a variable
*tests/*:D205,D400,D401,S101,S106,E501,E731
*/migrations/*:E501
; F403 - unable to detect undefined names
; F405 - may be undefined, or defined from star imports
*/settings.py:F403,F405
*/settings/*:F403,F405
*/compat.py:F401
18 changes: 9 additions & 9 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:

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

- name: Set up Python 3.9
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"

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

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

services:
cassandra:
image: cassandra:3.11.11
image: scylladb/scylla:5.1.2
ports:
- 9042:9042
steps:
- name: Check out the repository
uses: actions/checkout@v2
uses: actions/checkout@v3

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

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2022, Rafał Furmański <[email protected]>
Copyright (c) 2014-2023, Rafał Furmański <[email protected]>
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ To connect to a hosted Cassandra cluster that provides a secure connection bundl
The documentation can be found online [here](http://r4fek.github.io/django-cassandra-engine/).

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

All rights reserved. Licensed under BSD 2-Clause License.
1 change: 0 additions & 1 deletion django_cassandra_engine/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class NotSupportedError(DatabaseError):


class DatabaseWrapper(BaseDatabaseWrapper):

Database = Database
vendor = "cassandra"

Expand Down
8 changes: 4 additions & 4 deletions django_cassandra_engine/base/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ def create_test_db(self, verbosity=1, autoclobber=False, **kwargs):
if verbosity >= 2:
test_db_repr = " ('%s')" % test_database_name
logger.info(
"Creating test database for alias '%s'%s..."
% (self.connection.alias, test_db_repr)
"Creating test database for alias '%s'%s...",
self.connection.alias,
test_db_repr,
)

options = self.connection.settings_dict.get("OPTIONS", {})
Expand Down Expand Up @@ -76,7 +77,7 @@ def create_test_db(self, verbosity=1, autoclobber=False, **kwargs):
# restore the original connection options
if not connection_options_copy.get("schema_metadata_enabled", True):
logger.info(
"Disabling metadata on %s" % self.connection.settings_dict["NAME"]
"Disabling metadata on %s", self.connection.settings_dict["NAME"]
)
options["connection"]["schema_metadata_enabled"] = connection_options_copy[
"schema_metadata_enabled"
Expand All @@ -87,7 +88,6 @@ def create_test_db(self, verbosity=1, autoclobber=False, **kwargs):
return test_database_name

def _destroy_test_db(self, test_database_name, verbosity=1, **kwargs):

drop_keyspace(test_database_name, connections=[self.connection.alias])

def set_models_keyspace(self, keyspace):
Expand Down
6 changes: 6 additions & 0 deletions django_cassandra_engine/base/features.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from functools import cached_property

from django.db.backends.base.features import BaseDatabaseFeatures


Expand All @@ -10,3 +12,7 @@ class CassandraDatabaseFeatures(BaseDatabaseFeatures):
uses_savepoints = False
requires_rollback_on_dirty_transaction = False
atomic_transactions = True

@cached_property
def supports_transactions(self):
return False
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def sync(self, alias):
management.sync_table(model, keyspaces=[keyspace], connections=[alias])

def handle(self, **options):

self._import_management()

database = options.get("database")
Expand Down
2 changes: 1 addition & 1 deletion django_cassandra_engine/rest/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_field_kwargs(self, field_name, model_field):
if model_field.has_default or model_field.blank or model_field.null:
kwargs["required"] = False

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

if model_field.blank and (
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Django Cassandra Engine - CHANGELOG

## Version 1.8.0 (02.02.2023)

* Drop support for Django 3.1
* Support Django up to 4.1
* Add support for Python 3.11

## Version 1.7.0 (11.01.2022)

* Fix(command/dbshell): Avoid raise TypeError when django-3.2 pass `options['parameters']` (#154) - thanks @icycandle!
Expand Down
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ site_description: Apache Cassandra Database Wrapper for Django
site_url: https://r4fek.github.io/django-cassandra-engine
site_author: Rafał Furmański

copyright: Copyright 2014-2021, <a href="https://linkedin.com/in/furmanski" title="Rafał Furmański" target="_blank">Rafał Furmański</a>
copyright: Copyright 2014-2023, <a href="https://linkedin.com/in/furmanski" title="Rafał Furmański" target="_blank">Rafał Furmański</a>
theme: material
google_analytics: ['UA-38726443-3', 'auto']

Expand All @@ -12,7 +12,7 @@ repo_url: https://github.com/r4fek/django-cassandra-engine

# Options
extra:
version: 1.7.0
version: 1.8.0
logo: images/dj_cassandra.png
author:
github: r4fek
Expand Down
Loading

0 comments on commit 563348c

Please sign in to comment.