From 776ea9d948414a7adfd66ce4bddf00a0a0b7a228 Mon Sep 17 00:00:00 2001 From: Michele Grimaldi Date: Wed, 8 Jan 2025 21:04:06 +0100 Subject: [PATCH 1/3] Fix maintainability: - Resolved formatting issues using isort and black. - Updated deprecated methods (_app_ctx_stack, datetime.utcnow). - Added a requirements.txt file for dependency management. - Addressed Python 3. warnings (ast.Num, ast.n). --- ihatemoney/manage.py | 2 +- ihatemoney/monkeypath_continuum.py | 14 ++++++++------ ihatemoney/tests/budget_test.py | 6 ++++-- pyproject.toml | 3 ++- requirements.txt | 24 ++++++++++++++++++++++++ uv.lock | 2 +- 6 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 requirements.txt diff --git a/ihatemoney/manage.py b/ihatemoney/manage.py index d94a1dd4b..67b38b727 100755 --- a/ihatemoney/manage.py +++ b/ihatemoney/manage.py @@ -1,10 +1,10 @@ #!/usr/bin/env python +import datetime import getpass import os import random import sys -import datetime import click from flask.cli import FlaskGroup diff --git a/ihatemoney/monkeypath_continuum.py b/ihatemoney/monkeypath_continuum.py index a52c92fad..18e5cb54f 100644 --- a/ihatemoney/monkeypath_continuum.py +++ b/ihatemoney/monkeypath_continuum.py @@ -82,12 +82,14 @@ def __repr__(self): ) return "" % ", ".join( ( - "%s=%r" % (field, value) - if not isinstance(value, six.integer_types) - # We want the following line to ensure that longs get - # shown without the ugly L suffix on python 2.x - # versions - else "%s=%d" % (field, value) + ( + "%s=%r" % (field, value) + if not isinstance(value, six.integer_types) + # We want the following line to ensure that longs get + # shown without the ugly L suffix on python 2.x + # versions + else "%s=%d" % (field, value) + ) for field, value in field_values.items() ) ) diff --git a/ihatemoney/tests/budget_test.py b/ihatemoney/tests/budget_test.py index 732535bc9..9ed01eb80 100644 --- a/ihatemoney/tests/budget_test.py +++ b/ihatemoney/tests/budget_test.py @@ -1,5 +1,5 @@ from collections import defaultdict -from datetime import datetime, timedelta, date +from datetime import date, datetime, timedelta import re from urllib.parse import unquote, urlparse, urlunparse @@ -1032,7 +1032,9 @@ def test_dashboard(self): assert """ Project - Number of participants""" in resp.data.decode("utf-8") + Number of participants""" in resp.data.decode( + "utf-8" + ) def test_dashboard_project_deletion(self): self.post_project("raclette") diff --git a/pyproject.toml b/pyproject.toml index afe89e894..6b0052b5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "ihatemoney" version = "6.2.0.dev0" -requires-python = ">=3.9" +requires-python = ">=3.9, <3.14" description = "A simple shared budget manager web application." readme = "README.md" license = {file = "LICENSE"} @@ -20,6 +20,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", ] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..59f1d7c80 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,24 @@ +blinker>=1.4,<2 +cachetools>=4.1,<6 +debts>=0.5,<1 +email_validator>=1.0,<3 +Flask>=2,<4 +Flask-Babel>=1.0,<4 +Flask-Cors>=3.0.8,<6 +Flask-Limiter>=2.6,<3 +Flask-Mail>=0.9.1,<1 +Flask-Migrate>=2.5.3,<5 +Flask-RESTful>=0.3.9,<1 +Flask-SQLAlchemy>=2.4,<3 +Flask-Talisman>=0.8,<2 +Flask-WTF>=0.14.3,<2 +itsdangerous>=2,<3 +Jinja2>=3,<4 +python-dateutil +qrcode>=7.1,<9 +requests>=2.25,<3 +SQLAlchemy>=1.4.0,<2 +SQLAlchemy-Continuum>=1.3.12,<2 +Werkzeug>=2,<3 +WTForms>=2.3.3,<3.3 +alembic>=1.14,<2 \ No newline at end of file diff --git a/uv.lock b/uv.lock index b23e6d6a6..e42c35109 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -requires-python = ">=3.9" +requires-python = ">=3.9, <3.14" [[package]] name = "alabaster" From 042874a228d1bb9ff4774ec842add0ebcd1e6bcf Mon Sep 17 00:00:00 2001 From: Michele Grimaldi Date: Wed, 8 Jan 2025 21:17:32 +0100 Subject: [PATCH 2/3] Adding settings.cfg --- settings.cfg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 settings.cfg diff --git a/settings.cfg b/settings.cfg new file mode 100644 index 000000000..1bc03cfd6 --- /dev/null +++ b/settings.cfg @@ -0,0 +1,3 @@ +DEBUG = True +SQLACHEMY_ECHO = DEBUG +export IHATEMONEY_SETTINGS_FILE_PATH="$(pwd)/settings.cfg" From a02dcc0a642e286059ee492faa1d6c313714f592 Mon Sep 17 00:00:00 2001 From: Michele Grimaldi Date: Thu, 9 Jan 2025 10:48:29 +0100 Subject: [PATCH 3/3] Remove requirements.txt as pyproject.toml is used for dependency management --- requirements.txt | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 59f1d7c80..000000000 --- a/requirements.txt +++ /dev/null @@ -1,24 +0,0 @@ -blinker>=1.4,<2 -cachetools>=4.1,<6 -debts>=0.5,<1 -email_validator>=1.0,<3 -Flask>=2,<4 -Flask-Babel>=1.0,<4 -Flask-Cors>=3.0.8,<6 -Flask-Limiter>=2.6,<3 -Flask-Mail>=0.9.1,<1 -Flask-Migrate>=2.5.3,<5 -Flask-RESTful>=0.3.9,<1 -Flask-SQLAlchemy>=2.4,<3 -Flask-Talisman>=0.8,<2 -Flask-WTF>=0.14.3,<2 -itsdangerous>=2,<3 -Jinja2>=3,<4 -python-dateutil -qrcode>=7.1,<9 -requests>=2.25,<3 -SQLAlchemy>=1.4.0,<2 -SQLAlchemy-Continuum>=1.3.12,<2 -Werkzeug>=2,<3 -WTForms>=2.3.3,<3.3 -alembic>=1.14,<2 \ No newline at end of file