Skip to content

Commit 10f1689

Browse files
committed
🔧 Upgrade CI, publishing
Splitting from #8 - Update pre-commit hooks - Switch from setup.cfg to pyproject.toml - Update workflow versions - Use PyPi trusted publishing - Remove twine - Use setuptools-scm for versioning - Require python 3.9 or newer
1 parent c41d78e commit 10f1689

File tree

6 files changed

+56
-44
lines changed

6 files changed

+56
-44
lines changed

‎.github/workflows/pre-commit.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: pre-commit
33

4-
on:
4+
"on":
55
pull_request:
66
push:
77
branches: [main]
@@ -10,7 +10,7 @@ jobs:
1010
pre-commit:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- uses: actions/setup-python@v4
1515
with:
1616
python-version: "3.9"
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
---
22
name: Upload Python Package
33

4-
on:
4+
"on":
55
release:
66
types: [created]
77

88
jobs:
99
publish:
1010
runs-on: ubuntu-latest
11+
environment: release
12+
permissions:
13+
# IMPORTANT: this permission is mandatory for trusted publishing
14+
id-token: write
1115
steps:
12-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1317
- name: Set up Python
1418
uses: actions/setup-python@v4
1519
with:
@@ -18,10 +22,7 @@ jobs:
1822
run: |
1923
python -m pip install --upgrade pip
2024
pip install -r requirements-dev.txt
21-
- name: Build and publish
22-
env:
23-
TWINE_USERNAME: __token__
24-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
25-
run: |
26-
python -m build
27-
twine upload dist/*
25+
- name: Build
26+
run: python -m build
27+
- name: Publish package distributions to PyPI
28+
uses: pypa/gh-action-pypi-publish@release/v1

‎.pre-commit-config.yaml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.2.0
4+
rev: v4.5.0
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
88
- id: check-yaml
99
- id: check-added-large-files
1010
- id: requirements-txt-fixer
11-
- repo: https://github.com/psf/black
12-
rev: 22.3.0
11+
- repo: https://github.com/psf/black-pre-commit-mirror
12+
rev: 23.11.0
1313
hooks:
1414
- id: black
1515
- repo: https://github.com/PyCQA/isort
16-
rev: 5.10.1
16+
rev: 5.12.0
1717
hooks:
1818
- id: isort

‎pyproject.toml‎

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
1+
[build-system]
2+
requires = ["setuptools>=45", "wheel", "setuptools-scm"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "co2mini"
7+
description = "Monitor CO2 levels with Prometheus and/or HomeKit"
8+
readme = "README.md"
9+
authors = [{ email = "jeremy@jerr.dev" }, { name = "Jeremy Mayeres" }]
10+
requires-python = ">=3.9"
11+
keywords = [
12+
"co2",
13+
"co2mini",
14+
"temperature",
15+
"humidity",
16+
"sensors",
17+
"prometheus",
18+
"homekit",
19+
]
20+
license = { file = "LICENSE" }
21+
classifiers = [
22+
"Programming Language :: Python :: 3",
23+
"License :: OSI Approved :: MIT License",
24+
"Operating System :: OS Independent",
25+
"Development Status :: 3 - Alpha",
26+
]
27+
dependencies = ["prometheus_client"]
28+
dynamic = ["version"]
29+
30+
[project.urls]
31+
repository = "https://github.com/jerr0328/co2-mini"
32+
33+
[project.optional-dependencies]
34+
homekit = ["HAP-python"]
35+
36+
[project.scripts]
37+
co2mini = "co2mini.main:main"
38+
139
[tool.isort]
240
profile = "black"
341

4-
[build-system]
5-
requires = ["setuptools>=45", "wheel"]
6-
build-backend = "setuptools.build_meta"
42+
[tool.setuptools_scm]

‎requirements-dev.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ flake8
55
isort
66
pre-commit
77
setuptools
8-
twine
8+
setuptools-scm
99
wheel

‎setup.cfg‎

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

0 commit comments

Comments
 (0)