mpt-extension-sdk 5.17.2__py3-none-any.whl → 5.17.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -428,9 +428,22 @@ def get_listings_by_price_list_and_seller_and_authorization(
428
428
 
429
429
 
430
430
  @wrap_mpt_http_error
431
- def get_item_prices_by_pricelist_id(mpt_client, price_list_id, item_id):
432
- """Retrieve item prices by price list ID."""
433
- response = mpt_client.get(f"/catalog/price-lists/{price_list_id}/items?eq(item.id,{item_id})")
431
+ def get_item_prices_by_pricelist_id(mpt_client, price_list_id, item_ids):
432
+ """
433
+ Retrieve item prices by price list ID.
434
+
435
+ Args:
436
+ mpt_client: Client instance to interact with the required API.
437
+ price_list_id: The ID of the price list to retrieve item prices for.
438
+ item_ids: The IDs list to retrieve prices.
439
+
440
+ Returns:
441
+ list: A list of item prices.
442
+ """
443
+ item_ids_str = ",".join(item_ids)
444
+ response = mpt_client.get(
445
+ f"/catalog/price-lists/{price_list_id}/items?in(item.id,({item_ids_str}))"
446
+ )
434
447
  response.raise_for_status()
435
448
  return response.json()["data"]
436
449
 
@@ -1,11 +0,0 @@
1
- from importlib.metadata import version
2
-
3
- try:
4
- __version__ = version("swo-runtime")
5
- except Exception: # pragma: no cover
6
- __version__ = "0.0.0"
7
-
8
-
9
- def get_version():
10
- """Get the current version of the package."""
11
- return __version__
@@ -1,11 +1,6 @@
1
- from typing import Any
1
+ from mpt_extension_sdk.runtime.djapp.conf.product_utils import extract_product_ids, get_for_product
2
2
 
3
-
4
- def extract_product_ids(product_ids: str) -> list[str]:
5
- """Extract product IDs from a comma-separated string."""
6
- return product_ids.split(",")
7
-
8
-
9
- def get_for_product(settings, variable_name: str, product_id: str) -> Any:
10
- """A shortcut to return product scoped variable from the extension settings."""
11
- return settings.EXTENSION_CONFIG[variable_name][product_id]
3
+ __all__ = [
4
+ "extract_product_ids",
5
+ "get_for_product",
6
+ ]
@@ -0,0 +1,11 @@
1
+ from typing import Any
2
+
3
+
4
+ def extract_product_ids(product_ids: str) -> list[str]:
5
+ """Extract product IDs from a comma-separated string."""
6
+ return product_ids.split(",")
7
+
8
+
9
+ def get_for_product(settings, variable_name: str, product_id: str) -> Any:
10
+ """A shortcut to return product scoped variable from the extension settings."""
11
+ return settings.EXTENSION_CONFIG[variable_name][product_id]
@@ -11,7 +11,7 @@ from django.utils.module_loading import import_string
11
11
 
12
12
  from mpt_extension_sdk.core.events.dataclasses import Event
13
13
  from mpt_extension_sdk.core.utils import setup_client
14
- from mpt_extension_sdk.swo_rql import RQLQuery
14
+ from mpt_extension_sdk.swo_rql import R as RQLQuery
15
15
 
16
16
  logger = logging.getLogger(__name__)
17
17
 
@@ -1,8 +1,8 @@
1
1
  import click
2
2
  from django.utils.module_loading import import_string
3
3
 
4
- from mpt_extension_sdk.runtime import get_version
5
4
  from mpt_extension_sdk.runtime.utils import show_banner
5
+ from mpt_extension_sdk.runtime.version import get_version
6
6
 
7
7
 
8
8
  def print_version(ctx, param, value):
@@ -27,16 +27,6 @@ def cli(ctx):
27
27
  show_banner()
28
28
 
29
29
 
30
- for cmd in map(
31
- import_string,
32
- (
33
- "mpt_extension_sdk.runtime.commands.run.run",
34
- "mpt_extension_sdk.runtime.commands.django.django",
35
- ),
36
- ):
37
- cli.add_command(cmd)
38
-
39
-
40
30
  def make_django_command(name, django_command=None, help_value=None):
41
31
  """A wrapper to convert a Django subcommand a Click command."""
42
32
  if django_command is None:
@@ -59,11 +49,25 @@ def make_django_command(name, django_command=None, help_value=None):
59
49
  return inner
60
50
 
61
51
 
62
- cli.add_command(make_django_command("shell", help_value="Open Django console"))
52
+ def register_commands():
53
+ """Register django and extension run commands."""
54
+ cmds = map(
55
+ import_string,
56
+ (
57
+ "mpt_extension_sdk.runtime.commands.run.run",
58
+ "mpt_extension_sdk.runtime.commands.django.django",
59
+ ),
60
+ )
61
+
62
+ for cmd in cmds:
63
+ cli.add_command(cmd)
64
+
65
+ cli.add_command(make_django_command("shell", help_value="Open Django console"))
63
66
 
64
67
 
65
68
  def main():
66
69
  """Main entry point for the CLI."""
70
+ register_commands()
67
71
  cli(standalone_mode=False)
68
72
 
69
73
 
@@ -0,0 +1,11 @@
1
+ from importlib.metadata import PackageNotFoundError, version
2
+
3
+ try:
4
+ __version__ = version("swo-runtime")
5
+ except PackageNotFoundError: # pragma: no cover
6
+ __version__ = "0.0.0"
7
+
8
+
9
+ def get_version():
10
+ """Get the current version of the package."""
11
+ return __version__
@@ -1,5 +1,3 @@
1
- from mpt_extension_sdk.swo_rql.query_builder import RQLQuery
2
-
3
- R = RQLQuery
1
+ from mpt_extension_sdk.swo_rql.query_builder import R, RQLQuery # noqa: WPS347
4
2
 
5
3
  __all__ = ["R", "RQLQuery"]
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: mpt-extension-sdk
3
+ Version: 5.17.4
4
+ Summary: Extensions SDK for SoftwareONE Marketplace Platform
5
+ Author: SoftwareOne AG
6
+ License: Apache-2.0 license
7
+ License-File: LICENSE
8
+ Requires-Python: <4,>=3.12
9
+ Requires-Dist: azure-identity==1.25.*
10
+ Requires-Dist: azure-keyvault-secrets==4.10.*
11
+ Requires-Dist: azure-monitor-opentelemetry-exporter==1.0.0b46
12
+ Requires-Dist: click==8.3.*
13
+ Requires-Dist: debugpy==1.8.*
14
+ Requires-Dist: django-ninja==1.1.*
15
+ Requires-Dist: django==4.2.*
16
+ Requires-Dist: gunicorn==25.0.*
17
+ Requires-Dist: opentelemetry-api==1.39.0
18
+ Requires-Dist: opentelemetry-instrumentation-django==0.60.*
19
+ Requires-Dist: opentelemetry-instrumentation-logging==0.60.*
20
+ Requires-Dist: opentelemetry-instrumentation-requests==0.60.*
21
+ Requires-Dist: opentelemetry-sdk==1.39.0
22
+ Requires-Dist: pyfiglet==1.0.*
23
+ Requires-Dist: pyjwt==2.11.*
24
+ Requires-Dist: requests==2.32.*
25
+ Requires-Dist: rich==14.3.*
26
+ Requires-Dist: typing-extensions==4.15.*
27
+ Requires-Dist: watchfiles==1.1.*
28
+ Description-Content-Type: text/markdown
29
+
30
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=softwareone-platform_mpt-extension-sdk&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=softwareone-platform_mpt-extension-sdk)
31
+ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=softwareone-platform_mpt-extension-sdk&metric=coverage)](https://sonarcloud.io/summary/new_code?id=softwareone-platform_mpt-extension-sdk)
32
+
33
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
34
+
35
+ # SoftwareONE Extension SDK
36
+
37
+ SDK for SoftwareONE python extensions
38
+
39
+ ## Getting started
40
+
41
+ ### Prerequisites
42
+
43
+ - Docker and Docker Compose plugin (`docker compose` CLI)
44
+ - `make`
45
+ - Valid `.env` file
46
+ - Adobe credentials and authorizations JSON files in the project root
47
+ - [CodeRabbit CLI](https://www.coderabbit.ai/cli) (optional. Used for running review check locally)
48
+
49
+
50
+ ### Make targets overview
51
+
52
+ Common development workflows are wrapped in the `makefile`:
53
+
54
+ - `make help` – list available commands
55
+ - `make bash` – start the app container and open a bash shell
56
+ - `make build` – build the application image for development
57
+ - `make build-package` – build the package locally
58
+ - `make check` – run code quality checks (ruff, flake8, lockfile check)
59
+ - `make check-all` – run checks, formatting, and tests
60
+ - `make down` – stop and remove containers
61
+ - `make format` – apply formatting and import fixes
62
+ - `make review` – check the code in the cli by running CodeRabbit
63
+ - `make shell` – open a Django shell inside the running app container
64
+ - `make test` – run the test suite with pytest
65
+
66
+ ## Running tests
67
+
68
+ Tests run inside Docker using the dev configuration.
69
+
70
+ Run the full test suite:
71
+
72
+ ```bash
73
+ make test
74
+ ```
75
+
76
+ Pass additional arguments to pytest using the `args` variable:
77
+
78
+ ```bash
79
+ make test args="-k test_bla -vv"
80
+ make test args="tests/test_bla.py"
81
+ ```
82
+
83
+ ## Developer utilities
84
+
85
+ Useful helper targets during development:
86
+
87
+ ```bash
88
+ make bash # open a bash shell in the app container
89
+ make build-package # build the package locally
90
+ make check # run ruff, flake8, and lockfile checks
91
+ make check-all # run checks and tests
92
+ make format # auto-format code and imports
93
+ make review # check the code in the cli by running CodeRabbit
94
+ ```
@@ -16,17 +16,18 @@ mpt_extension_sdk/key_vault/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
16
16
  mpt_extension_sdk/key_vault/base.py,sha256=OnlBEhof_NMRToPQUO4Nrq-dnT_FPxr5FuSn3CRBQF0,3869
17
17
  mpt_extension_sdk/mpt_http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  mpt_extension_sdk/mpt_http/base.py,sha256=zVGW-ERSaTFzyAKWe-_vXwSX_balI1yZHW8Q9nppr4o,1689
19
- mpt_extension_sdk/mpt_http/mpt.py,sha256=30KVba-7m1pJ4SibjdnX-SsrkK9FGo9cLshYzUhkwu8,18516
19
+ mpt_extension_sdk/mpt_http/mpt.py,sha256=fPw-WOuBfVovi9Fa6et_VkLorPZihZr0h1ed3IdvbUQ,18847
20
20
  mpt_extension_sdk/mpt_http/utils.py,sha256=Ek2D4efcJNhQlOyXd4ZeBhwqDjFpvcbBEqxuCqRQ7cU,166
21
21
  mpt_extension_sdk/mpt_http/wrap_http_error.py,sha256=ULR5If8IJ9UAy137xDnOODcbMlqoW0Yc7gv6lxdbJuY,2435
22
- mpt_extension_sdk/runtime/__init__.py,sha256=YY7ChHKTXXv0a6_PG1F4pVASDzleSWMv_Zf7uX0UDyc,244
22
+ mpt_extension_sdk/runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  mpt_extension_sdk/runtime/errors.py,sha256=dO2038Ivj9lzHtOtpJrB5fwL03tUWNT0R6HUKxrzKa4,146
24
24
  mpt_extension_sdk/runtime/initializer.py,sha256=P_cbsR10NloHQ1dYZvTeaMOZmYFgrJF0PlEytWFF6rQ,2204
25
25
  mpt_extension_sdk/runtime/logging.py,sha256=BB5NSoHaprpQnummbQ3NkkA5Nz6rrsZMZwg_Q7pTDx4,1098
26
26
  mpt_extension_sdk/runtime/master.py,sha256=OoXLTTLoCrHWppMFtv90RGDImeg7-XWPYqH31cI9Lho,4956
27
- mpt_extension_sdk/runtime/swoext.py,sha256=wrZ1RzPOzKa2DTOXkhTTiTlT9LXM9u5AKki2lX3fsVY,1806
27
+ mpt_extension_sdk/runtime/swoext.py,sha256=LnKYsa_dzGlP-OjFneMkSokhXEmhnBgfV_wXuJGHKd8,1969
28
28
  mpt_extension_sdk/runtime/tracer.py,sha256=uJNRYDNoVeXButn5aF83W59upZdEZlIVH8hC8Wgi_Gw,459
29
29
  mpt_extension_sdk/runtime/utils.py,sha256=AWdr7KLRof4H1hJK71DGN97mh-zMfvoLfFu5H3DjKfo,5165
30
+ mpt_extension_sdk/runtime/version.py,sha256=iK8T_gbIXG-6nsBLxnuq-4ivHQ8_rlHywjxZNUC1iPA,277
30
31
  mpt_extension_sdk/runtime/workers.py,sha256=hnRviiT0ZQDNEVsvPB0qH7JET5v_-RMQQS-2hpZCrVM,2933
31
32
  mpt_extension_sdk/runtime/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
33
  mpt_extension_sdk/runtime/commands/django.py,sha256=Xsj4VjuYonekWSu6gL-qUHChMbo6tKuRVmCqEs2jeoA,1247
@@ -34,21 +35,22 @@ mpt_extension_sdk/runtime/commands/run.py,sha256=OaSMi14k7KnJBE1F6KSg-vd0L0VLErW
34
35
  mpt_extension_sdk/runtime/djapp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
36
  mpt_extension_sdk/runtime/djapp/apps.py,sha256=jJ_Gev5D_3nZa632IVnNoU1y54QaEaZsrmFAUC9uMcM,1655
36
37
  mpt_extension_sdk/runtime/djapp/middleware.py,sha256=lRi2U7rq5r8diqcJYCjO-bXxmzhCAFo7yikWDp_v9LQ,652
37
- mpt_extension_sdk/runtime/djapp/conf/__init__.py,sha256=zT_Ep9clWx3oXT6EJwY15vUrtk98TqbedXLV0MXptsw,401
38
+ mpt_extension_sdk/runtime/djapp/conf/__init__.py,sha256=ddbxTb-J-szdx6AJNnM_-TEr_31P2a5rCQRaY-z4xNY,165
38
39
  mpt_extension_sdk/runtime/djapp/conf/default.py,sha256=ZjyqHXq8qMJqKWMqnQ2EcRv2eJv7h43GA6njEhMs9R4,6445
40
+ mpt_extension_sdk/runtime/djapp/conf/product_utils.py,sha256=zT_Ep9clWx3oXT6EJwY15vUrtk98TqbedXLV0MXptsw,401
39
41
  mpt_extension_sdk/runtime/djapp/conf/urls.py,sha256=g-h1vzwDgCGLliSE2BDjb1eRJevZxZ7ehJrqSis12So,309
40
42
  mpt_extension_sdk/runtime/djapp/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
43
  mpt_extension_sdk/runtime/djapp/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
44
  mpt_extension_sdk/runtime/djapp/management/commands/consume_events.py,sha256=C7KPtN03ipPxMvlmHSqWqThzKl77OYELvMAoNMQ7WI8,1425
43
45
  mpt_extension_sdk/runtime/events/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
46
  mpt_extension_sdk/runtime/events/dispatcher.py,sha256=YQvGG_GseHKRbJrmpqY1Uhcmk3CSTxHEj61A8fmVm2k,3195
45
- mpt_extension_sdk/runtime/events/producers.py,sha256=RADf3IWpEwEGMJUVU4t0b4De2MaJGpRew0HUIWC5RW4,3753
47
+ mpt_extension_sdk/runtime/events/producers.py,sha256=tytOn56EHQEgSFQHscNicVdaGSHGFNiF_zS0Or5QCc8,3758
46
48
  mpt_extension_sdk/runtime/events/utils.py,sha256=GybK8Qs9Xj03Qqm98ulKeZzPiz92L-G9CwMwhZhBnkk,2747
47
- mpt_extension_sdk/swo_rql/__init__.py,sha256=QrvRDYhpK-Pd3OF-U2aMeazuKm_kbvXwLRIjd9Mm6ok,104
49
+ mpt_extension_sdk/swo_rql/__init__.py,sha256=gGheVyAaqDOwIeSVTHbcz-WTYt0-Q0kz4m1t-cmukns,109
48
50
  mpt_extension_sdk/swo_rql/constants.py,sha256=39BZ78OzdU_dIQtoy-Z_5utXqEXRweIFvM9Zfxg9j5M,171
49
51
  mpt_extension_sdk/swo_rql/query_builder.py,sha256=CG1dm7uJNPPCwWcf9sRD5zLbz-dtgECkQ_pX4QXpJPw,10825
50
- mpt_extension_sdk-5.17.2.dist-info/METADATA,sha256=4-GW8TzqwBMI64CDVG0dUsLyqzTjRB2EfHnSwyRmVFo,1347
51
- mpt_extension_sdk-5.17.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
52
- mpt_extension_sdk-5.17.2.dist-info/entry_points.txt,sha256=N8T9gBssEOm_UeBf9ABbGqtlnethrumfMoL4hNYWVFA,146
53
- mpt_extension_sdk-5.17.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
54
- mpt_extension_sdk-5.17.2.dist-info/RECORD,,
52
+ mpt_extension_sdk-5.17.4.dist-info/METADATA,sha256=SbqWMCUb8qC_bYnazx2k_RJeDMRdqsj5l4_NyPp195o,3384
53
+ mpt_extension_sdk-5.17.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
54
+ mpt_extension_sdk-5.17.4.dist-info/entry_points.txt,sha256=N8T9gBssEOm_UeBf9ABbGqtlnethrumfMoL4hNYWVFA,146
55
+ mpt_extension_sdk-5.17.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
+ mpt_extension_sdk-5.17.4.dist-info/RECORD,,
@@ -1,39 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: mpt-extension-sdk
3
- Version: 5.17.2
4
- Summary: Extensions SDK for SoftwareONE Marketplace Platform
5
- Author: SoftwareOne AG
6
- License: Apache-2.0 license
7
- License-File: LICENSE
8
- Requires-Python: <4,>=3.12
9
- Requires-Dist: azure-identity==1.25.*
10
- Requires-Dist: azure-keyvault-secrets==4.10.*
11
- Requires-Dist: azure-monitor-opentelemetry-exporter==1.0.0b25
12
- Requires-Dist: click==8.3.*
13
- Requires-Dist: debugpy==1.8.*
14
- Requires-Dist: django-ninja==1.1.*
15
- Requires-Dist: django==4.2.*
16
- Requires-Dist: gunicorn==23.0.*
17
- Requires-Dist: jinja2==3.1.*
18
- Requires-Dist: markdown-it-py==4.0.*
19
- Requires-Dist: openpyxl==3.1.*
20
- Requires-Dist: opentelemetry-api==1.30.*
21
- Requires-Dist: opentelemetry-instrumentation-django==0.51b0
22
- Requires-Dist: opentelemetry-instrumentation-logging==0.51b0
23
- Requires-Dist: opentelemetry-instrumentation-requests==0.51b0
24
- Requires-Dist: opentelemetry-sdk==1.30.*
25
- Requires-Dist: phonenumbers==9.0.*
26
- Requires-Dist: pyairtable==3.3.*
27
- Requires-Dist: pyfiglet==1.0.*
28
- Requires-Dist: pyjwt==2.10.*
29
- Requires-Dist: pymsteams==0.2.*
30
- Requires-Dist: regex==2024.11.*
31
- Requires-Dist: requests==2.32.*
32
- Requires-Dist: rich==14.2.*
33
- Requires-Dist: types-openpyxl==3.1.*
34
- Requires-Dist: typing-extensions==4.15.*
35
- Requires-Dist: watchfiles==1.1.*
36
- Description-Content-Type: text/markdown
37
-
38
- # swo-extension-sdk
39
- SDK for SoftwareONE python extensions