Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for up to Django 3.1 & Python 3.9 #68

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy

on:
push:
branches:
- master
release:
types:
- published

jobs:
deploy:
if: github.repository == 'jazzband/django-redshift-backend'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: deploy-${{ hashFiles('**/setup.py') }}
restore-keys: |
deploy-
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools twine wheel

- name: Build package
run: |
python setup.py --version
python setup.py sdist --format=gztar bdist_wheel
twine check dist/*

- name: Publish package to Jazzband
if: github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@master

with:
user: jazzband
password: ${{ secrets.JAZZBAND_RELEASE_KEY }}
repository_url: https://jazzband.co/projects/django-redshift-backend/upload
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
linter:
- flake8
- readme

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U tox
- run: tox -e ${{ matrix.linter }}
79 changes: 79 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Test

on: [push, pull_request]

env:
FORCE_COLOR: 1

jobs:
tests:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
python: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9"]
django: ["1.11", "2.0", "2.1", "2.2", "3.0", "3.1"]
# TODO: test on mac OS & windows?
os: [ubuntu-latest]
exclude:
- django: "2.0"
python: "2.7"
- django: "2.1"
python: "2.7"
- django: "2.2"
python: "2.7"
- django: "3.0"
python: "2.7"
- django: "3.1"
python: "2.7"

- django: "3.0"
python: "3.5"
- django: "3.1"
python: "3.5"

- django: "1.11"
python: "3.8"
- django: "2.0"
python: "3.8"
- django: "2.1"
python: "3.8"

- django: "1.11"
python: "3.9"
- django: "2.0"
python: "3.9"
- django: "2.1"
python: "3.9"

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"

- uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ matrix.os }}-${{ matrix.python }}-${{ matrix.django }}-v1-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.python }}-${{ matrix.django }}-v1-

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U tox tox-gh-actions

- name: Tox tests
shell: bash
run: tox
env:
DJANGO: ${{ matrix.django }}
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ This is a `Amazon Redshift`_ database backend for Django_.
:alt: License
:target: https://github.com/jazzband/django-redshift-backend/blob/master/LICENSE

.. image:: https://img.shields.io/travis/jazzband/django-redshift-backend/master.svg
:alt: Travis (.org) branch
:target: https://travis-ci.org/jazzband/django-redshift-backend
.. image:: https://img.shields.io/github/workflow/status/jazzband/django-redshift-backend/Test/master
:alt: Tests
:target: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ATest

.. image:: https://img.shields.io/github/stars/jazzband/django-redshift-backend.svg?style=social&label=Stars
:alt: GitHub stars
Expand Down
6 changes: 3 additions & 3 deletions checklist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Procedure:

1. check travis-ci testing result: https://travis-ci.org/jazzband/django-redshift-backend
1. check CI status testing result: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ACI
2. update release version/date in ``CHANGES.rst``
3. tagging with version name that MUST following semver. e.g.: ``git tag 1.0.1``
4. ``git push --tags`` to invoke release process on travis-ci.
3. create Github release, tagging with version name that MUST following semver. e.g.: ``git tag 1.0.1``
4. publish Github release to invoke release process in Github Actions.
5. approve release files. please check your email or https://jazzband.co/projects/django-redshift-backend
6. check PyPI page: https://pypi.org/p/django-redshift-backend
7. bump version in ``CHANGES.rst`` and commit/push them onto GitHub
Expand Down
34 changes: 23 additions & 11 deletions django_redshift_backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,26 @@
from django.conf import settings
from django.core.exceptions import FieldDoesNotExist
from django.db.backends.base.validation import BaseDatabaseValidation
from django.db.backends.postgresql_psycopg2.base import (
DatabaseFeatures as BasePGDatabaseFeatures,
DatabaseWrapper as BasePGDatabaseWrapper,
DatabaseOperations as BasePGDatabaseOperations,
DatabaseSchemaEditor as BasePGDatabaseSchemaEditor,
DatabaseClient,
DatabaseCreation as BasePGDatabaseCreation,
DatabaseIntrospection,
)
try:
from django.db.backends.postgresql.base import (
DatabaseFeatures as BasePGDatabaseFeatures,
DatabaseWrapper as BasePGDatabaseWrapper,
DatabaseOperations as BasePGDatabaseOperations,
DatabaseSchemaEditor as BasePGDatabaseSchemaEditor,
DatabaseClient,
DatabaseCreation as BasePGDatabaseCreation,
DatabaseIntrospection,
)
except ImportError:
from django.db.backends.postgresql_psycopg2.base import (
DatabaseFeatures as BasePGDatabaseFeatures,
DatabaseWrapper as BasePGDatabaseWrapper,
DatabaseOperations as BasePGDatabaseOperations,
DatabaseSchemaEditor as BasePGDatabaseSchemaEditor,
DatabaseClient,
DatabaseCreation as BasePGDatabaseCreation,
DatabaseIntrospection,
)
from django.db.utils import NotSupportedError

from django_redshift_backend.distkey import DistKey
Expand Down Expand Up @@ -92,8 +103,9 @@ def distinct_sql(self, fields, *args):
if fields:
# https://github.com/jazzband/django-redshift-backend/issues/14
# Redshift doesn't support DISTINCT ON
raise NotSupportedError('DISTINCT ON fields is not supported '
'by this database backend')
raise NotSupportedError(
'DISTINCT ON fields is not supported by this database backend'
)
return super(DatabaseOperations, self).distinct_sql(fields, *args)


Expand Down
4 changes: 2 additions & 2 deletions doc/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ tox have several sections for testing.
CI (Continuous Integration)
----------------------------

All tests will be run on Travis CI service.
All tests will be run on Github Actions:

* https://travis-ci.org/jazzband/django-redshift-backend
* https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ATest


Pull Request
Expand Down
10 changes: 5 additions & 5 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ This is a `Amazon Redshift`_ database backend for Django_.
:alt: License
:target: https://github.com/jazzband/django-redshift-backend/blob/master/LICENSE

.. image:: https://img.shields.io/travis/jazzband/django-redshift-backend/master.svg
:alt: Travis (.org) branch
:target: https://travis-ci.org/jazzband/django-redshift-backend
.. image:: https://img.shields.io/github/workflow/status/jazzband/django-redshift-backend/Test/master
:alt: Tests
:target: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ATest

.. image:: https://img.shields.io/github/stars/jazzband/django-redshift-backend.svg?style=social&label=Stars
:alt: GitHub stars
Expand All @@ -43,8 +43,8 @@ Support versions

This product is tested with:

* Python-2.7, 3.5, 3.6
* Django-1.11, 2.0
* Python-2.7, 3.5, 3.6, 37, 38 and 3.9
* Django-1.11, 2.0, 2.1, 2.2, 3.0, 3.1

License
=======
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ def read(filename):
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Framework :: Django',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',
'Intended Audience :: Developers',
'Environment :: Plugins',
'Topic :: Software Development :: Libraries :: Python Modules',
Expand Down
15 changes: 13 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,40 @@ envlist =
py{27,35,36}-dj111,
py{35,36,37}-dj20,
py{35,36,37}-dj21,
py{35,36,37,38,39}-dj22,
py{36,37,38,39}-dj30,
py{36,37,38,39}-dj31,
flake8,
isort,
readme
skipsdist = True

[travis]
[gh-actions]
python =
2.7: py27
3.5: py35
3.6: py36,flake8,readme
3.7: py37
3.8: py38
3.9: py39

[travis:env]
[gh-actions:env]
DJANGO =
1.11: dj111
2.0: dj20
2.1: dj21
2.2: dj22
3.0: dj30
3.1: dj31

[testenv]
deps =
dj111: Django>=1.11,<1.12
dj20: Django>=2.0,<2.1
dj21: Django>=2.1,<2.2
dj22: Django>=2.2,<3.0
dj30: Django>=3.0,<3.1
dj31: Django>=3.1,<3.2
djmaster: https://github.com/django/django/archive/master.tar.gz
-rtest-requires.txt
setenv =
Expand Down