Skip to content
Merged
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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly

- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
93 changes: 66 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,78 @@
name: build
name: CI

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
lint:
name: Lint and format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
cache: pip
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Run ruff
run: |
python -m ruff check .
python -m ruff format --check .

test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml
- name: Install package
run: |
python -m pip install --upgrade pip
python -m pip install -e .
- name: Run tests
run: make test

package:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.6.0
with:
python-version: ${{ matrix.python }}
- name: install dependencies for the minor version
Comment thread
hownowstephen marked this conversation as resolved.
run: |
python -m venv venv
. venv/bin/activate
pip install -r requirements.txt
- name: run tests
run: |
. venv/bin/activate
make test
deactivate
- name: reinstall to the latest version
run: |
python -m venv venv
. venv/bin/activate
pip install --upgrade requests
- name: run tests again
run: |
. venv/bin/activate
make test
- uses: actions/checkout@v6
- 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/*
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
*.pyc
*.pyo
.venv/
.coverage
.ruff_cache/
.pytest_cache/
tests/server.pem
dist
customerio.egg-info
.DS_Store
MANIFEST
build/
setup.cfg
setup.cfg
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
prune tests
30 changes: 21 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
PYTHON ?= python3
OPENSSL ?= openssl
SERVER_CERT := tests/server.pem

all:
$(PYTHON) setup.py sdist
all: build
$(PYTHON) -m doctest ./customerio/__init__.py

install:
$(PYTHON) setup.py install
$(PYTHON) -m pip install .

clean:
$(PYTHON) setup.py clean
rm -rf MANIFEST build dist
rm -rf MANIFEST build dist customerio.egg-info .ruff_cache

dev: clean all
if ! pip uninstall customerio; then echo "customerio not installed, installing it for the first time" ; fi
pip install dist/*
$(PYTHON) -i -c "from customerio import *"

upload:
$(PYTHON) setup.py register
echo "*** Now upload the binary to PyPi *** (one second)" && sleep 3 && open dist & open "http://pypi.python.org/pypi?%3Aaction=pkg_edit&name=customerio" # python setup.py upload
$(PYTHON) -m twine upload dist/*

test:
openssl req -new -newkey rsa:2048 -days 10 -nodes -x509 -subj "/C=CA/ST=Ontario/L=Toronto/O=Test/CN=127.0.0.1" -keyout ./tests/server.pem -out ./tests/server.pem
build:
$(PYTHON) -m build

lint:
$(PYTHON) -m ruff check .
$(PYTHON) -m ruff format --check .

format:
$(PYTHON) -m ruff check --fix .
$(PYTHON) -m ruff format .

test: $(SERVER_CERT)
$(PYTHON) -m unittest discover -v

$(SERVER_CERT):
$(OPENSSL) req -new -newkey rsa:2048 -days 10 -nodes -x509 -subj "/C=CA/ST=Ontario/L=Toronto/O=Test/CN=127.0.0.1" -keyout $(SERVER_CERT) -out $(SERVER_CERT)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/customerio)
![PyPI - Downloads](https://img.shields.io/pypi/dm/customerio)

# Customer.io Python
# Customer.io Python

This module has been tested with Python 3.6, 3.7, 3.8 and 3.9. If you're new to Customer.io, we recommend that you integrate with our [Data Pipelines Python library](https://github.com/customerio/cdp-analytics-python) instead.
This module is tested with Python 3.10 through 3.14. If you're new to Customer.io, we recommend that you integrate with our [Data Pipelines Python library](https://github.com/customerio/cdp-analytics-python) instead.

## Installing

Expand Down
25 changes: 21 additions & 4 deletions customerio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
import warnings

from customerio.api import (
APIClient,
SendEmailRequest,
SendInAppRequest,
SendInboxMessageRequest,
SendPushRequest,
SendSMSRequest,
)
from customerio.client_base import CustomerIOException
from customerio.track import CustomerIO
from customerio.api import APIClient, SendEmailRequest, SendPushRequest, SendSMSRequest, SendInboxMessageRequest, SendInAppRequest
from customerio.regions import Regions
from customerio.track import CustomerIO

__all__ = [
"APIClient",
"CustomerIO",
"CustomerIOException",
"Regions",
"SendEmailRequest",
"SendInAppRequest",
"SendInboxMessageRequest",
"SendPushRequest",
"SendSMSRequest",
]
15 changes: 1 addition & 14 deletions customerio/__version__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
VERSION = (2, 4, 0, 'final', 0)

def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s-pre-alpha' % version
else:
if VERSION[3] != 'final':
version = '%s-%s-%s' % (version, VERSION[3], VERSION[4])
return version

__version__=get_version()
__version__ = "2.4.0"
Comment thread
hownowstephen marked this conversation as resolved.
Loading