Skip to content

Commit

Permalink
Merge pull request #14 from lsst-sqre/tickets/DM-35548
Browse files Browse the repository at this point in the history
DM-35548: Update packaging and other clean up
  • Loading branch information
jonathansick authored Jul 15, 2022
2 parents 97e5792 + c279b17 commit af3d533
Show file tree
Hide file tree
Showing 29 changed files with 534 additions and 387 deletions.
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[flake8]
max-line-length = 79
# Ignored rules for Black
# E203 whitespace before ':'
# W503: line break before binary operator
ignore = E203 W503
exclude =
docs/conf.py
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: "docker"
directory: "/"
schedule:
interval: "weekly"
107 changes: 65 additions & 42 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,78 +1,101 @@
name: Python CI

on: [push]
"on":
push:
branches-ignore:
# These should always correspond to pull requests, so ignore them for
# the push trigger and let them be triggered by the pull_request
# trigger, avoiding running the workflow twice. This is a minor
# optimization so there's no need to ensure this is comprehensive.
- "dependabot/**"
- "renovate/**"
- "tickets/**"
- "u/**"
tags:
- "*"
pull_request: {}

jobs:
lint:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Run pre-commit
uses: pre-commit/[email protected]

test:

runs-on: ubuntu-latest

strategy:
matrix:
python:
- 3.7
- 3.8
- "3.8"
- "3.9"
- "3.10"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
- name: Run tox
uses: lsst-sqre/run-tox@v1
with:
python-version: ${{ matrix.python }}

- name: Install tox
run: pip install tox

- name: Run tox
run: tox -e py,lint,typing # run tox using Python in path
tox-envs: "py,typing"

docs:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
- uses: actions/checkout@v3
with:
python-version: 3.7
fetch-depth: 0 # full history for setuptools_scm

- name: Install tox and LTD Conveyor
run: pip install tox ltd-conveyor
- name: Install Graphviz
run: sudo apt-get install graphviz

- name: Run tox
run: tox -e docs
uses: lsst-sqre/run-tox@v1
with:
python-version: "3.10"
tox-envs: "docs,docs-linkcheck"

# Only attempt documentation uploads for tagged releases and pull
# requests from ticket branches in the same repository. This avoids
# version clutter in the docs and failures when a PR doesn't have access
# to secrets.
- name: Upload to LSST the Docs
env:
LTD_USERNAME: travis
LTD_PASSWORD: ${{ secrets.LTD_PASSWORD }}
run: ltd upload --product kafkit --gh --dir docs/_build/html
uses: lsst-sqre/ltd-upload@v1
with:
project: "kafkit"
dir: "docs/_build/html"
username: ${{ secrets.LTD_USERNAME }}
password: ${{ secrets.LTD_PASSWORD }}
if: >
github.event_name != 'pull_request'
|| startsWith(github.head_ref, 'tickets/')
pypi:

runs-on: ubuntu-latest
needs: [test, docs]
if: startsWith(github.ref, 'refs/tags/')
needs: [lint, test, docs]

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
- uses: actions/checkout@v3
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel twine
fetch-depth: 0 # full history for setuptools_scm

- name: Build and publish
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
uses: lsst-sqre/build-and-publish-to-pypi@v1
with:
pypi-token: ${{ secrets.PYPI_SQRE_ADMIN }}
python-version: "3.10"
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
58 changes: 58 additions & 0 deletions .github/workflows/periodic-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This is a separate run of the Python test suite that doesn't cache the tox
# environment and runs from a schedule. The purpose is to test compatibility
# with the latest versions of dependencies.

name: Periodic CI

"on":
schedule:
- cron: "0 12 * * 1"

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python:
- "3.8"
- "3.9"
- "3.10"

steps:
- uses: actions/checkout@v3

- name: Run tests in tox
uses: lsst-sqre/run-tox@v1
with:
python-version: "${{ matrix.python }}"
tox-envs: "lint,typing,py"
use-cache: false

docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Build docs in tox
uses: lsst-sqre/run-tox@v1
with:
python-version: "3.10"
tox-envs: "docs,docs-linkcheck"
use-cache: false

pypi:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # full history for setuptools_scm

- name: Build and publish
uses: lsst-sqre/build-and-publish-to-pypi@v1
with:
pypi-token: ""
python-version: "3.10"
upload: false
68 changes: 30 additions & 38 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,36 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: check-yaml
- id: check-toml
- id: check-json
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: check-toml

- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
rev: v1.0.0
hooks:
- id: rst-linter
files: (README\.rst)|(CHANGELOG\.rst)
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
additional_dependencies: [toml]

- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.4
hooks:
- id: seed-isort-config
args: [--exclude=docs/.*\.py, --application-directories, src]
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black

- repo: https://github.com/timothycrosley/isort
rev: 4.3.21-2
hooks:
- id: isort
additional_dependencies:
- toml
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==22.6.0]
args: [-l, '79', -t, py38]

- repo: https://github.com/ambv/black
rev: 19.10b0
hooks:
- id: black
- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle
additional_dependencies: [toml]

- repo: https://github.com/asottile/blacken-docs
rev: v1.5.0-1
hooks:
- id: blacken-docs
additional_dependencies: [black==19.10b0]
args: [-l, "79", -t, py37]

- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Change log

## 0.2.0 (2022-07-15)

- Python versions 3.7 and earlier are no longer supported because Kafkit is adopting the `annotations` import from `__future__` and native support for `importlib.metadata`.
Kafkit is explicitly tested with Python 3.8, 3.9, and 3.10.

- We've added a `kafkit.ssl` module to help connect to Kafka brokers over TLS.
The associated documentation includes a tutorial for working with the SSL certificates generated in a Kafka cluster managed by [Strimzi](https://strimzi.io).

- The brand-new `kafkit.registry.manager.RecordNameSchemaManager` provides a streamlined workflow for serializing Avro messages using Avro schemas that are maintained in your app's codebase.
The manager handles schema registration for you.
To serialize a message, you simply need to provide the data and the name of the schema.

- A new `kafkit.registry.sansio.CompatibilityType` Enum helps you write use valid Schema Registry compatibility types.

- We've significantly improved Kafkit's packaging and infrastructure:

- Migrate packaging metadata from `setup.py` to `pyproject.toml` (Kafkit continues to be a setuptools-based project).
- Tox now runs tasks like tests, in conjunction with the existing Pytest set up.
- Pre-commit hooks lint and format the code base.
- Code style is now handled by Black (and in the documentation with blacken-docs).
- **Full support for type annotations!** `tox -e typing` validates Kafkit's type annotations with Mypy.
- We've migrated from Travis CI to GitHub Actions.

- The documentation now includes a development guide.

## 0.1.1 (2019-02-13)

Several fixes:

- `RegistryApi.put` was doing a `PATCH` behind the scenes. That's fixed now.
- The `RegistryApi.put`, `patch`, and `delete` methods weren't returning data. That's fixed now as well.
- All of the RegistryApi's low-level HTTP methods have more thorough unit testing now to avoid these issues in the future.

## 0.1.0 (2019-01-30)

Initial release of Kafkit!

This release includes the `kafkit.registry` package with a working [Confluent Schema Registry](https://docs.confluent.io/current/schema-registry/docs/index.html) API client implemented with a sans I/O design.
There are two client implementations.
One is designed for [aiohttp](https://aiohttp.readthedocs.io/en/stable/) users (`kafkit.registry.aiohttp.RegistryClient`), and the other is for I/O-free unit testing (`kafkit.registry.sansio.MockRegistryApi`).
The clients include schema caches so they can be used as both local stores of schemas, in addition to accessors for remote schemas.
The release also includes a suite of Avro message serializers and deserializers that integrate with [Confluent Schema Registry](https://docs.confluent.io/current/schema-registry/docs/index.html) and the Confluent Wire Format (`kafkit.registry.serializer`).
53 changes: 0 additions & 53 deletions CHANGELOG.rst

This file was deleted.

Loading

0 comments on commit af3d533

Please sign in to comment.