Skip to content

Commit

Permalink
Merge pull request #302 from rremizov/drop-python-2-support
Browse files Browse the repository at this point in the history
Drop python 2 support
  • Loading branch information
rremizov committed Aug 17, 2023
2 parents f327ee4 + 36d3f2b commit a6e6662
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 146 deletions.
137 changes: 35 additions & 102 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ name: CI
jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
container: python:${{ matrix.env.python }}-buster
runs-on: ubuntu-20.04

strategy:
matrix:
Expand All @@ -19,103 +18,56 @@ jobs:
- postgresql
- mysql
env:
- python: 2.7
django: 1.11
tox-env: py27-dj111
- python: "3.8"
tox-env: "py38-dj32"
- python: "3.8"
tox-env: "py38-dj40"

- python: 3.6
django: 1.11
tox-env: py36-dj111
- python: 3.6
django: 2.0
tox-env: py36-dj20
- python: 3.6
django: 2.1
tox-env: py36-dj21
- python: 3.6
django: 2.2
tox-env: py36-dj22
- python: 3.6
django: 3.0
tox-env: py36-dj30
- python: 3.6
django: 3.1
tox-env: py36-dj31
- python: "3.9"
tox-env: "py39-dj32"
- python: "3.9"
tox-env: "py39-dj40"

- python: 3.7
django: 1.11
tox-env: py37-dj111
- python: 3.7
django: 2.0
tox-env: py37-dj20
- python: 3.7
django: 2.1
tox-env: py37-dj21
- python: 3.7
django: 2.2
tox-env: py37-dj22
- python: 3.7
django: 3.0
tox-env: py37-dj30
- python: 3.7
django: 3.1
tox-env: py37-dj31
- python: "3.10"
tox-env: "py310-dj32"
- python: "3.10"
tox-env: "py310-dj40"
- python: "3.10"
tox-env: "py310-dj41"

- python: 3.8
django: 1.11
tox-env: py38-dj111
- python: 3.8
django: 2.0
tox-env: py38-dj20
- python: 3.8
django: 2.1
tox-env: py38-dj21
- python: 3.8
django: 2.2
tox-env: py38-dj22
- python: 3.8
django: 3.0
tox-env: py38-dj30
- python: 3.8
django: 3.1
tox-env: py38-dj31
- python: "3.11"
tox-env: "py311-dj41"
- python: "3.11"
tox-env: "py311-dj42"

# - python: 3.9
# django: 1.11
# tox-env: py39-dj111
# - python: 3.9
# django: 2.0
# tox-env: py39-dj20
# - python: 3.9
# django: 2.1
# tox-env: py39-dj21
# - python: 3.9
# django: 2.2
# tox-env: py39-dj22
# - python: 3.9
# django: 3.0
# tox-env: py39-dj30
# - python: 3.9
# django: 3.1
# tox-env: py39-dj31
# - python: "3.12"
# tox-env: "py312-dj41"
# - python: "3.12"
# tox-env: "py312-dj42"

services:
postgres:
image: postgres
env:
POSTGRES_USER: django_random_queryset
POSTGRES_PASSWORD: password
POSTGRES_DB: django_random_queryset
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:5.7
image: mysql
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: django_random_queryset
ports:
- 3306
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
Expand All @@ -127,35 +79,16 @@ jobs:
uses: actions/checkout@v2

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

- name: Install dependencies
run: |
apt-get update
apt-get install --assume-yes python-dev postgresql-client default-mysql-client
- name: Setup Postgres database
run: |
psql -U postgres -h postgres -c "CREATE ROLE django_random_queryset LOGIN SUPERUSER PASSWORD 'password'"
psql -U postgres -h postgres -c "CREATE DATABASE django_random_queryset OWNER django_random_queryset"
env:
PGPASSWORD: password

- name: Setup MySQL database
run: |
mysql -u root -h mysql -e "create user django_random_queryset"
mysql -u root -h mysql -e "grant all on *.* to django_random_queryset"
mysql -h mysql -e "create database django_random_queryset"
- name: Install Tox
run: pip install tox

- name: Run Tox
run: tox -e ${{ matrix.env.tox-env }}
env:
DJANGO: ${{ matrix.env.django }}
POSTGRES_HOST: postgres
MYSQL_HOST: mysql
POSTGRES_HOST: 127.0.0.1
MYSQL_HOST: 127.0.0.1
TEST_DATABASE_ENGINE: ${{ matrix.database_engine }}
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Pull random records using Django ORM.
Requirements
------------

- Python 2.7, 3.6, 3.7
- Python 3.6, 3.7
- Django 1.11, 2.0, 2.1, 2.2.


Expand Down
9 changes: 0 additions & 9 deletions requirements-test-python2

This file was deleted.

9 changes: 0 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Framework :: Django",
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.0",
"Framework :: Django :: 2.1",
"Framework :: Django :: 2.2",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"Topic :: Internet :: WWW/HTTP",
Expand Down
5 changes: 3 additions & 2 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "django_random_queryset",
"USER": "django_random_queryset",
"PASSWORD": "",
"USER": "root",
"PASSWORD": "password",
"HOST": os.environ["MYSQL_HOST"],
"PORT": "3306",
}
}
else:
Expand Down
36 changes: 13 additions & 23 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
[tox]
minversion = 2.7
; https://www.python.org/downloads/
; https://www.djangoproject.com/download/
minversion = 3.6
envlist =
py27-dj{111},
py36-dj{111,20,21,22,30,31},
py37-dj{111,20,21,22,30,31},
py38-dj{111,20,21,22,30,31},
py39-dj{111,20,21,22,30,31},

[travis:env]
DJANGO =
1.11: dj111
2.0: dj20
2.1: dj21
2.2: dj22
3.0: dj30
3.1: dj31
py38-dj{32,40},
py39-dj{32,40},
py310-dj{32,40,41},
py311-dj{41,42},
py312-dj{41,42},

[testenv]
passenv =
Expand All @@ -24,14 +17,11 @@ passenv =
setenv =
DJANGO_SETTINGS_MODULE=tests.settings
deps =
dj111: Django>=1.11,<1.12
dj20: Django>=2.0,<2.1
dj21: Django>=2.1,<2.2
dj22: Django>=2.2,<2.3
dj30: Django>=3.0,<3.1
dj31: Django>=3.1,<3.2
dj32: Django>=3.2,<3.3
dj40: Django>=4.0,<4.1
dj41: Django>=4.1,<4.2
dj42: Django>=4.2,<4.3
djmaster: git+https://github.com/django/django
py{27}: -r {toxinidir}/requirements-test-python2
py{36,37,38,39}: -r {toxinidir}/requirements-test.txt
py{38,39,310,311,312}: -r {toxinidir}/requirements-test.txt
commands =
py.test --benchmark-skip

0 comments on commit a6e6662

Please sign in to comment.