Skip to content

Commit 52a2cfb

Browse files
authored
Merge branch 'master' into is7055/fix-invitation-double-slash
2 parents 90a3d29 + 8909588 commit 52a2cfb

File tree

99 files changed

+2695
-904
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2695
-904
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ updates:
1111
- sanderegg
1212
assignees:
1313
- pcrespov
14+
- sanderegg
15+
labels:
16+
- t:maintenance
1417
ignore:
1518
- dependency-name: docker-compose
1619
versions:
@@ -26,32 +29,10 @@ updates:
2629
- dependency-name: httpx
2730
versions:
2831
- 0.17.0
29-
- package-ecosystem: pip
30-
directory: "/packages/service-library"
31-
schedule:
32-
interval: weekly
33-
time: "04:00"
34-
open-pull-requests-limit: 10
35-
reviewers:
36-
- pcrespov
37-
- sanderegg
38-
assignees:
39-
- pcrespov
40-
ignore:
4132
- dependency-name: openapi-core
4233
versions:
4334
- "> 0.12.0, < 1"
44-
- package-ecosystem: pip
45-
directory: "/packages/postgres-database"
46-
schedule:
47-
interval: weekly
48-
time: "04:00"
49-
open-pull-requests-limit: 10
50-
reviewers:
51-
- pcrespov
52-
- sanderegg
53-
assignees:
54-
- pcrespov
35+
5536
- package-ecosystem: "github-actions"
5637
directory: "/"
5738
schedule:
@@ -62,3 +43,5 @@ updates:
6243
- pcrespov
6344
assignees:
6445
- sanderegg
46+
labels:
47+
- t:maintenance

.github/workflows/ci-testing-deploy.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,15 +1730,13 @@ jobs:
17301730
matrix:
17311731
python: ["3.11"]
17321732
os: [ubuntu-22.04]
1733-
docker_buildx: [v0.10.4]
17341733
fail-fast: false
17351734
steps:
17361735
- uses: actions/checkout@v4
17371736
- name: setup docker buildx
17381737
id: buildx
17391738
uses: docker/setup-buildx-action@v3
17401739
with:
1741-
version: ${{ matrix.docker_buildx }}
17421740
driver: docker-container
17431741
- name: setup python environment
17441742
uses: actions/setup-python@v5

api/specs/web-server/_projects_wallet.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,20 @@
88
# pylint: disable=unused-variable
99
# pylint: disable=too-many-arguments
1010

11+
from typing import Annotated
1112

1213
from _common import assert_handler_signature_against_model
13-
from fastapi import APIRouter
14+
from fastapi import APIRouter, Depends, status
1415
from models_library.api_schemas_webserver.wallets import WalletGet
1516
from models_library.generics import Envelope
1617
from models_library.projects import ProjectID
1718
from models_library.wallets import WalletID
1819
from simcore_service_webserver._meta import API_VTAG
1920
from simcore_service_webserver.projects._common.models import ProjectPathParams
21+
from simcore_service_webserver.projects._wallets_handlers import (
22+
_PayProjectDebtBody,
23+
_ProjectWalletPathParams,
24+
)
2025

2126
router = APIRouter(
2227
prefix=f"/{API_VTAG}",
@@ -51,3 +56,17 @@ async def connect_wallet_to_project(
5156

5257

5358
assert_handler_signature_against_model(connect_wallet_to_project, ProjectPathParams)
59+
60+
61+
@router.post(
62+
"/projects/{project_id}/wallet/{wallet_id}:pay-debt",
63+
status_code=status.HTTP_204_NO_CONTENT,
64+
)
65+
async def pay_project_debt(
66+
_path: Annotated[_ProjectWalletPathParams, Depends()],
67+
_body: Annotated[_PayProjectDebtBody, Depends()],
68+
):
69+
...
70+
71+
72+
assert_handler_signature_against_model(connect_wallet_to_project, ProjectPathParams)

packages/models-library/src/models_library/resource_tracker.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,50 @@ class ServiceRunStatus(StrAutoEnum):
3838

3939

4040
class CreditTransactionStatus(StrAutoEnum):
41+
# Represents the possible statuses of a credit transaction.
42+
4143
PENDING = auto()
44+
# The transaction is pending and has not yet been finalized.
45+
# Example: During the running of a service, the transaction remains in the Pending state until the service is stopped.
46+
4247
BILLED = auto()
48+
# The transaction has been successfully billed.
49+
50+
IN_DEBT = auto()
51+
# The transaction is marked as in debt.
52+
# Example: This occurs when a computational job continues to run even though the user does not have sufficient credits in their wallet.
53+
4354
NOT_BILLED = auto()
55+
# The transaction will not be billed.
56+
# Example: This status is used when there is an issue on our side, and we decide not to bill the user.
57+
4458
REQUIRES_MANUAL_REVIEW = auto()
59+
# The transaction requires manual review due to potential issues.
60+
# NOTE: This status is currently not in use.
4561

4662

4763
class CreditClassification(StrAutoEnum):
48-
ADD_WALLET_TOP_UP = auto() # user top up credits
49-
DEDUCT_SERVICE_RUN = auto() # computational/dynamic service run costs)
64+
# Represents the different types of credit classifications.
65+
66+
ADD_WALLET_TOP_UP = auto()
67+
# Indicates that credits have been added to the user's wallet through a top-up.
68+
# Example: The user adds funds to their wallet to increase their available credits.
69+
70+
DEDUCT_SERVICE_RUN = auto()
71+
# Represents a deduction from the user's wallet due to the costs of running a computational or dynamic service.
72+
# Example: Credits are deducted when the user runs a simulation.
73+
5074
DEDUCT_LICENSE_PURCHASE = auto()
75+
# Represents a deduction from the user's wallet for purchasing a license.
76+
# Example: The user purchases a license to access premium features such as VIP models.
77+
78+
ADD_WALLET_EXCHANGE = auto()
79+
# Represents the addition of credits to the user's wallet through an exchange.
80+
# Example: Credits are added due to credit exchange between wallets.
81+
82+
DEDUCT_WALLET_EXCHANGE = auto()
83+
# Represents a deduction of credits from the user's wallet through an exchange.
84+
# Example: Credits are deducted due to credit exchange between wallets.
5185

5286

5387
class PricingPlanClassification(StrAutoEnum):

packages/postgres-database/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22
ARG PYTHON_VERSION="3.11.9"
3-
ARG UV_VERSION="0.4"
3+
ARG UV_VERSION="0.5"
44
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
55
# we docker image is built based on debian
66
FROM python:${PYTHON_VERSION}-slim-bookworm AS base

packages/postgres-database/scripts/erd/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Define arguments in the global scope
44
ARG PYTHON_VERSION="3.11.9"
5-
ARG UV_VERSION="0.4"
5+
ARG UV_VERSION="0.5"
66
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
77
# we docker image is built based on debian
88
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""add credit transaction classification enums
2+
3+
Revision ID: a3a58471b0f1
4+
Revises: f19905923355
5+
Create Date: 2025-01-14 13:44:05.025647+00:00
6+
7+
"""
8+
import sqlalchemy as sa
9+
from alembic import op
10+
11+
# revision identifiers, used by Alembic.
12+
revision = "a3a58471b0f1"
13+
down_revision = "f19905923355"
14+
branch_labels = None
15+
depends_on = None
16+
17+
18+
def upgrade():
19+
op.execute(sa.DDL("ALTER TYPE credittransactionstatus ADD VALUE 'IN_DEBT'"))
20+
op.execute(
21+
sa.DDL(
22+
"ALTER TYPE credittransactionclassification ADD VALUE 'ADD_WALLET_EXCHANGE'"
23+
)
24+
)
25+
op.execute(
26+
sa.DDL(
27+
"ALTER TYPE credittransactionclassification ADD VALUE 'DEDUCT_WALLET_EXCHANGE'"
28+
)
29+
)
30+
31+
32+
def downgrade():
33+
# ### commands auto generated by Alembic - please adjust! ###
34+
pass
35+
# ### end Alembic commands ###

packages/postgres-database/src/simcore_postgres_database/models/resource_tracker_credit_transactions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
class CreditTransactionStatus(str, enum.Enum):
1919
PENDING = "PENDING"
2020
BILLED = "BILLED"
21+
IN_DEBT = "IN_DEBT"
2122
NOT_BILLED = "NOT_BILLED"
2223
REQUIRES_MANUAL_REVIEW = "REQUIRES_MANUAL_REVIEW"
2324

@@ -28,6 +29,8 @@ class CreditTransactionClassification(str, enum.Enum):
2829
"DEDUCT_SERVICE_RUN" # computational/dynamic service run costs)
2930
)
3031
DEDUCT_LICENSE_PURCHASE = "DEDUCT_LICENSE_PURCHASE"
32+
ADD_WALLET_EXCHANGE = "ADD_WALLET_EXCHANGE"
33+
DEDUCT_WALLET_EXCHANGE = "DEDUCT_WALLET_EXCHANGE"
3134

3235

3336
resource_tracker_credit_transactions = sa.Table(

packages/service-integration/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Define arguments in the global scope
44
ARG PYTHON_VERSION="3.11.9"
5-
ARG UV_VERSION="0.4"
5+
ARG UV_VERSION="0.5"
66
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
77
# we docker image is built based on debian
88
FROM python:${PYTHON_VERSION}-slim-bookworm AS base

packages/service-library/src/servicelib/project_lock.py

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)