From 440fdaaa0c5a46a907aaaee89b58232339deb261 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 4 Oct 2024 21:55:11 -0400 Subject: [PATCH] ci: add 3.13 (#690) * ci: add 3.13 Signed-off-by: Henry Schreiner * ci: add attestations Signed-off-by: Henry Schreiner * chore: fix lints Signed-off-by: Henry Schreiner --------- Signed-off-by: Henry Schreiner --- .github/workflows/cd.yml | 16 +++++++++++++--- .github/workflows/ci.yml | 2 +- plumbum/colorlib/styles.py | 6 ++++-- plumbum/commands/base.py | 12 ++++++++---- pyproject.toml | 8 +++++--- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 692add3a..42917d06 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -12,7 +12,7 @@ env: jobs: dist: name: Dist - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: @@ -22,12 +22,15 @@ jobs: deploy: name: Deploy - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest needs: [dist] if: github.event_name == 'release' && github.event.action == 'published' - environment: pypi + environment: + name: pypi + url: https://pypi.org/p/plumbum permissions: id-token: write + attestations: write steps: - uses: actions/download-artifact@v4 @@ -35,4 +38,11 @@ jobs: name: Packages path: dist + - name: Generate artifact attestation for sdist and wheel + uses: actions/attest-build-provenance@v1 + with: + subject-path: "dist/*" + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + attestations: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 044778dd..fff293f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.10", "3.12"] + python-version: ["3.8", "3.10", "3.13"] os: [ubuntu-latest, windows-latest, macos-13] include: - python-version: 'pypy-3.8' diff --git a/plumbum/colorlib/styles.py b/plumbum/colorlib/styles.py index 4aec1bf9..a2605334 100644 --- a/plumbum/colorlib/styles.py +++ b/plumbum/colorlib/styles.py @@ -16,7 +16,7 @@ import sys from abc import ABCMeta, abstractmethod from copy import copy -from typing import IO +from typing import IO, ClassVar from .names import ( FindNearest, @@ -343,7 +343,9 @@ class Style(metaclass=ABCMeta): """The class of color to use. Never hardcode ``Color`` call when writing a Style method.""" - attribute_names: dict[str, str] | dict[str, int] + # These must be defined by subclasses + # pylint: disable-next=declare-non-slot + attribute_names: ClassVar[dict[str, str] | dict[str, int]] _stdout: IO | None = None end = "\n" diff --git a/plumbum/commands/base.py b/plumbum/commands/base.py index 29638ce1..8511ec33 100644 --- a/plumbum/commands/base.py +++ b/plumbum/commands/base.py @@ -437,9 +437,11 @@ def verify(proc, retcode, timeout, stdout, stderr): class BaseRedirection(BaseCommand): __slots__ = ("cmd", "file") - SYM: ClassVar[str] - KWARG: ClassVar[str] - MODE: ClassVar[str] + + # These must be defined by subclasses + SYM: ClassVar[str] # pylint: disable=declare-non-slot + KWARG: ClassVar[str] # pylint: disable=declare-non-slot + MODE: ClassVar[str] # pylint: disable=declare-non-slot def __init__(self, cmd, file): self.cmd = cmd @@ -563,9 +565,11 @@ def popen(self, args=(), **kwargs): class ConcreteCommand(BaseCommand): - QUOTE_LEVEL: ClassVar[int] __slots__ = ("executable",) + # These must be defined by subclasses + QUOTE_LEVEL: ClassVar[int] # pylint: disable=declare-non-slot + def __init__(self, executable, encoding): self.executable = executable self.custom_encoding = encoding diff --git a/pyproject.toml b/pyproject.toml index a2d98be8..306a175a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Build Tools", "Topic :: System :: Systems Administration", ] @@ -124,9 +125,9 @@ optional_tests = """ [tool.pylint] -master.py-version = "3.8" -master.jobs = "0" -master.load-plugins = ["pylint.extensions.no_self_use"] +py-version = "3.8" +jobs = "0" +load-plugins = ["pylint.extensions.no_self_use"] reports.output-format = "colorized" similarities.ignore-imports = "yes" messages_control.enable = [ @@ -161,6 +162,7 @@ messages_control.disable = [ "too-many-public-methods", "too-many-return-statements", "too-many-statements", + "too-many-positional-arguments", "unidiomatic-typecheck", # TODO: might be able to remove "unnecessary-lambda-assignment", # TODO: 4 instances "unused-import", # identical to flake8 but has typing false positives