Skip to content

Commit eb75a75

Browse files
committed
Use trusted publishing and hatch
1 parent b6140d0 commit eb75a75

File tree

6 files changed

+81
-66
lines changed

6 files changed

+81
-66
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
max-parallel: 8
1515
matrix:
1616
os: [ubuntu-20.04, ubuntu-24.04]
17-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
17+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
1818
steps:
1919
- uses: actions/checkout@v4
2020
- uses: actions/setup-python@v5
@@ -24,13 +24,16 @@ jobs:
2424
- run: make lint
2525
- run: make test
2626
- uses: codecov/codecov-action@v4
27-
black:
28-
runs-on: ubuntu-22.04
29-
steps:
30-
- uses: actions/checkout@v4
31-
- uses: psf/black@stable
3227
isort:
3328
runs-on: ubuntu-22.04
3429
steps:
3530
- uses: actions/checkout@v4
3631
- uses: isort/[email protected]
32+
ruff:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: astral-sh/ruff-action@v1
37+
- uses: astral-sh/ruff-action@v1
38+
with:
39+
args: "format --check"

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish release to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
pypi-publish:
10+
name: Build and upload release to PyPI
11+
runs-on: ubuntu-latest
12+
environment: release
13+
permissions:
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
- run: pip install build
19+
- run: python -m build
20+
- name: Publish package distributions to PyPI
21+
uses: pypa/gh-action-pypi-publish@release/v1

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ install:
1818
-rm -rf dist
1919
python -m pip install build
2020
python -m build
21-
python -m pip install --upgrade $$(echo dist/*.whl)[tests]
21+
python -m pip install --upgrade $$(echo dist/*.whl)[test]
2222

2323
.PHONY: test lint release docs
2424

common.mk

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ release:
1818
@if ! type -P pandoc; then echo "Please install pandoc"; exit 1; fi
1919
@if ! type -P sponge; then echo "Please install moreutils"; exit 1; fi
2020
@if ! type -P gh; then echo "Please install gh"; exit 1; fi
21-
@if ! type -P twine; then echo "Please install twine"; exit 1; fi
2221
git pull
23-
git clean -x --force $$(python setup.py --name)
24-
sed -i -e "s/version=\([\'\"]\)[0-9]*\.[0-9]*\.[0-9]*/version=\1$${TAG:1}/" setup.py
25-
git add setup.py
22+
git clean -x --force watchtower
2623
TAG_MSG=$$(mktemp); \
2724
echo "# Changes for ${TAG} ($$(date +%Y-%m-%d))" > $$TAG_MSG; \
2825
git log --pretty=format:%s $$(git describe --abbrev=0)..HEAD >> $$TAG_MSG; \
@@ -34,13 +31,8 @@ release:
3431
git push --follow-tags
3532
$(MAKE) install
3633
gh release create ${TAG} dist/*.whl --notes="$$(git tag --list ${TAG} -n99 | perl -pe 's/^\S+\s*// if $$. == 1' | sed 's/^\s\s\s\s//')"
37-
$(MAKE) release-pypi
3834
$(MAKE) release-docs
3935

40-
release-pypi:
41-
python -m build
42-
twine upload dist/*.tar.gz dist/*.whl --verbose
43-
4436
release-docs:
4537
$(MAKE) docs
4638
-git branch -D gh-pages

pyproject.toml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,52 @@
1+
[project]
2+
name = "watchtower"
3+
description = "Python CloudWatch Logging"
4+
readme = "README.rst"
5+
requires-python = ">=3.8"
6+
license = { text = "Apache Software License" }
7+
authors = [{ name = "Andrey Kislyuk"}, {email = "[email protected]" }]
8+
maintainers = [{ name = "Andrey Kislyuk"}, {email = "[email protected]" }]
9+
dynamic = ["version"]
10+
classifiers = [
11+
"Intended Audience :: Developers",
12+
"License :: OSI Approved :: Apache Software License",
13+
"Operating System :: MacOS :: MacOS X",
14+
"Operating System :: POSIX",
15+
"Programming Language :: Python",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.8",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
"Programming Language :: Python :: Implementation :: CPython",
24+
"Programming Language :: Python :: Implementation :: PyPy",
25+
"Development Status :: 5 - Production/Stable",
26+
"Topic :: Software Development",
27+
"Topic :: Software Development :: Libraries :: Python Modules",
28+
]
29+
dependencies = [
30+
"boto3 >= 1.9.253, < 2",
31+
]
32+
33+
[project.optional-dependencies]
34+
test = ["pyyaml", "coverage", "build", "wheel", "ruff", "mypy"]
35+
36+
[project.urls]
37+
"Homepage"= "https://github.com/kislyuk/watchtower"
38+
"Documentation"= "https://kislyuk.github.io/watchtower"
39+
"Source Code"= "https://github.com/kislyuk/watchtower"
40+
"Issue Tracker"= "https://github.com/kislyuk/watchtower/issues"
41+
"Change Log"= "https://github.com/kislyuk/watchtower/blob/develop/Changes.rst"
42+
43+
[build-system]
44+
requires = ["hatchling", "hatch-vcs"]
45+
build-backend = "hatchling.build"
46+
47+
[tool.hatch.version]
48+
source = "vcs"
49+
150
[tool.black]
251
line-length = 120
352

setup.py

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

0 commit comments

Comments
 (0)