Skip to content

Commit

Permalink
Update to Python 3.12 & dependencies (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamtoozer authored Oct 1, 2024
1 parent 8df2eca commit dc6d018
Show file tree
Hide file tree
Showing 7 changed files with 250 additions and 337 deletions.
9 changes: 2 additions & 7 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ limit-inference-results=100

# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins=pylint.extensions.mccabe,pylint_quotes
load-plugins=pylint.extensions.mccabe

# Pickle collected data for later comparisons.
persistent=yes

# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.11
py-version=3.12

# Discover python modules and packages in the file system subtree.
recursive=no
Expand Down Expand Up @@ -343,11 +343,6 @@ single-line-class-stmt=no
# else.
single-line-if-stmt=no

string-quote=double-avoid-escape
triple-quote=double
docstring-quote=double


[IMPORTS]

# List of modules that can be imported at any level, not just the top level
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11.4
3.12.6
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM python:3.11-slim
FROM python:3.12-slim

RUN apt-get update && apt-get install --no-install-recommends -y git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN pip install "poetry==1.3.2"
RUN pip install \
setuptools \
"poetry==1.8.3"
RUN poetry config virtualenvs.create false

RUN mkdir -p /usr/src/
Expand All @@ -13,7 +15,7 @@ WORKDIR /usr/src/
COPY app /usr/src/app
COPY api.py poetry.lock pyproject.toml /usr/src/

RUN poetry install --no-dev
RUN poetry install --only main

EXPOSE 5000

Expand Down
1 change: 0 additions & 1 deletion app/validators/questionnaire_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def validate_referred_numeric_answer(self, answer, answer_ranges):
def validate_smart_quotes(self):
schema_object = SurveySchema(self.schema_element)

# pylint: disable=invalid-string-quote
quote_regex = re.compile(r"['|\"]+(?![^{]*})+(?![^<]*>)")

for translatable_item in schema_object.translatable_items:
Expand Down
538 changes: 226 additions & 312 deletions poetry.lock

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ description = "API for questionnaire schema validation"
authors = ["ONSDigital"]

[tool.poetry.dependencies]
python = "^3.11"
Flask = "^2.3.3"
jsonpointer = "^2.4"
structlog = "^23.1.0"
python-dateutil = "^2.8.2"
python = "^3.12"
Flask = "^3.0.3"
jsonpointer = "^3.0.0"
structlog = "^24.4.0"
python-dateutil = "^2.9.0.post0"
jsonschema = "4.4.0"
jsonpath-rw = "^1.4.0"
jsonpath-rw-ext = "^1.2.2"
eq-translations = {git = "https://github.com/ONSDigital/eq-translations.git", rev = "v4.9.2"}

[tool.poetry.dev-dependencies]
pytest = "^7.4.2"
flake8 = "^6.1.0"
pylint = "^2.17.5"
pylint-quotes = "^0.2.3"
pytest-cov = "^4.1.0"
pytest-xdist = "^3.3.1"
pytest-sugar = "^0.9.4"
black = "^24.3.0"
pytest = "^8.3.3"
flake8 = "^7.1.1"
pylint = "^3.2.7"
pytest-cov = "^5.0.0"
pytest-xdist = "^3.6.1"
pytest-sugar = "^1.0.0"
black = "^24.8.0"
flake8-quotes = "^3.4.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
exclude = node_modules/*,tests/*,src/*
max-line-length = 160
ignore = C815,C816,W503,E203
inline-quotes = double
multiline-quotes = double
docstring-quotes = double

0 comments on commit dc6d018

Please sign in to comment.