Skip to content

Modernise for Python 3.10–3.14, fix fresh installs, publish SBOMs - #157

Merged
fkilfoyleld merged 2 commits into
mainfrom
chore/modernise-sbom-dependencytrack
Oct 12, 2026
Merged

fkilfoyleld merged 2 commits into
mainfrom
chore/modernise-sbom-dependencytrack

Conversation

@fkilfoyleld

@fkilfoyleld fkilfoyleld commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Why

  • A fresh install of commercetools is broken today. install_requires allows any marshmallow>=3.10.0; with marshmallow 4 the package fails to import (cannot import name 'RAISE' from 'marshmallow.utils'). This affects the published 2023.6.29 too, for anyone who doesn't pin marshmallow.
  • The SDK is used in 25 client repos. This release also brings SBOM publishing and DependencyTrack monitoring, same pattern as labd/ecs-deplojo and labd/django-postcode-lookup.

Changes

  • marshmallow>=3.10.0,<4.
  • python_requires=">=3.10", classifiers and CI for 3.10–3.14. tox.ini only mapped up to 3.10, so the 3.11/3.12 CI jobs ran no tests.
  • testing/predicates.py: ast.Str/ast.Num/ast.NameConstant (removed in Python 3.14) → ast.Constant.
  • testing/products.py: invalid escape sequence in a route regex.
  • Test deps: freezegun 1.5.5 (1.2.0 breaks on 3.13), pytest 9.0.3, pytest-cov 7.1.0. test_auto_refresh sleeps 1.5s instead of exactly its 1s expiry (was flaky).
  • Workflows: all actions pinned to SHAs, least-privilege permissions, persist-credentials: false. Adds pinact.yaml and zizmor.yaml from @demeyerthom's Add pinact and zizmor workflow checks #156.
  • Release workflow:
    • Publish with pypa/gh-action-pypi-publish v1.14.2 (twine 7).
    • Install the built wheel into a clean env, scan with syft, attach commercetools.spdx.json and commercetools.cdx.json (CycloneDX 1.6) to the release.
    • Separate dependencytrack job uploads the CycloneDX SBOM as version <version> of oss/python/commercetools (isLatest=true). It holds DEPENDENCYTRACK_OSS_APIKEY, does no checkout and runs no repo code.
  • Version 2026.10.12.

Breaking changes

Listed first under 26.10.12 in CHANGES.md: methods return None instead of raising on not-found, scope required on Client, commercetools.services.* removed (prepared as 24.4.6, never released), and Python 3.10+.

Checks

  • Locally: tox py310/py313 and coverage-report pass; 174 passed on Python 3.10, 3.13, 3.14 (marshmallow 3.26.2). black/isort clean.
  • Release SBOM built locally from the wheel: 18 packages, grype clean.
  • actionlint, pinact run --check --verify-comment, zizmor (only the trusted-publishing note).
  • The existing '**:**' pull_request branch filter is flagged by actionlint; left as is.

Supersedes #153, #155 and #156.

- Pin marshmallow below 4: a fresh install with marshmallow 4 failed to
  import (cannot import name 'RAISE' from 'marshmallow.utils').
- Require Python 3.10+, test 3.10-3.14 (tox only mapped up to 3.10, so
  the 3.11/3.12 CI jobs ran no tests).
- Replace ast.Str/Num/NameConstant (removed in Python 3.14) with
  ast.Constant in the testing predicates; fix an invalid escape sequence.
- Update freezegun (1.2.0 broke on Python 3.13), pytest and pytest-cov;
  give the token auto-refresh test a margin past its 1s expiry.
- Workflows: pin all actions, least-privilege permissions,
  persist-credentials: false; add pinact and zizmor checks (from #156).
- Release: publish with gh-action-pypi-publish v1.14.2, generate a
  runtime SBOM from the built wheel, attach SPDX and CycloneDX to the
  release, and upload to DependencyTrack (oss/python/commercetools) from a
  separate job that runs no repo code.
- Version 2026.10.12.
- CHANGES.md: breaking changes at the top of 26.10.12, folding in the
  unreleased 24.4.6 entries; Python 3.10+ is marked breaking too.
- coverage paths: map .tox/*/lib/python*/site-packages back to src. Now
  that tests run on every Python version, coverage combine/xml failed
  with "No source for code".
@fkilfoyleld
fkilfoyleld merged commit b1df130 into main Oct 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant