Skip to content

Commit af3d533

Browse files
authored
Merge pull request #14 from lsst-sqre/tickets/DM-35548
DM-35548: Update packaging and other clean up
2 parents 97e5792 + c279b17 commit af3d533

29 files changed

+534
-387
lines changed

.flake8

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[flake8]
2+
max-line-length = 79
3+
# Ignored rules for Black
4+
# E203 whitespace before ':'
5+
# W503: line break before binary operator
6+
ignore = E203 W503
7+
exclude =
8+
docs/conf.py

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
8+
- package-ecosystem: "docker"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/ci.yaml

Lines changed: 65 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,101 @@
11
name: Python CI
22

3-
on: [push]
3+
"on":
4+
push:
5+
branches-ignore:
6+
# These should always correspond to pull requests, so ignore them for
7+
# the push trigger and let them be triggered by the pull_request
8+
# trigger, avoiding running the workflow twice. This is a minor
9+
# optimization so there's no need to ensure this is comprehensive.
10+
- "dependabot/**"
11+
- "renovate/**"
12+
- "tickets/**"
13+
- "u/**"
14+
tags:
15+
- "*"
16+
pull_request: {}
417

518
jobs:
19+
lint:
20+
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: "3.10"
29+
30+
- name: Run pre-commit
31+
uses: pre-commit/[email protected]
32+
633
test:
734

835
runs-on: ubuntu-latest
36+
937
strategy:
1038
matrix:
1139
python:
12-
- 3.7
13-
- 3.8
40+
- "3.8"
41+
- "3.9"
42+
- "3.10"
1443

1544
steps:
16-
- uses: actions/checkout@v2
45+
- uses: actions/checkout@v3
1746

18-
- name: Set up Python
19-
uses: actions/setup-python@v1
47+
- name: Run tox
48+
uses: lsst-sqre/run-tox@v1
2049
with:
2150
python-version: ${{ matrix.python }}
22-
23-
- name: Install tox
24-
run: pip install tox
25-
26-
- name: Run tox
27-
run: tox -e py,lint,typing # run tox using Python in path
51+
tox-envs: "py,typing"
2852

2953
docs:
3054

3155
runs-on: ubuntu-latest
3256

3357
steps:
34-
- uses: actions/checkout@v2
35-
36-
- name: Set up Python
37-
uses: actions/setup-python@v1
58+
- uses: actions/checkout@v3
3859
with:
39-
python-version: 3.7
60+
fetch-depth: 0 # full history for setuptools_scm
4061

41-
- name: Install tox and LTD Conveyor
42-
run: pip install tox ltd-conveyor
62+
- name: Install Graphviz
63+
run: sudo apt-get install graphviz
4364

4465
- name: Run tox
45-
run: tox -e docs
66+
uses: lsst-sqre/run-tox@v1
67+
with:
68+
python-version: "3.10"
69+
tox-envs: "docs,docs-linkcheck"
4670

71+
# Only attempt documentation uploads for tagged releases and pull
72+
# requests from ticket branches in the same repository. This avoids
73+
# version clutter in the docs and failures when a PR doesn't have access
74+
# to secrets.
4775
- name: Upload to LSST the Docs
48-
env:
49-
LTD_USERNAME: travis
50-
LTD_PASSWORD: ${{ secrets.LTD_PASSWORD }}
51-
run: ltd upload --product kafkit --gh --dir docs/_build/html
76+
uses: lsst-sqre/ltd-upload@v1
77+
with:
78+
project: "kafkit"
79+
dir: "docs/_build/html"
80+
username: ${{ secrets.LTD_USERNAME }}
81+
password: ${{ secrets.LTD_PASSWORD }}
82+
if: >
83+
github.event_name != 'pull_request'
84+
|| startsWith(github.head_ref, 'tickets/')
5285
5386
pypi:
5487

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

5991
steps:
60-
- uses: actions/checkout@v2
61-
62-
- name: Set up Python
63-
uses: actions/setup-python@v1
92+
- uses: actions/checkout@v3
6493
with:
65-
python-version: 3.7
66-
67-
- name: Install dependencies
68-
run: |
69-
python -m pip install --upgrade pip
70-
pip install --upgrade setuptools wheel twine
94+
fetch-depth: 0 # full history for setuptools_scm
7195

7296
- name: Build and publish
73-
env:
74-
TWINE_USERNAME: "__token__"
75-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
76-
run: |
77-
python setup.py sdist bdist_wheel
78-
twine upload dist/*
97+
uses: lsst-sqre/build-and-publish-to-pypi@v1
98+
with:
99+
pypi-token: ${{ secrets.PYPI_SQRE_ADMIN }}
100+
python-version: "3.10"
101+
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}

.github/workflows/periodic-ci.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This is a separate run of the Python test suite that doesn't cache the tox
2+
# environment and runs from a schedule. The purpose is to test compatibility
3+
# with the latest versions of dependencies.
4+
5+
name: Periodic CI
6+
7+
"on":
8+
schedule:
9+
- cron: "0 12 * * 1"
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
python:
18+
- "3.8"
19+
- "3.9"
20+
- "3.10"
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Run tests in tox
26+
uses: lsst-sqre/run-tox@v1
27+
with:
28+
python-version: "${{ matrix.python }}"
29+
tox-envs: "lint,typing,py"
30+
use-cache: false
31+
32+
docs:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
38+
- name: Build docs in tox
39+
uses: lsst-sqre/run-tox@v1
40+
with:
41+
python-version: "3.10"
42+
tox-envs: "docs,docs-linkcheck"
43+
use-cache: false
44+
45+
pypi:
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- uses: actions/checkout@v3
50+
with:
51+
fetch-depth: 0 # full history for setuptools_scm
52+
53+
- name: Build and publish
54+
uses: lsst-sqre/build-and-publish-to-pypi@v1
55+
with:
56+
pypi-token: ""
57+
python-version: "3.10"
58+
upload: false

.pre-commit-config.yaml

Lines changed: 30 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,36 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.5.0
4-
hooks:
5-
- id: check-yaml
6-
- id: check-toml
7-
- id: check-json
8-
- id: trailing-whitespace
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.3.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: check-yaml
7+
- id: check-toml
98

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

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

22-
- repo: https://github.com/timothycrosley/isort
23-
rev: 4.3.21-2
24-
hooks:
25-
- id: isort
26-
additional_dependencies:
27-
- toml
20+
- repo: https://github.com/asottile/blacken-docs
21+
rev: v1.12.1
22+
hooks:
23+
- id: blacken-docs
24+
additional_dependencies: [black==22.6.0]
25+
args: [-l, '79', -t, py38]
2826

29-
- repo: https://github.com/ambv/black
30-
rev: 19.10b0
31-
hooks:
32-
- id: black
27+
- repo: https://github.com/pycqa/pydocstyle
28+
rev: 6.1.1
29+
hooks:
30+
- id: pydocstyle
31+
additional_dependencies: [toml]
3332

34-
- repo: https://github.com/asottile/blacken-docs
35-
rev: v1.5.0-1
36-
hooks:
37-
- id: blacken-docs
38-
additional_dependencies: [black==19.10b0]
39-
args: [-l, "79", -t, py37]
40-
41-
- repo: https://gitlab.com/pycqa/flake8
42-
rev: 3.7.9
43-
hooks:
44-
- id: flake8
33+
- repo: https://gitlab.com/pycqa/flake8
34+
rev: 4.0.1
35+
hooks:
36+
- id: flake8

CHANGELOG.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Change log
2+
3+
## 0.2.0 (2022-07-15)
4+
5+
- 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`.
6+
Kafkit is explicitly tested with Python 3.8, 3.9, and 3.10.
7+
8+
- We've added a `kafkit.ssl` module to help connect to Kafka brokers over TLS.
9+
The associated documentation includes a tutorial for working with the SSL certificates generated in a Kafka cluster managed by [Strimzi](https://strimzi.io).
10+
11+
- 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.
12+
The manager handles schema registration for you.
13+
To serialize a message, you simply need to provide the data and the name of the schema.
14+
15+
- A new `kafkit.registry.sansio.CompatibilityType` Enum helps you write use valid Schema Registry compatibility types.
16+
17+
- We've significantly improved Kafkit's packaging and infrastructure:
18+
19+
- Migrate packaging metadata from `setup.py` to `pyproject.toml` (Kafkit continues to be a setuptools-based project).
20+
- Tox now runs tasks like tests, in conjunction with the existing Pytest set up.
21+
- Pre-commit hooks lint and format the code base.
22+
- Code style is now handled by Black (and in the documentation with blacken-docs).
23+
- **Full support for type annotations!** `tox -e typing` validates Kafkit's type annotations with Mypy.
24+
- We've migrated from Travis CI to GitHub Actions.
25+
26+
- The documentation now includes a development guide.
27+
28+
## 0.1.1 (2019-02-13)
29+
30+
Several fixes:
31+
32+
- `RegistryApi.put` was doing a `PATCH` behind the scenes. That's fixed now.
33+
- The `RegistryApi.put`, `patch`, and `delete` methods weren't returning data. That's fixed now as well.
34+
- All of the RegistryApi's low-level HTTP methods have more thorough unit testing now to avoid these issues in the future.
35+
36+
## 0.1.0 (2019-01-30)
37+
38+
Initial release of Kafkit!
39+
40+
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.
41+
There are two client implementations.
42+
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`).
43+
The clients include schema caches so they can be used as both local stores of schemas, in addition to accessors for remote schemas.
44+
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`).

CHANGELOG.rst

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)