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

TIED-60: Upgrade Python to 3.9, upgrade package versions, add DEFAULT_AUTO_FIELD #341

Merged
merged 7 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion .docker/django/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ==============================
FROM python:3.7 as base
FROM python:3.9 as base
# ==============================

ENV PYTHONDONTWRITEBYTECODE 1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:

strategy:
matrix:
python: [ 3.7 ]
python: [ 3.9 ]

services:
postgres:
image: postgres:10.6
image: postgres:14.7
env:
# Note: not redundant, parent env is not applied to service
POSTGRES_USER: root
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Keep tool versions in sync with the versions in dev-requirements.txt
default_language_version:
python: python3.7
python: python3.9
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand All @@ -15,13 +15,13 @@ repos:
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [pep8-naming, flake8-bugbear]
exclude: "migrations"
- repo: https://github.com/timothycrosley/isort
rev: 5.7.0
rev: 5.12.0
hooks:
- id: isort
exclude: "migrations"
2 changes: 1 addition & 1 deletion docker-compose.yml → compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
postgres:
image: postgres:10.6
image: postgres:14.7
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
Expand Down
54 changes: 17 additions & 37 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#
# This file is autogenerated by pip-compile with Python 3.7
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --resolver=backtracking dev-requirements.in
#
appdirs==1.4.4
# via virtualenv
attrs==22.2.0
# via
# flake8-bugbear
Expand All @@ -20,15 +18,15 @@ click==8.1.3
# via
# black
# pip-tools
coverage[toml]==7.1.0
coverage[toml]==7.2.1
# via pytest-cov
distlib==0.3.6
# via virtualenv
exceptiongroup==1.1.0
# via pytest
filelock==3.9.0
# via virtualenv
flake8==5.0.4
flake8==6.0.0
# via
# -r dev-requirements.in
# flake8-bugbear
Expand All @@ -37,20 +35,11 @@ flake8-bugbear==23.2.13
# via -r dev-requirements.in
freezegun==1.2.2
# via -r dev-requirements.in
identify==2.5.18
identify==2.5.19
# via pre-commit
importlib-metadata==4.2.0
# via
# build
# click
# flake8
# pluggy
# pre-commit
# pytest
# virtualenv
iniconfig==2.0.0
# via pytest
isort==5.11.5
isort==5.12.0
# via -r dev-requirements.in
mccabe==0.7.0
# via flake8
Expand All @@ -67,21 +56,23 @@ pathspec==0.11.0
# via black
pep8-naming==0.13.3
# via -r dev-requirements.in
pip-tools==6.12.2
pip-tools==6.12.3
# via -r dev-requirements.in
platformdirs==3.0.0
# via black
platformdirs==3.1.0
# via
# black
# virtualenv
pluggy==1.0.0
# via pytest
pre-commit==2.20.0
pre-commit==3.1.1
# via -r dev-requirements.in
pycodestyle==2.9.1
pycodestyle==2.10.0
# via flake8
pyflakes==2.5.0
pyflakes==3.0.1
# via flake8
pyproject-hooks==1.0.0
# via build
pytest==7.2.1
pytest==7.2.2
# via
# -r dev-requirements.in
# pytest-cov
Expand All @@ -95,31 +86,20 @@ python-dateutil==2.8.2
pyyaml==6.0
# via pre-commit
six==1.16.0
# via
# python-dateutil
# virtualenv
toml==0.10.2
# via pre-commit
# via python-dateutil
tomli==2.0.1
# via
# black
# build
# coverage
# pyproject-hooks
# pytest
typed-ast==1.5.4
# via black
typing-extensions==4.5.0
# via
# black
# importlib-metadata
# platformdirs
virtualenv==20.4.7
# via black
virtualenv==20.20.0
# via pre-commit
wheel==0.38.4
# via pip-tools
zipp==3.13.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
3 changes: 3 additions & 0 deletions helerm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ def get_git_revision_hash() -> str:

# Django SECRET_KEY setting, used for password reset links and such
SECRET_KEY = env("SECRET_KEY")

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

# If a secret key was not supplied elsewhere, generate a random one and log
# a warning (note that logging is not configured yet). This means that any
# functionality expecting SECRET_KEY to stay same will break upon restart.
Expand Down
61 changes: 61 additions & 0 deletions metarecord/migrations/0003_use_bigautofield_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Generated by Django 3.2.18 on 2023-03-09 11:30

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("metarecord", "0002_attributevalidationrule"),
]

operations = [
migrations.AlterField(
model_name="action",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="attributegroup",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="classification",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="function",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="metadataversion",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="phase",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="record",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
]
2 changes: 1 addition & 1 deletion metarecord/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_get(
assert response.status_code == 200
assert len(response.data["results"])

id_field = "pk" if resource is "attribute" else "uuid"
id_field = "pk" if resource == "attribute" else "uuid"
id_value = getattr(locals().get(resource), id_field)
detail_url = reverse(
"%s-detail" % resource.replace("_", ""), kwargs={id_field: id_value}
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[tool.black]
line-length = 88 # Black's default value
target-version = ["py37"]
target-version = ["py39"]

[tool.isort]
extend_skip_glob = ["*migrations*", "metarecord/binding"]
profile = "black"
atomic = true
order_by_type = false
py_version = 37
py_version = 39

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "helerm.settings"
14 changes: 6 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.7
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --resolver=backtracking requirements.in
Expand All @@ -15,9 +15,9 @@ certifi==2022.12.7
# sentry-sdk
cffi==1.15.1
# via cryptography
charset-normalizer==3.0.1
charset-normalizer==3.1.0
# via requests
cryptography==39.0.1
cryptography==39.0.2
# via social-auth-core
defusedxml==0.7.1
# via
Expand Down Expand Up @@ -47,7 +47,7 @@ django-elasticsearch-dsl==7.3
# via django-elasticsearch-dsl-drf
django-elasticsearch-dsl-drf==0.22.5
# via -r requirements.in
django-environ==0.9.0
django-environ==0.10.0
# via -r requirements.in
django-filter==22.1
# via -r requirements.in
Expand All @@ -70,7 +70,7 @@ elasticsearch==7.17.9
# via
# django-elasticsearch-dsl-drf
# elasticsearch-dsl
elasticsearch-dsl==7.4.0
elasticsearch-dsl==7.4.1
# via
# django-elasticsearch-dsl
# django-elasticsearch-dsl-drf
Expand Down Expand Up @@ -127,7 +127,7 @@ requests-oauthlib==1.3.1
# via social-auth-core
rsa==4.9
# via python-jose
sentry-sdk==1.15.0
sentry-sdk==1.16.0
# via -r requirements.in
six==1.16.0
# via
Expand All @@ -143,8 +143,6 @@ social-auth-core==4.3.0
# via social-auth-app-django
sqlparse==0.4.3
# via django
typing-extensions==4.5.0
# via asgiref
urllib3==1.26.14
# via
# elasticsearch
Expand Down
19 changes: 19 additions & 0 deletions users/migrations/0006_alter_user_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.18 on 2023-03-09 11:30

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("users", "0005_transfer_to_pysocial"),
]

operations = [
migrations.AlterField(
model_name="user",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
]