Skip to content

Commit

Permalink
Merge branch 'master' into add-delete-records-support
Browse files Browse the repository at this point in the history
  • Loading branch information
wbarnha authored Mar 8, 2024
2 parents 99ed20f + 38e159a commit 9d873c4
Show file tree
Hide file tree
Showing 69 changed files with 3,743 additions and 324 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
67 changes: 67 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: CodeQL
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: 19 10 * * 6
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [python]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
202 changes: 202 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
name: CI/CD

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
release:
types: [created]
branches:
- 'master'
workflow_dispatch:

env:
FORCE_COLOR: "1" # Make tools pretty.
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_NO_PYTHON_VERSION_WARNING: "1"
PYTHON_LATEST: "3.12"
KAFKA_LATEST: "2.6.0"

# For re-actors/checkout-python-sdist
sdist-artifact: python-package-distributions

jobs:

build-sdist:
name: 📦 Build the source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
- run: python -m pip install build
name: Install core libraries for build and install
- name: Build artifacts
run: python -m build
- name: Upload built artifacts for testing
uses: actions/upload-artifact@v4
with:
name: ${{ env.sdist-artifact }}
# NOTE: Exact expected file names are specified here
# NOTE: as a safety measure — if anything weird ends
# NOTE: up being in this dir or not all dists will be
# NOTE: produced, this will fail the workflow.
path: dist/${{ env.sdist-name }}
retention-days: 15

test-python:
name: Tests on ${{ matrix.python-version }}
needs:
- build-sdist
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy3.9"
experimental: [ false ]
include:
- python-version: "~3.13.0-0"
experimental: true
steps:
- name: Checkout the source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
requirements-dev.txt
- name: Check Java installation
run: source travis_java_install.sh
- name: Pull Kafka releases
run: ./build_integration.sh
env:
PLATFORM: ${{ matrix.platform }}
KAFKA_VERSION: ${{ env.KAFKA_LATEST }}
# TODO: Cache releases to expedite testing
- name: Install dependencies
run: |
sudo apt install -y libsnappy-dev libzstd-dev
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
pip install .
pip install -r requirements-dev.txt
- name: Test with tox
run: tox
env:
PLATFORM: ${{ matrix.platform }}
KAFKA_VERSION: ${{ env.KAFKA_LATEST }}

test-kafka:
name: Tests for Kafka ${{ matrix.kafka-version }}
needs:
- build-sdist
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
kafka-version:
- "0.9.0.1"
- "0.10.2.2"
- "0.11.0.2"
- "0.11.0.3"
- "1.1.1"
- "2.4.0"
- "2.5.0"
- "2.6.0"
experimental: [false]
include:
- kafka-version: '0.8.2.2'
experimental: true
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout the source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
cache-dependency-path: |
requirements-dev.txt
- name: Pull Kafka releases
run: ./build_integration.sh
env:
# This is fast enough as long as you pull only one release at a time,
# no need to worry about caching
PLATFORM: ${{ matrix.platform }}
KAFKA_VERSION: ${{ matrix.kafka-version }}
- name: Install dependencies
run: |
sudo apt install -y libsnappy-dev libzstd-dev
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
pip install .
pip install -r requirements-dev.txt
- name: Test with tox
run: tox
env:
PLATFORM: ${{ matrix.platform }}
KAFKA_VERSION: ${{ matrix.kafka-version }}

check: # This job does nothing and is only used for the branch protection
name: ✅ Ensure the required checks passing
if: always()
needs:
- build-sdist
- test-python
- test-kafka
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
publish:
name: 📦 Publish to PyPI
runs-on: ubuntu-latest
needs: [build-sdist]
permissions:
id-token: write
environment: pypi
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- name: Download the artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.sdist-artifact }}
path: dist/${{ env.sdist-name }}
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ python:
- 2.7
- 3.4
- 3.7
- 3.8
- pypy2.7-6.0

env:
Expand All @@ -16,11 +17,13 @@ env:
- KAFKA_VERSION=1.1.1
- KAFKA_VERSION=2.4.0
- KAFKA_VERSION=2.5.0
- KAFKA_VERSION=2.6.0

addons:
apt:
packages:
- libsnappy-dev
- libzstd-dev
- openjdk-8-jdk

cache:
Expand Down
44 changes: 43 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
# 2.0.2 (Sep 29, 2020)

Consumer
* KIP-54: Implement sticky partition assignment strategy (aynroot / PR #2057)
* Fix consumer deadlock when heartbeat thread request timeout (huangcuiyang / PR #2064)

Compatibility
* Python 3.8 support (Photonios / PR #2088)

Cleanups
* Bump dev requirements (jeffwidman / PR #2129)
* Fix crc32c deprecation warning (crc32c==2.1) (jeffwidman / PR #2128)
* Lint cleanup (jeffwidman / PR #2126)
* Fix initialization order in KafkaClient (pecalleja / PR #2119)
* Allow installing crc32c via extras (mishas / PR #2069)
* Remove unused imports (jameslamb / PR #2046)

Admin Client
* Merge _find_coordinator_id methods (jeffwidman / PR #2127)
* Feature: delete consumergroups (swenzel / PR #2040)
* Allow configurable timeouts in admin client check version (sunnyakaxd / PR #2107)
* Enhancement for Kafka Admin Client's "Describe Consumer Group" (Apurva007 / PR #2035)

Protocol
* Add support for zstd compression (gabriel-tincu / PR #2021)
* Add protocol support for brokers 1.1.0 - 2.5.0 (gabriel-tincu / PR #2038)
* Add ProduceRequest/ProduceResponse v6/v7/v8 (gabriel-tincu / PR #2020)
* Fix parsing NULL header values (kvfi / PR #2024)

Tests
* Add 2.5.0 to automated CI tests (gabriel-tincu / PR #2038)
* Add 2.1.1 to build_integration (gabriel-tincu / PR #2019)

Documentation / Logging / Errors
* Disable logging during producer object gc (gioele / PR #2043)
* Update example.py; use threading instead of multiprocessing (Mostafa-Elmenbawy / PR #2081)
* Fix typo in exception message (haracejacob / PR #2096)
* Add kafka.structs docstrings (Mostafa-Elmenbawy / PR #2080)
* Fix broken compatibility page link (anuragrana / PR #2045)
* Rename README to README.md (qhzxc0015 / PR #2055)
* Fix docs by adding SASL mention (jeffwidman / #1990)

# 2.0.1 (Feb 19, 2020)

Admin Client
Expand Down Expand Up @@ -371,7 +413,7 @@ Some of the major changes include:
* SASL authentication is working (we think)
* Removed several circular references to improve gc on close()

Thanks to all contributors -- the state of the kafka-python community is strong!
Thanks to all contributors -- the state of the kafka-python-ng community is strong!

Detailed changelog are listed below:

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ test37: build-integration
test27: build-integration
KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) tox -e py27 -- $(FLAGS)

# Test using py.test directly if you want to use local python. Useful for other
# Test using pytest directly if you want to use local python. Useful for other
# platforms that require manual installation for C libraries, ie. Windows.
test-local: build-integration
KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) py.test \
KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) pytest \
--pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF $(FLAGS) kafka test

cov-local: build-integration
KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) py.test \
KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) pytest \
--pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF --cov=kafka \
--cov-config=.covrc --cov-report html $(FLAGS) kafka test
@echo "open file://`pwd`/htmlcov/index.html"

# Check the readme for syntax errors, which can lead to invalid formatting on
# PyPi homepage (https://pypi.python.org/pypi/kafka-python)
# PyPi homepage (https://pypi.python.org/pypi/kafka-python-ng)
check-readme:
python setup.py check -rms

Expand Down
Loading

0 comments on commit 9d873c4

Please sign in to comment.