From 3905b0923994ffc963274306614fef24aa70a2c6 Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 14:47:47 +0100 Subject: [PATCH 01/14] Dependabot --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0e28f6a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + + - package-ecosystem: pip + directory: "/" + schedule: + interval: weekly From f8cf1fcd6d91fbc41a2aa5ba1ce19b826884955d Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 14:48:02 +0100 Subject: [PATCH 02/14] Modernise GH workflows --- .github/workflows/lint.yml | 20 +++++++++++++++++--- .github/workflows/test.yml | 20 +++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c2a97a5..bba915d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,9 +1,19 @@ name: Lint -on: [push] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +permissions: + contents: read jobs: lint: + name: Lint + runs-on: ubuntu-latest steps: @@ -15,5 +25,9 @@ jobs: cache: 'pip' cache-dependency-path: setup.py - - run: pip3 install -e '.[test]' - - run: make lint-ci + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e '.[test]' + - name: Run lint + run: make lint-ci diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index adb4a24..128f419 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,19 @@ name: Test -on: [push] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +permissions: + contents: read jobs: test: + name: Test Python ${{ matrix.python-version }} + runs-on: ubuntu-latest strategy: @@ -20,5 +30,9 @@ jobs: cache: 'pip' cache-dependency-path: setup.py - - run: pip3 install -e '.[test]' - - run: make test + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e '.[test]' + - name: Run tests + run: make test From 2e3e9954046b4035ed5c3e03281343af91ac8217 Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 15:05:58 +0100 Subject: [PATCH 03/14] Switch to pyproject.toml --- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- pyproject.toml | 58 ++++++++++++++++++++++++++++++++++ setup.py | 64 ++------------------------------------ 4 files changed, 62 insertions(+), 64 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bba915d..e27411d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,7 +23,7 @@ jobs: with: python-version: "3.10" cache: 'pip' - cache-dependency-path: setup.py + cache-dependency-path: pyproject.toml - name: Install dependencies run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 128f419..1708342 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: 'pip' - cache-dependency-path: setup.py + cache-dependency-path: pyproject.toml - name: Install dependencies run: | diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..95f453d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,58 @@ +[build-system] +requires = ["setuptools>=77", "setuptools-scm>=8", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "customerio_cdp_analytics" +dynamic = ["version"] +# Version is derived from git tags via setuptools-scm (e.g. tag v3.0.0 → version 3.0.0) +description = "Customer.io Data Pipelines (CDP) Python bindings." +readme = "README.md" +requires-python = ">=3.8.0" +license = "MIT" +license-files = ["LICENSE"] +authors = [ + { name = "Peaberry Software Inc.", email = "support@customerio.com" }, +] +dependencies = [ + "requests>=2.32.4", + "monotonic~=1.6", + "backoff~=2.2", + "python-dateutil~=2.8", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", +] + +[project.optional-dependencies] +dev = [ + "build>=1.2.2", + "twine>=6.1.0", + "mock==2.0.0", + "pylint>=3.2.0", + "flake8==3.7.9", +] + +[project.urls] +Homepage = "https://github.com/customerio/cdp-analytics-python" +Releases = "https://github.com/customerio/cdp-analytics-python/releases" +Issues = "https://github.com/customerio/cdp-analytics-python/issues" + +[tool.setuptools_scm] +version_scheme = "guess-next-dev" +local_scheme = "no-local-version" + +[tool.setuptools.packages.find] +include = ["customerio*"] diff --git a/setup.py b/setup.py index e246339..df789d2 100644 --- a/setup.py +++ b/setup.py @@ -1,63 +1,3 @@ -import os -import sys +from setuptools import find_packages, setup -try: - from setuptools import setup -except ImportError: - from distutils.core import setup -# Don't import the module here, since deps may not be installed -sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'customerio','analytics')) -from version import VERSION - -long_description = ''' -Customer.io Data Pipelines (CDP) is a customer data platform to improve decision-making with real-time updates and deliver personalized experiences. - -This is the official python client that wraps the Customer.io Data Pipelines REST API (https://customer.io/docs/cdp/getting-started/cdp-getting-started/). -''' - -install_requires = [ - "requests>=2.32.4", - "monotonic~=1.6", - "backoff~=2.2", - "python-dateutil~=2.8" -] - -tests_require = [ - "mock==2.0.0", - "pylint>=3.2.0", - "flake8==3.7.9", -] - -setup( - name='customerio_cdp_analytics', - version=VERSION, - url='https://github.com/customerio/cdp-analytics-python', - author='Customer.io', - author_email='cdp@customer.io', - maintainer='Customer.io', - maintainer_email='cdp@customer.io', - test_suite='analytics.test.all', - packages=['customerio.analytics'], - python_requires='>=3.8.0', - license='MIT License', - install_requires=install_requires, - extras_require={ - 'test': tests_require - }, - description='Customer.io Data Pipelines (CDP) is a customer data platform to improve decision-making with real-time updates and deliver personalized experiences.', - long_description=long_description, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: 3.14", - ], -) +setup(packages=find_packages(include=["customerio", "customerio.*"])) From 96880ae21828deeb727946dddb9417fac718437f Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 15:08:29 +0100 Subject: [PATCH 04/14] Fix installs in GH workflows --- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e27411d..df8b236 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,6 +28,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -e '.[test]' + python -m pip install -e ".[dev]" - name: Run lint run: make lint-ci diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1708342..2196e8f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -e '.[test]' + python -m pip install -e . - name: Run tests run: make test From 337daf559ca89932477df137c2d6600bbb3c004f Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 15:27:54 +0100 Subject: [PATCH 05/14] Switch to core unittest.mock --- Makefile | 2 +- customerio/analytics/test/client.py | 2 +- customerio/analytics/test/consumer.py | 3 +-- pyproject.toml | 1 - requirements.txt | 1 - 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 0d6122a..5ce14e6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ install: - pip install --edit .[test] + pip install --edit . test: python -m unittest customerio/analytics/test/*.py -v diff --git a/customerio/analytics/test/client.py b/customerio/analytics/test/client.py index 512e136..5fc5835 100644 --- a/customerio/analytics/test/client.py +++ b/customerio/analytics/test/client.py @@ -1,7 +1,7 @@ from datetime import date, datetime import unittest +import unittest.mock as mock import time -import mock from customerio.analytics.version import VERSION from customerio.analytics.client import Client diff --git a/customerio/analytics/test/consumer.py b/customerio/analytics/test/consumer.py index 057f633..d10ded2 100644 --- a/customerio/analytics/test/consumer.py +++ b/customerio/analytics/test/consumer.py @@ -1,8 +1,7 @@ import json import time import unittest - -import mock +import unittest.mock as mock try: from queue import Queue diff --git a/pyproject.toml b/pyproject.toml index 95f453d..86cfa11 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,6 @@ classifiers = [ dev = [ "build>=1.2.2", "twine>=6.1.0", - "mock==2.0.0", "pylint>=3.2.0", "flake8==3.7.9", ] diff --git a/requirements.txt b/requirements.txt index 8636477..6a9d363 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ backoff==2.2.1 flake8==3.7.9 monotonic==1.6 -mock==2.0.0 pylint==3.3.3 python-dateutil==2.8.2 requests>=2.32.4 \ No newline at end of file From d8f43ab244334a1e2c21100be3b5c631c4491fe8 Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 15:33:18 +0100 Subject: [PATCH 06/14] Remove support for Python 3.8 --- .github/workflows/test.yml | 2 +- Makefile | 2 +- pyproject.toml | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2196e8f..a626f65 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ] steps: - uses: actions/checkout@v6 diff --git a/Makefile b/Makefile index 5ce14e6..74b1788 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ install: - pip install --edit . + python -m pip install --edit . test: python -m unittest customerio/analytics/test/*.py -v diff --git a/pyproject.toml b/pyproject.toml index 86cfa11..2497ee9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ dynamic = ["version"] # Version is derived from git tags via setuptools-scm (e.g. tag v3.0.0 → version 3.0.0) description = "Customer.io Data Pipelines (CDP) Python bindings." readme = "README.md" -requires-python = ">=3.8.0" +requires-python = ">=3.9.0" license = "MIT" license-files = ["LICENSE"] authors = [ @@ -27,7 +27,6 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", From ac6864368ca0ed6145569c795002a9ce6c303079 Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 15:41:20 +0100 Subject: [PATCH 07/14] Build GH workflow --- .github/workflows/build.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f27988c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Build + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + package: + name: Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.14" + cache: pip + cache-dependency-path: pyproject.toml + - name: Install build tools + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[dev]" + - name: Build and verify package + run: | + python -m build + python -m twine check dist/* From d49d50140ceb2151e3aa25e6f85056c97645e10d Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 15:41:32 +0100 Subject: [PATCH 08/14] Fix data center doc link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c2f61b..c82790f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ analytics.track(user_id=4, event='order_complete') ## Other Regions -If you're using a [different data center](https://customer.io/docs/accounts-and-workspaces/data-centers/) such as our EU region, you can specify an alternate endpoint: +If you're using a [different data center](https://docs.customer.io/accounts/settings/data-centers/) such as our EU region, you can specify an alternate endpoint: ```python from customerio import analytics From f97ba426a9f70cf555b1b28df74441d9e1b35df7 Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 16:00:09 +0100 Subject: [PATCH 09/14] Build target; parameterise python --- Makefile | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 74b1788..157619c 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,28 @@ +PYTHON ?= python3 + install: - python -m pip install --edit . + $(PYTHON) -m pip install . + +build: + rm -rf build + $(PYTHON) -m build test: - python -m unittest customerio/analytics/test/*.py -v + $(PYTHON) -m unittest customerio/analytics/test/*.py -v lint: - pylint --rcfile=.pylintrc --reports=y --exit-zero customerio/analytics - flake8 --max-complexity=10 --statistics --exit-zero customerio/analytics + $(PYTHON) -m pylint --rcfile=.pylintrc --reports=y --exit-zero customerio/analytics + $(PYTHON) -m flake8 --max-complexity=10 --statistics --exit-zero customerio/analytics lint-ci: - pylint --rcfile=.pylintrc --exit-zero --fail-on=E customerio/analytics - flake8 --max-complexity=10 --max-line-length=100 --statistics customerio/analytics + $(PYTHON) -m pylint --rcfile=.pylintrc --exit-zero --fail-on=E customerio/analytics + $(PYTHON) -m flake8 --max-complexity=10 --max-line-length=100 --statistics customerio/analytics clean: + rm -rf MANIFEST build dist customerio.egg-info + +realclean: rm -rf .venv mise deps -.PHONY: install test lint lint-ci clean +.PHONY: install build test lint lint-ci clean realclean From c555131484603d0c52f4f9e424b5b825e1ff813c Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 18:07:16 +0100 Subject: [PATCH 10/14] Review feedback --- .github/workflows/lint.yml | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index df8b236..75fe04e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/setup-python@v6 with: - python-version: "3.10" + python-version: "3.14" cache: 'pip' cache-dependency-path: pyproject.toml diff --git a/Makefile b/Makefile index 157619c..78da1d7 100644 --- a/Makefile +++ b/Makefile @@ -21,8 +21,8 @@ lint-ci: clean: rm -rf MANIFEST build dist customerio.egg-info -realclean: +clean-venv: rm -rf .venv mise deps -.PHONY: install build test lint lint-ci clean realclean +.PHONY: install build test lint lint-ci clean clean-venv From c7b2d145a180e929580880375ca3c157815b138c Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 18:13:27 +0100 Subject: [PATCH 11/14] Try to avoid Bugbot drip on code reviews --- .cursor/BUGBOT.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .cursor/BUGBOT.md diff --git a/.cursor/BUGBOT.md b/.cursor/BUGBOT.md new file mode 100644 index 0000000..a28e413 --- /dev/null +++ b/.cursor/BUGBOT.md @@ -0,0 +1,10 @@ +# Bugbot Review Rules + +## Core Principle: Comprehensive First-Pass Reviews + +**CRITICAL INSTRUCTION**: You must perform a complete, exhaustive analysis on the FIRST review of any changeset. Do NOT hold back observations or defer issues to later reviews. All feedback must be provided upfront. + +## Expected Behavior + +Your first review should be comprehensive enough that subsequent reviews only need to address newly changed code. The goal is to eliminate "surprise" feedback on code that was part of the initial changeset but somehow escaped earlier review. + From 45d4274f18d621a147f9f0416b4513a5f2786211 Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 18:13:44 +0100 Subject: [PATCH 12/14] Fix deps for running local lint --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 78da1d7..d800d4b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PYTHON ?= python3 install: - $(PYTHON) -m pip install . + $(PYTHON) -m pip install -e ".[dev]" build: rm -rf build From 702558846201e41ab93b29bee3dd8dcc3508012b Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 18:23:37 +0100 Subject: [PATCH 13/14] Read runtime version from package metadata instead of hardcoding Co-Authored-By: Claude Opus 4.6 (1M context) --- customerio/analytics/version.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/customerio/analytics/version.py b/customerio/analytics/version.py index 1e5a605..926cb3d 100644 --- a/customerio/analytics/version.py +++ b/customerio/analytics/version.py @@ -1 +1,3 @@ -VERSION = '1.0.0' +from importlib.metadata import version + +VERSION = version("customerio_cdp_analytics") From 7f64b4703c801a044917a496da7b3b486dbbae36 Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Thu, 25 Jun 2026 18:25:35 +0100 Subject: [PATCH 14/14] Upgrade flake8 to fix Python 3.14 compatibility flake8 3.7.9's pyflakes dependency uses ast.Str, which was removed in Python 3.14, causing "module 'ast' has no attribute 'Str'" in CI. Co-Authored-By: Claude Opus 4.6 (1M context) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2497ee9..6025c61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ dev = [ "build>=1.2.2", "twine>=6.1.0", "pylint>=3.2.0", - "flake8==3.7.9", + "flake8>=7.1.0", ] [project.urls]