1
0
Fork 0

Migrate to Python 3

This also includes a refresh of the requirements after the Python3
transition.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
merge-requests/879/head
Fabian P. Schmidt 2020-01-08 22:01:10 +01:00 committed by Alfredos-Panagiotis Damkalis
parent 2e906cfe31
commit 9bed67a4fd
8 changed files with 44 additions and 102 deletions

View File

@ -2,8 +2,7 @@ variables:
GITLAB_CI_IMAGE_ALPINE: 'alpine:3.9' GITLAB_CI_IMAGE_ALPINE: 'alpine:3.9'
GITLAB_CI_IMAGE_DOCKER: 'docker:18.09' GITLAB_CI_IMAGE_DOCKER: 'docker:18.09'
GITLAB_CI_IMAGE_NODE: 'node:12.13.1' GITLAB_CI_IMAGE_NODE: 'node:12.13.1'
GITLAB_CI_IMAGE_PYTHON2: 'python:2' GITLAB_CI_IMAGE_PYTHON: 'python:3'
GITLAB_CI_IMAGE_PYTHON3: 'python:3'
GITLAB_CI_PYPI_DOCKER_COMPOSE: 'docker-compose~=1.23.0' GITLAB_CI_PYPI_DOCKER_COMPOSE: 'docker-compose~=1.23.0'
GITLAB_CI_PYPI_TOX: 'tox~=3.8.0' GITLAB_CI_PYPI_TOX: 'tox~=3.8.0'
stages: stages:
@ -25,21 +24,14 @@ static_js_css:
- network/static/lib - network/static/lib
static_python: static_python:
stage: static stage: static
image: ${GITLAB_CI_IMAGE_PYTHON2} image: ${GITLAB_CI_IMAGE_PYTHON}
before_script: before_script:
- pip install "$GITLAB_CI_PYPI_TOX" - pip install "$GITLAB_CI_PYPI_TOX"
script: script:
- tox -e "py2-flake8,isort,yapf,py2-pylint" - tox -e "flake8,isort,yapf,pylint"
static_python3:
stage: static
image: ${GITLAB_CI_IMAGE_PYTHON3}
before_script:
- pip install "$GITLAB_CI_PYPI_TOX"
script:
- tox -e "py3-flake8,py3-pylint"
docs: docs:
stage: build stage: build
image: ${GITLAB_CI_IMAGE_PYTHON3} image: ${GITLAB_CI_IMAGE_PYTHON}
before_script: before_script:
- pip install "$GITLAB_CI_PYPI_TOX" - pip install "$GITLAB_CI_PYPI_TOX"
script: script:
@ -52,18 +44,7 @@ docs:
- docs/_build/html - docs/_build/html
build: build:
stage: build stage: build
image: ${GITLAB_CI_IMAGE_PYTHON2} image: ${GITLAB_CI_IMAGE_PYTHON}
script:
- rm -rf dist
- python setup.py sdist bdist_wheel
artifacts:
expire_in: 1 week
when: always
paths:
- dist
build3:
stage: build
image: ${GITLAB_CI_IMAGE_PYTHON3}
script: script:
- rm -rf dist - rm -rf dist
- python setup.py sdist bdist_wheel - python setup.py sdist bdist_wheel
@ -74,22 +55,13 @@ build3:
- dist - dist
test: test:
stage: test stage: test
image: ${GITLAB_CI_IMAGE_PYTHON2} image: ${GITLAB_CI_IMAGE_PYTHON}
before_script: before_script:
- pip install "$GITLAB_CI_PYPI_TOX" - pip install "$GITLAB_CI_PYPI_TOX"
- apt-get update - apt-get update
- apt-get install -y ruby-sass - apt-get install -y ruby-sass
script: script:
- tox -e deps,py2-pytest - tox -e deps,pytest
test3:
stage: test
image: ${GITLAB_CI_IMAGE_PYTHON3}
before_script:
- pip install "$GITLAB_CI_PYPI_TOX"
- apt-get update
- apt-get install -y ruby-sass
script:
- tox -e deps,py3-pytest
docker: docker:
stage: deploy stage: deploy
image: ${GITLAB_CI_IMAGE_DOCKER} image: ${GITLAB_CI_IMAGE_DOCKER}

View File

@ -1,12 +0,0 @@
[MASTER]
ignore=_version.py,migrations
load-plugins=pylint_django
ignored-argument-names=args|kwargs
[MESSAGES CONTROL]
disable=
E1121, # too-many-function-args
R0801, # needs to remain disabled see https://github.com/PyCQA/pylint/issues/214
R0912, # too-many-branches
R0913, # too-many-arguments
R0914, # too-many-locals

View File

@ -1,4 +1,4 @@
FROM python:2 FROM python:3
MAINTAINER SatNOGS project <dev@satnogs.org> MAINTAINER SatNOGS project <dev@satnogs.org>
WORKDIR /workdir/ WORKDIR /workdir/

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-01-10 19:48
from __future__ import unicode_literals
import django.contrib.auth.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20160922_1505'),
]
operations = [
migrations.AlterField(
model_name='user',
name='username',
field=models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username'),
),
]

View File

@ -5,23 +5,20 @@
-r requirements.txt -r requirements.txt
apipkg==1.5 apipkg==1.5
atomicwrites==1.3.0
attrs==19.3.0 attrs==19.3.0
coverage==5.0.1 coverage==5.0.2
execnet==1.7.1 execnet==1.7.1
factory-boy==2.11.1 factory-boy==2.11.1
Faker==0.8.18 Faker==0.8.18
filelock==3.0.12 filelock==3.0.12
funcsigs==1.0.2
ipaddress==1.0.23
mock==2.0.0 mock==2.0.0
packaging==19.2 packaging==20.0
pbr==5.4.4 pbr==5.4.4
pluggy==0.13.1 pluggy==0.13.1
pur==5.2.2 pur==5.2.2
py==1.8.1 py==1.8.1
pyparsing==2.4.6 pyparsing==2.4.6
pytest==4.6.8 pytest==5.3.2
pytest-cov==2.6.1 pytest-cov==2.6.1
pytest-django==3.4.8 pytest-django==3.4.8
pytest-forked==0.2 pytest-forked==0.2

View File

@ -12,8 +12,8 @@ certifi==2019.11.28
chardet==3.0.4 chardet==3.0.4
Click==7.0 Click==7.0
clint==0.5.1 clint==0.5.1
configparser==4.0.2
contextlib2==0.5.5 contextlib2==0.5.5
defusedxml==0.6.0
dj-database-url==0.5.0 dj-database-url==0.5.0
Django==1.11.27 Django==1.11.27
django-allauth==0.35.0 django-allauth==0.35.0
@ -32,7 +32,6 @@ django-shortuuidfield==0.1.3
djangorestframework==3.7.7 djangorestframework==3.7.7
dnspython==1.16.0 dnspython==1.16.0
docopt==0.6.2 docopt==0.6.2
enum34==1.1.6
ephem==3.7.7.0 ephem==3.7.7.0
eventlet==0.25.1 eventlet==0.25.1
future==0.18.2 future==0.18.2
@ -46,15 +45,14 @@ jsonpointer==2.0
kombu==4.6.7 kombu==4.6.7
Markdown==2.6.11 Markdown==2.6.11
monotonic==1.5 monotonic==1.5
more-itertools==5.0.0 more-itertools==8.0.2
mysqlclient==1.3.14 mysqlclient==1.3.14
oauthlib==3.1.0 oauthlib==3.1.0
pathlib2==2.3.5
Pillow==5.0.0 Pillow==5.0.0
PyJWT==1.7.1 PyJWT==1.7.1
python-decouple==3.1 python-decouple==3.1
python-dotenv==0.6.5 python-dotenv==0.6.5
python-openid==2.2.5 python3-openid==3.1.0
pytz==2019.3 pytz==2019.3
rcssmin==1.0.6 rcssmin==1.0.6
redis==3.3.11 redis==3.3.11
@ -62,7 +60,6 @@ requests==2.22.0
requests-oauthlib==1.3.0 requests-oauthlib==1.3.0
rjsmin==1.0.12 rjsmin==1.0.12
satellitetle==0.8.1 satellitetle==0.8.1
scandir==1.10.0
schema==0.7.1 schema==0.7.1
sentry-sdk==0.7.14 sentry-sdk==0.7.14
sgp4==1.4 sgp4==1.4

View File

@ -13,7 +13,7 @@ classifiers =
License :: OSI Approved :: GNU Affero General Public License v3 License :: OSI Approved :: GNU Affero General Public License v3
Operating System :: POSIX :: Linux Operating System :: POSIX :: Linux
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 2.7 Programming Language :: Python :: 3
Topic :: Communications :: Ham Radio Topic :: Communications :: Ham Radio
Topic :: Internet :: WWW/HTTP Topic :: Internet :: WWW/HTTP
Topic :: Internet :: WWW/HTTP :: Dynamic Content Topic :: Internet :: WWW/HTTP :: Dynamic Content

49
tox.ini
View File

@ -1,17 +1,15 @@
[tox] [tox]
envlist = py2-flake8,isort,yapf,py2-pylint,py-pylint-py3k,{py2,py3}-build,py2-pytest,docs envlist = flake8,isort,yapf,pylint,build,pytest,docs
[depversions] [depversions]
flake8 = 3.7.8 flake8 = 3.7.8
isort = 4.3.18 isort = 4.3.18
yapf = 0.28.0 yapf = 0.28.0
pylint = 1.9.5 pylint = 2.3.1
pylint3 = 2.3.1 pylint_django = 2.0.11
pylint_django = 0.11.1
pylint_django3 = 2.0.11
sphinx_rtd_theme = 0.4.3 sphinx_rtd_theme = 0.4.3
[testenv:py2-flake8] [testenv:flake8]
deps = deps =
flake8=={[depversions]flake8} flake8=={[depversions]flake8}
skip_install = True skip_install = True
@ -39,39 +37,16 @@ deps =
skip_install = True skip_install = True
commands = yapf -i -r . commands = yapf -i -r .
[testenv:py2-pylint] [testenv:pylint]
deps = deps =
pylint=={[depversions]pylint} pylint=={[depversions]pylint}
pylint-django=={[depversions]pylint_django} pylint-django=={[depversions]pylint_django}
extras = dev extras = dev
commands = pylint\ commands = pylint \
{envsitepackagesdir}/network \ {envsitepackagesdir}/network \
{envsitepackagesdir}/auth0login {envsitepackagesdir}/auth0login
[testenv:py2-pylint-py3k] [testenv:build]
deps =
pylint=={[depversions]pylint}
pylint-django=={[depversions]pylint_django}
extras = dev
commands = pylint --py3k\
{envsitepackagesdir}/network \
{envsitepackagesdir}/auth0login
[testenv:py3-pylint]
deps =
pylint=={[depversions]pylint3}
pylint-django=={[depversions]pylint_django3}
extras = dev
commands = pylint --rcfile=.pylintrc3 \
{envsitepackagesdir}/network \
{envsitepackagesdir}/auth0login
[testenv:py2-build]
skip_install = True
commands =
python setup.py sdist bdist_wheel
[testenv:py3-build]
skip_install = True skip_install = True
commands = commands =
python setup.py sdist bdist_wheel python setup.py sdist bdist_wheel
@ -91,15 +66,7 @@ deps =
extras = dev extras = dev
commands = pip check commands = pip check
[testenv:py2-pytest] [testenv:pytest]
install_command = python -m pip install --no-deps {opts} {packages}
deps =
-rrequirements-dev.txt
usedevelop = True
extras = dev
commands = pytest
[testenv:py3-pytest]
install_command = python -m pip install --no-deps {opts} {packages} install_command = python -m pip install --no-deps {opts} {packages}
deps = deps =
-rrequirements-dev.txt -rrequirements-dev.txt