forked from segmentio/analytics-python
-
Notifications
You must be signed in to change notification settings - Fork 1
Modernize Python CI and packaging #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3905b09
Dependabot
richdawe-cio f8cf1fc
Modernise GH workflows
richdawe-cio 2e3e995
Switch to pyproject.toml
richdawe-cio 96880ae
Fix installs in GH workflows
richdawe-cio 337daf5
Switch to core unittest.mock
richdawe-cio d8f43ab
Remove support for Python 3.8
richdawe-cio ac68643
Build GH workflow
richdawe-cio d49d501
Fix data center doc link
richdawe-cio f97ba42
Build target; parameterise python
richdawe-cio c555131
Review feedback
richdawe-cio c7b2d14
Try to avoid Bugbot drip on code reviews
richdawe-cio 45d4274
Fix deps for running local lint
richdawe-cio 7025588
Read runtime version from package metadata instead of hardcoding
richdawe-cio 7f64b47
Upgrade flake8 to fix Python 3.14 compatibility
richdawe-cio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,33 @@ | ||
| name: Lint | ||
|
|
||
| on: [push] | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.10" | ||
| python-version: "3.14" | ||
| cache: 'pip' | ||
| cache-dependency-path: setup.py | ||
| cache-dependency-path: pyproject.toml | ||
|
|
||
| - run: pip3 install -e '.[test]' | ||
| - run: make lint-ci | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install -e ".[dev]" | ||
| - name: Run lint | ||
| run: make lint-ci |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,28 @@ | ||
| PYTHON ?= python3 | ||
|
|
||
| install: | ||
| pip install --edit .[test] | ||
| $(PYTHON) -m pip install -e ".[dev]" | ||
|
|
||
| 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 | ||
|
|
||
| clean-venv: | ||
| rm -rf .venv | ||
| mise deps | ||
|
|
||
| .PHONY: install test lint lint-ci clean | ||
| .PHONY: install build test lint lint-ci clean clean-venv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| import json | ||
| import time | ||
| import unittest | ||
|
|
||
| import mock | ||
| import unittest.mock as mock | ||
|
|
||
| try: | ||
| from queue import Queue | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| VERSION = '1.0.0' | ||
| from importlib.metadata import version | ||
|
|
||
| VERSION = version("customerio_cdp_analytics") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| [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.9.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.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", | ||
| "pylint>=3.2.0", | ||
| "flake8>=7.1.0", | ||
| ] | ||
|
|
||
| [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*"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.*"])) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.