From 7ca62ec961e50bf1e38992cbbc9a9d73fac5f6c3 Mon Sep 17 00:00:00 2001 From: Jeremy Mayeres Date: Fri, 2 Jan 2026 21:35:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Add=20test=20pypi=20publishing,?= =?UTF-8?q?=20more=20cleanups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add workflow to publish to test pypi on main branch builds - Use builtin repo for prek's pre-commit hooks (breaks pre-commit usage, use prek instead) - Use SPDX license instead of classifier - Remove setup.py --- .github/workflows/test-release.yaml | 33 +++++++++++++++++++++++++++++ .pre-commit-config.yaml | 3 +-- pyproject.toml | 9 +++----- setup.py | 3 --- 4 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/test-release.yaml delete mode 100644 setup.py diff --git a/.github/workflows/test-release.yaml b/.github/workflows/test-release.yaml new file mode 100644 index 0000000..94a810d --- /dev/null +++ b/.github/workflows/test-release.yaml @@ -0,0 +1,33 @@ +--- +name: Test Upload Python Package to Test PyPI + +"on": + push: + branches: [main] + +jobs: + publish: + runs-on: ubuntu-latest + environment: testing + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: + - uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version-file: "pyproject.toml" + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + activate-environment: "true" + - name: Install dependencies + run: | + uv sync --all-extras --dev + - name: Build + run: python -m build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a6f5cc5..c9508da 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,6 @@ --- repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 + - repo: builtin hooks: - id: check-added-large-files - id: check-merge-conflict diff --git a/pyproject.toml b/pyproject.toml index 296e5c3..d43e874 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,10 +17,10 @@ keywords = [ "prometheus", "homekit", ] -license = { file = "LICENSE" } +license = "MIT" +license-files = ["LICENSE"] classifiers = [ "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Development Status :: 3 - Alpha", ] @@ -28,7 +28,7 @@ dependencies = ["prometheus_client", "environs"] dynamic = ["version"] [project.urls] -repository = "https://github.com/jerr0328/co2-mini" +repository = "https://github.com/jerr0328/co2mini" [project.optional-dependencies] homekit = ["hap-python"] @@ -66,9 +66,6 @@ extend-select = [ "W", # pycodestyle warnings ] -[tool.isort] -profile = "black" - [tool.setuptools_scm] [dependency-groups] diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup()