Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install build requirements
run: python -m pip install wheel
run: python -m pip install setuptools wheel
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
27 changes: 14 additions & 13 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"

- name: Install dependencies
run: pip install tox
Expand All @@ -32,12 +32,12 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -52,26 +52,27 @@ jobs:
- name: Prepare artifacts
run: mkdir .coverage-data && mv .coverage.* .coverage-data/

- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ matrix.python-version }}
path: .coverage-data/
include-hidden-files: true

coverage:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@master
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
path: .
merge-multiple: true

- name: Set up Python 3.10
uses: actions/setup-python@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"

- name: Install dependencies
run: |
Expand Down
11 changes: 11 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
26.9.28
-------
- Add Python 3.12 support and drop Python 3.6-3.11 (`python_requires >= 3.12`).
- Import `RAISE` from `marshmallow` instead of `marshmallow.utils`.
- Require `marshmallow>=3.13`: deserialization fails on 3.10-3.12.
- Cap `marshmallow<4`: 4.x removes APIs used by `helpers.Discriminator`.
- Install setuptools explicitly for release builds (Python 3.12 ships without it).
- Update test tooling for Python 3.12 (pytest, pytest-cov, flake8, mypy).
- Pin `pypi-publish` and artifact actions instead of tracking `@master`.
- Fix timing flake in `test_auto_refresh`.

23.6.29
--------
- Regenerate code with latest RAML specifications, bringing the SDK up to date
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ format:
black src/ tests/

release:
pip install twine wheel
pip install setuptools twine wheel
rm -rf build/* dist/*
python setup.py sdist bdist_wheel
twine upload dist/*
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Python SDK for Commercetools
============================

This is an unofficial Python SDK for the Commercetools platform. It only
supports Python 3.6+ and uses type annotation for an improved development
supports Python 3.12+ and uses type annotation for an improved development
experience.

The API is generated using the commercetools api RAML file and uses
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Commercetools Python SDK
========================

This is an unofficial Python SDK for the Commercetools platform. It only
supports Python 3.6+ and uses type annotation for an improved development
supports Python 3.12+ and uses type annotation for an improved development
experience.

The API is mostly generated using the commercetools api RAML file and uses the
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[mypy]
ignore_missing_imports = True
python_version = 3.6
python_version = 3.12
warn_unused_configs = True
mypy_path = src
check_untyped_defs = True
25 changes: 12 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"pytz",
"requests-oauthlib>=1.0.0",
"requests_mock>=1.8.0",
"marshmallow>=3.10.0",
# marshmallow 4 drops `default=`, `Schema(context=)` and `Field.fail()`, all
# used by helpers.Discriminator; hold at 3.x until that is ported.
"marshmallow>=3.13.0,<4",
"marshmallow-enum>=1.5.1",
"WebOb>=1.8.0",
"Werkzeug>=0.15.2",
Expand All @@ -25,15 +27,14 @@
"mock==4.0.3",
"pretend==1.0.9",
"coverage[toml]>=6.2",
"pytest-cov==3.0.0",
"pytest==7.0.1",
"pytest-cov==7.1.0",
"pytest==9.1.1",
# Linting
"isort==5.10.1",
"flake8==4.0.1",
"flake8-blind-except==0.2.0",
"flake8-debugger==4.0.0",
"flake8-imports==0.1.1",
"mypy==0.931",
"flake8==7.4.1",
"flake8-blind-except==0.2.1",
"flake8-debugger==4.1.2",
"mypy==2.3.1",
]


Expand All @@ -44,12 +45,13 @@

setup(
name="commercetools",
version="2023.6.29",
version="2026.9.28",
description="SDK for Commercetools",
long_description=long_description,
author="Lab Digital B.V.",
author_email="opensource@labdigital.nl",
url="https://github.com/labd/commercetools-python-sdk",
python_requires=">=3.12",
install_requires=install_requires,
tests_require=tests_require,
extras_require={
Expand All @@ -65,10 +67,7 @@
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
],
zip_safe=False,
Expand Down
4 changes: 2 additions & 2 deletions src/commercetools/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import inspect
import typing

from marshmallow import Schema, class_registry, fields, missing, post_dump
from marshmallow import RAISE, Schema, class_registry, fields, missing, post_dump
from marshmallow.exceptions import (
RegistryError,
StringNotCollectionError,
ValidationError,
)
from marshmallow.fields import Field, Nested
from marshmallow.utils import RAISE, is_collection
from marshmallow.utils import is_collection
from marshmallow.utils import missing as missing_

from commercetools.exceptions import CommercetoolsError
Expand Down
2 changes: 1 addition & 1 deletion src/commercetools/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2023.6.29"
__version__ = "2026.9.28"
3 changes: 2 additions & 1 deletion tests/platform/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def test_auto_refresh(commercetools_api):
token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token",
)
client.products.query()
time.sleep(1)
# oauthlib stores an integer expires_at, so wait past the 1s expiry with margin
time.sleep(2)
client.products.query()
client.products.query()

Expand Down
12 changes: 4 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
[tox]
envlist = py36,py37,py38,py39,py310
envlist = py312

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.12: py312

[testenv]
commands = coverage run --source commercetools --parallel -m pytest {posargs}
extras = test

[testenv:coverage-report]
basepython = python3.10
basepython = python3.12
deps = coverage[toml]
skip_install = true
commands =
Expand All @@ -23,7 +19,7 @@ commands =
coverage report

[testenv:format]
basepython = python3.10
basepython = python3.12
deps =
black==22.6.0
isort[toml]==5.10.1
Expand Down
Loading