Skip to content

Commit

Permalink
Use trusted publishing and hatch
Browse files Browse the repository at this point in the history
  • Loading branch information
kislyuk committed Jan 1, 2025
1 parent b6140d0 commit eb75a75
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 66 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
max-parallel: 8
matrix:
os: [ubuntu-20.04, ubuntu-24.04]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -24,13 +24,16 @@ jobs:
- run: make lint
- run: make test
- uses: codecov/codecov-action@v4
black:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
isort:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: isort/[email protected]
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v1
- uses: astral-sh/ruff-action@v1
with:
args: "format --check"
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish release to PyPI

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
pypi-publish:
name: Build and upload release to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install build
- run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install:
-rm -rf dist
python -m pip install build
python -m build
python -m pip install --upgrade $$(echo dist/*.whl)[tests]
python -m pip install --upgrade $$(echo dist/*.whl)[test]

.PHONY: test lint release docs

Expand Down
10 changes: 1 addition & 9 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ release:
@if ! type -P pandoc; then echo "Please install pandoc"; exit 1; fi
@if ! type -P sponge; then echo "Please install moreutils"; exit 1; fi
@if ! type -P gh; then echo "Please install gh"; exit 1; fi
@if ! type -P twine; then echo "Please install twine"; exit 1; fi
git pull
git clean -x --force $$(python setup.py --name)
sed -i -e "s/version=\([\'\"]\)[0-9]*\.[0-9]*\.[0-9]*/version=\1$${TAG:1}/" setup.py
git add setup.py
git clean -x --force watchtower
TAG_MSG=$$(mktemp); \
echo "# Changes for ${TAG} ($$(date +%Y-%m-%d))" > $$TAG_MSG; \
git log --pretty=format:%s $$(git describe --abbrev=0)..HEAD >> $$TAG_MSG; \
Expand All @@ -34,13 +31,8 @@ release:
git push --follow-tags
$(MAKE) install
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//')"
$(MAKE) release-pypi
$(MAKE) release-docs

release-pypi:
python -m build
twine upload dist/*.tar.gz dist/*.whl --verbose

release-docs:
$(MAKE) docs
-git branch -D gh-pages
Expand Down
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,52 @@
[project]
name = "watchtower"
description = "Python CloudWatch Logging"
readme = "README.rst"
requires-python = ">=3.8"
license = { text = "Apache Software License" }
authors = [{ name = "Andrey Kislyuk"}, {email = "[email protected]" }]
maintainers = [{ name = "Andrey Kislyuk"}, {email = "[email protected]" }]
dynamic = ["version"]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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 :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Development Status :: 5 - Production/Stable",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"boto3 >= 1.9.253, < 2",
]

[project.optional-dependencies]
test = ["pyyaml", "coverage", "build", "wheel", "ruff", "mypy"]

[project.urls]
"Homepage"= "https://github.com/kislyuk/watchtower"
"Documentation"= "https://kislyuk.github.io/watchtower"
"Source Code"= "https://github.com/kislyuk/watchtower"
"Issue Tracker"= "https://github.com/kislyuk/watchtower/issues"
"Change Log"= "https://github.com/kislyuk/watchtower/blob/develop/Changes.rst"

[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "vcs"

[tool.black]
line-length = 120

Expand Down
50 changes: 0 additions & 50 deletions setup.py

This file was deleted.

0 comments on commit eb75a75

Please sign in to comment.