Skip to content

Commit dccaa90

Browse files
richdawe-cioclaude
andauthored
Release 1.0.0: remove support for Python 3.6, 3.7; fix linting errors (#5)
* Bump version to 1.0.0; drop support for Python 3.6, 3.7 because of requests requirement * Test with more recent Python 3.x versions * Fix pylint errors: missing __init__.py, import ordering, exception handling Add customerio/__init__.py so pylint can resolve the package hierarchy. Fix raise-missing-from, return-in-finally, and import ordering warnings. Fix RuntimeError formatting bug where %-placeholders were not interpolated. * mise venv for local development * Prefer using pip from venv to uv * Split linting out from tests * Add lint-ci which fails only on linting errors * Latest doc URLs --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 41203ee commit dccaa90

16 files changed

Lines changed: 101 additions & 38 deletions

File tree

‎.bumpversion.cfg‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.0.2
2+
current_version = 1.0.0
33
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
44
serialize =
55
{major}.{minor}.{patch}

‎.github/workflows/lint.yml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Lint
2+
3+
on: [push]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v6
11+
12+
- uses: actions/setup-python@v6
13+
with:
14+
python-version: "3.10"
15+
cache: 'pip'
16+
cache-dependency-path: setup.py
17+
18+
- run: pip3 install -e '.[test]'
19+
- run: make lint-ci

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v6
2222

23-
- uses: actions/setup-python@v4
23+
- uses: actions/setup-python@v6
2424
with:
2525
python-version: '3.x'
2626
cache: 'pip'

‎.github/workflows/test.yml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ jobs:
77
runs-on: ubuntu-latest
88

99
strategy:
10+
fail-fast: false
1011
matrix:
11-
python-version: [3.7, 3.8, 3.9]
12+
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ]
1213

1314
steps:
14-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v6
1516

16-
- uses: actions/setup-python@v4
17+
- uses: actions/setup-python@v6
1718
with:
1819
python-version: ${{ matrix.python-version }}
1920
cache: 'pip'

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ build
1111
.idea/
1212
.python-version
1313
venv
14+
.venv

‎.mise.toml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[env]
2+
MISE_FETCH_REMOTE_VERSIONS_TIMEOUT = "30s"
3+
4+
_.python.venv = {
5+
path = ".venv",
6+
create = true,
7+
}
8+
9+
[settings]
10+
python.uv_venv_auto = false
11+
python.venv_stdlib = true
12+
13+
[tools]
14+
python = "3.11"
15+
16+
[tasks.test]
17+
run = 'make install test'
18+
19+
[tasks.lint]
20+
run = 'make install lint'

‎Makefile‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@ install:
22
pip install --edit .[test]
33

44
test:
5-
pylint --rcfile=.pylintrc --reports=y --exit-zero customerio/analytics
6-
flake8 --max-complexity=10 --statistics customerio/analytics || true
75
python -m unittest customerio/analytics/test/*.py -v
86

9-
.PHONY: install test
7+
lint:
8+
pylint --rcfile=.pylintrc --reports=y --exit-zero customerio/analytics
9+
flake8 --max-complexity=10 --statistics --exit-zero customerio/analytics
10+
11+
lint-ci:
12+
pylint --rcfile=.pylintrc --exit-zero --fail-on=E customerio/analytics
13+
flake8 --max-complexity=10 --max-line-length=100 --statistics customerio/analytics
14+
15+
clean:
16+
rm -rf .venv
17+
mise deps
18+
19+
.PHONY: install test lint lint-ci clean

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Customer.io Data Pipelines analytics client for Python.
1+
# Customer.io Data Pipelines analytics client for Python.
22

33
## Installation
44

@@ -40,6 +40,6 @@ analytics.track(user_id=4, event='order_complete')
4040

4141
The links below contain more detailed documentation on how to use this library:
4242

43-
* [Documentation](https://customer.io/docs/cdp/sources/connections/servers/python/)
44-
* [Specs](https://customer.io/docs/cdp/sources/source-spec/source-events/)
43+
* [Documentation](https://docs.customer.io/integrations/data-in/connections/servers/python/)
44+
* [Specs](https://docs.customer.io/integrations/data-in/source-spec/incoming-data/)
4545
* [PyPi](https://pypi.org/project/customerio-cdp-analytics/)

‎customerio/__init__.py‎

Whitespace-only changes.

‎customerio/analytics/client.py‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
from datetime import datetime
2-
from uuid import uuid4
3-
import logging
4-
import numbers
51
import atexit
62
import json
3+
import logging
4+
import numbers
5+
import queue
6+
from datetime import datetime
7+
from uuid import uuid4
78

89
from dateutil.tz import tzutc
910

10-
from customerio.analytics.utils import guess_timezone, clean
1111
from customerio.analytics.consumer import Consumer, MAX_MSG_SIZE
1212
from customerio.analytics.request import post, DatetimeSerializer
13+
from customerio.analytics.utils import guess_timezone, clean
1314
from customerio.analytics.version import VERSION
1415

15-
import queue
16-
1716
ID_TYPES = (numbers.Number, str)
1817

1918

@@ -269,7 +268,9 @@ def _enqueue(self, msg):
269268
# Check message size.
270269
msg_size = len(json.dumps(msg, cls=DatetimeSerializer).encode())
271270
if msg_size > MAX_MSG_SIZE:
272-
raise RuntimeError('Message exceeds %skb limit. (%s)', str(int(MAX_MSG_SIZE / 1024)), str(msg))
271+
raise RuntimeError(
272+
'Message exceeds %dkb limit. (%s)' % (MAX_MSG_SIZE // 1024, msg)
273+
)
273274

274275
# if send is False, return msg as if it was successfully queued
275276
if not self.send:

0 commit comments

Comments
 (0)