Skip to content

Commit

Permalink
🔧refactor: Migrate to python 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
D10S0VSkY-OSS committed Nov 7, 2023
1 parent 4a62a93 commit 312bbc7
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 127 deletions.
1 change: 1 addition & 0 deletions sld-api-backend/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.11.6
15 changes: 7 additions & 8 deletions sld-api-backend/config/api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os
from typing import List

from pydantic import BaseSettings

from pydantic_settings import BaseSettings

class Settings(BaseSettings):
# Schedle config
Expand All @@ -23,7 +22,7 @@ class Settings(BaseSettings):
"SLD_SECRET_KEY",
"09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7",
)
ALGORITHM = "HS256"
ALGORITHM: str = "HS256"
# 60 minutes * 24 hours * 8 days = 8 days
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
SECRET_VAULT: bytes = os.getenv(
Expand All @@ -36,11 +35,11 @@ class Settings(BaseSettings):
WORKER_TMOUT: int = os.getenv("SLD_WORKER_TMOUT", 300)
ENV: str = os.getenv("SLD_ENV", "dev")
DEBUG: bool = os.getenv("SLD_DEBUG", False)
BACKEND_USER = os.getenv("BACKEND_USER", "")
BACKEND_PASSWD = os.getenv("BACKEND_PASSWD", "")
BACKEND_SERVER = os.getenv("BACKEND_SERVER", "redis")
BACKEND_USER: str = os.getenv("BACKEND_USER", "")
BACKEND_PASSWD: str = os.getenv("BACKEND_PASSWD", "")
BACKEND_SERVER: str = os.getenv("BACKEND_SERVER", "redis")
# init user
INIT_USER = {
INIT_USER: dict = {
"username": os.getenv("SLD_INIT_USER_NAME", "admin"),
"fullname": os.getenv("SLD_INIT_USER_FULLNAME", "Master of the universe user"),
"email": os.getenv("SLD_INIT_USER_email", "[email protected]"),
Expand All @@ -50,7 +49,7 @@ class Settings(BaseSettings):
AWS_SHARED_CONFIG_FILE: str = f"{AWS_CONGIG_DEFAULT_FOLDER}/config"
TASK_MAX_RETRY: int = os.getenv("SLD_TASK_MAX_RETRY", 1)
TASK_RETRY_INTERVAL: int = os.getenv("SLD_TASK_RETRY_INTERVAL", 20)
TASK_LOCKED_EXPIRED = os.getenv("SLD_TASK_LOCKED_EXPIRED", 300)
TASK_LOCKED_EXPIRED: int = os.getenv("SLD_TASK_LOCKED_EXPIRED", 300)
TASK_ROUTE: bool = os.getenv("SLD_TASK_ROUTE", False)
TERRAFORM_BIN_REPO: str = os.getenv(
"SLD_TERRAFORM_BIN_REPO", "https://releases.hashicorp.com/terraform"
Expand Down
91 changes: 48 additions & 43 deletions sld-api-backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,68 +1,73 @@
aioredis==2.0.1
amqp==5.1.1
anyio==3.6.2
async-timeout==4.0.2
attrs==22.2.0
annotated-types==0.6.0
anyio==3.7.1
async-timeout==4.0.3
attrs==23.1.0
bcrypt==4.0.1
billiard==3.6.4.0
celery==5.2.7
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.0.1
click==8.1.3
billiard==4.1.0
celery==5.3.4
certifi==2023.7.22
cffi==1.16.0
charset-normalizer==3.3.0
click==8.1.7
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.2.0
croniter==1.3.8
cryptography==39.0.1
click-repl==0.3.0
croniter==2.0.1
cryptography==41.0.4
dependency-injector==4.41.0
Deprecated==1.2.13
dnspython==2.3.0
Deprecated==1.2.14
dnspython==2.4.2
ecdsa==0.18.0
email-validator==1.3.1
exceptiongroup==1.1.0
fastapi==0.91.0
email-validator==2.0.0.post2
exceptiongroup==1.1.3
fastapi==0.104.1
fastapi-limiter==0.1.5
fastapi-versioning==0.10.0
greenlet==2.0.2
greenlet==3.0.0
h11==0.14.0
idna==3.4
iniconfig==2.0.0
Jinja2==3.1.2
jmespath==1.0.1
kombu==5.2.4
MarkupSafe==2.1.2
mysqlclient==2.1.1
packaging==23.0
kombu==5.3.2
MarkupSafe==2.1.3
mysqlclient==2.2.0
packaging==23.2
passlib==1.7.4
password-strength==0.0.3.post2
pluggy==1.0.0
prompt-toolkit==3.0.36
pluggy==1.3.0
prompt-toolkit==3.0.39
py==1.11.0
pyasn1==0.4.8
pyasn1==0.5.0
pycparser==2.21
pydantic==1.10.4
pyhcl==0.4.4
PyJWT==2.6.0
PyMySQL==1.0.2
pyparsing==3.0.9
pytest==7.2.1
pydantic==2.4.2
pydantic-settings==2.0.3
pydantic_core==2.10.1
pyhcl==0.4.5
PyJWT==2.8.0
PyMySQL==1.1.0
pyparsing==3.1.1
pytest==7.4.2
python-dateutil==2.8.2
python-dotenv==1.0.0
python-jose==3.3.0
python-multipart==0.0.5
python-usernames==0.3.1
pytz==2022.7.1
redis==4.5.1
requests==2.28.2
python-multipart==0.0.6
python-usernames==1.0.0
pytz==2023.3.post1
redis==4.6.0
requests==2.31.0
rsa==4.9
six==1.16.0
sniffio==1.3.0
SQLAlchemy==2.0.3
starlette==0.24.0
SQLAlchemy==2.0.22
starlette==0.27.0
tomli==2.0.1
typing_extensions==4.4.0
urllib3==1.26.14
uvicorn==0.20.0
typing_extensions==4.8.0
tzdata==2023.3
urllib3==2.0.7
uvicorn==0.23.2
vine==5.0.0
wcwidth==0.2.6
wrapt==1.14.1
wcwidth==0.2.8
wrapt==1.15.0
2 changes: 1 addition & 1 deletion sld-api-backend/src/users/application/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from dependency_injector import containers, providers
from password_strength import PasswordPolicy
from usernames import is_safe_username
from python_usernames import is_safe_username


class PasswordValidator:
Expand Down
3 changes: 1 addition & 2 deletions sld-api-backend/test/config/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

from pydantic import BaseSettings

from pydantic_settings import BaseSettings

class Settings(BaseSettings):
SERVER: str = "http://localhost"
Expand Down
1 change: 1 addition & 0 deletions sld-dashboard/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.11.6
12 changes: 6 additions & 6 deletions sld-dashboard/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def register_blueprints(app):


def configure_database(app):
@app.before_first_request
def initialize_database():
try:
pass
except Exception as err:
pass
with app.app_context():
def initialize_database():
try:
pass
except Exception as err:
pass

@app.teardown_request
def shutdown_session(exception=None):
Expand Down
2 changes: 1 addition & 1 deletion sld-dashboard/app/helpers/config/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from pydantic import BaseSettings
from pydantic_settings import BaseSettings


class Settings(BaseSettings):
Expand Down
69 changes: 37 additions & 32 deletions sld-dashboard/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
alembic==1.8.1
async-timeout==4.0.2
alembic==1.12.0
annotated-types==0.6.0
async-timeout==4.0.3
bcrypt==4.0.1
certifi==2022.12.7
cffi==1.15.1
chardet==5.1.0
charset-normalizer==2.1.1
click==8.1.3
cryptography==39.0.1
Deprecated==1.2.13
dnspython==2.2.1
email-validator==1.3.0
blinker==1.6.3
certifi==2023.7.22
cffi==1.16.0
chardet==5.2.0
charset-normalizer==3.3.0
click==8.1.7
cryptography==41.0.4
Deprecated==1.2.14
dnspython==2.4.2
email-validator==2.0.0.post2
fernet==1.0.1
Flask==2.2.2
Flask==2.3.3
Flask-Login==0.6.2
Flask-Migrate==4.0.0
Flask-MySQLdb==1.0.1
Flask-SQLAlchemy==3.0.2
Flask-WTF==1.0.1
greenlet==2.0.1
gunicorn==20.1.0
Flask-Migrate==4.0.5
Flask-MySQLdb==2.0.0
Flask-SQLAlchemy==3.1.1
Flask-WTF==1.2.1
greenlet==3.0.0
gunicorn==21.2.0
idna==3.4
itsdangerous==2.1.2
Jinja2==3.1.2
Mako==1.2.4
MarkupSafe==2.1.1
mysqlclient==2.1.1
packaging==21.3
MarkupSafe==2.1.3
mysqlclient==2.2.0
packaging==23.2
passlib==1.7.4
pyaes==1.6.1
pycparser==2.21
pydantic==1.10.2
pyparsing==3.0.9
pydantic==2.4.2
pydantic-settings==2.0.3
pydantic_core==2.10.1
pyparsing==3.1.1
python-dateutil==2.8.2
python-decouple==3.6
python-decouple==3.8
python-dotenv==1.0.0
python-editor==1.0.4
redis==4.3.5
requests==2.28.1
redis==5.0.1
requests==2.31.0
six==1.16.0
SQLAlchemy==1.4.44
typing_extensions==4.4.0
urllib3==1.26.13
Werkzeug==2.2.2
wrapt==1.14.1
WTForms==3.0.1
SQLAlchemy==2.0.22
typing_extensions==4.8.0
urllib3==2.0.7
Werkzeug==2.3.7
wrapt==1.15.0
WTForms==3.1.0
1 change: 1 addition & 0 deletions sld-remote-state/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.11.6
2 changes: 1 addition & 1 deletion sld-remote-state/configs/storage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from pydantic import BaseSettings
from pydantic_settings import BaseSettings


class Settings(BaseSettings):
Expand Down
70 changes: 37 additions & 33 deletions sld-remote-state/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
anyio==3.6.2
asgiref==3.5.2
azure-core==1.26.1
azure-storage-blob==12.14.1
boto3==1.26.21
botocore==1.29.21
cachetools==5.2.0
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.3
cryptography==39.0.1
dnspython==2.2.1
fastapi==0.88.0
google-api-core==2.11.0
google-auth==2.15.0
google-cloud-core==2.3.2
google-cloud-storage==2.6.0
annotated-types==0.6.0
anyio==3.7.1
asgiref==3.7.2
azure-core==1.29.5
azure-storage-blob==12.18.3
boto3==1.28.79
botocore==1.31.79
cachetools==5.3.2
certifi==2023.7.22
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cryptography==41.0.5
dnspython==2.4.2
fastapi==0.104.1
google-api-core==2.12.0
google-auth==2.23.4
google-cloud-core==2.3.3
google-cloud-storage==2.13.0
google-crc32c==1.5.0
google-resumable-media==2.4.0
googleapis-common-protos==1.57.0
greenlet==2.0.1
google-resumable-media==2.6.0
googleapis-common-protos==1.61.0
greenlet==3.0.1
h11==0.14.0
idna==3.4
isodate==0.6.1
jmespath==1.0.1
msrest==0.7.1
oauthlib==3.2.2
protobuf==4.21.10
pyasn1==0.4.8
pyasn1-modules==0.2.8
protobuf==4.25.0
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycparser==2.21
pydantic==1.10.2
pymongo==4.3.3
pydantic==2.4.2
pydantic-settings==2.0.3
pydantic_core==2.10.1
pymongo==4.6.0
python-dateutil==2.8.2
requests==2.28.1
python-dotenv==1.0.0
requests==2.31.0
requests-oauthlib==1.3.1
rsa==4.9
s3transfer==0.6.0
s3transfer==0.7.0
six==1.16.0
sniffio==1.3.0
SQLAlchemy==1.4.44
starlette==0.22.0
typing_extensions==4.4.0
urllib3==1.26.13
uvicorn==0.20.0
SQLAlchemy==2.0.23
starlette==0.27.0
typing_extensions==4.8.0
urllib3==2.0.7
uvicorn==0.24.0.post1

0 comments on commit 312bbc7

Please sign in to comment.