From e6a729999665217a29b3ba3b8b3657159b7722f1 Mon Sep 17 00:00:00 2001 From: jslay88 Date: Fri, 12 Dec 2025 00:22:19 -0700 Subject: [PATCH 1/3] Fix actions, upgrade to python 3.13 --- .github/workflows/python.yml | 35 ++++++++++++++++------------------- .tool-versions | 1 + Dockerfile | 2 +- am_bot/cogs/starboard.py | 8 +++++--- pyproject.toml | 9 ++++++--- tox.ini | 7 +++---- 6 files changed, 32 insertions(+), 30 deletions(-) create mode 100644 .tool-versions diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 78ec0e4..3cfb638 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -10,8 +10,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2.10.2 + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 id: filter with: filters: | @@ -20,10 +20,10 @@ jobs: - 'tox.ini' - name: Setup Python - uses: actions/setup-python@v2.2.2 + uses: actions/setup-python@v5 if: steps.filter.outputs.python == 'true' with: - python-version: "3.12" + python-version: "3.13" - name: Install Dependencies if: steps.filter.outputs.python == 'true' @@ -44,17 +44,14 @@ jobs: strategy: matrix: toxenv: - - py311-unittest - - py312-unittest + - py313-unittest include: - - toxenv: py311-unittest - python-version: "3.11" - - toxenv: py312-unittest - python-version: "3.12" + - toxenv: py313-unittest + python-version: "3.13" steps: - - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2.10.2 + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 id: filter with: filters: | @@ -63,7 +60,7 @@ jobs: - 'tox.ini' - name: Set up Python - uses: actions/setup-python@v2.2.2 + uses: actions/setup-python@v5 if: steps.filter.outputs.python == 'true' with: python-version: "${{ matrix.python-version }}" @@ -80,13 +77,13 @@ jobs: tox -e ${{ matrix.toxenv }} - name: Dump Test Coverage - if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py312-unittest' + if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py313-unittest' run: | pip install coverage coverage xml - name: Store Test Coverage - if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py312-unittest' + if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py313-unittest' uses: actions/upload-artifact@v4 with: name: coverage @@ -101,10 +98,10 @@ jobs: - unittest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: dorny/paths-filter@v2.10.2 + - uses: dorny/paths-filter@v3 id: filter with: filters: | @@ -113,10 +110,10 @@ jobs: - 'tox.ini' - name: Setup Python - uses: actions/setup-python@v2.2.2 + uses: actions/setup-python@v5 if: steps.filter.outputs.python == 'true' with: - python-version: "3.12" + python-version: "3.13" - name: Install Coverage & diff_cover if: steps.filter.outputs.python == 'true' diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..a93eee6 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +python 3.13.11 diff --git a/Dockerfile b/Dockerfile index 2e0842e..5b1bbb7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:alpine AS base +FROM python:3.13-alpine AS base RUN apk update && apk upgrade diff --git a/am_bot/cogs/starboard.py b/am_bot/cogs/starboard.py index ac3005d..5b68747 100644 --- a/am_bot/cogs/starboard.py +++ b/am_bot/cogs/starboard.py @@ -110,9 +110,11 @@ async def on_raw_reaction_add( "inline": False, } ], - "color": 3375061 - if self._last_message.embeds[0].color == 16769024 - else 16769024, + "color": ( + 3375061 + if self._last_message.embeds[0].color == 16769024 + else 16769024 + ), "timestamp": datetime.utcnow() .replace(tzinfo=timezone.utc) .isoformat(), diff --git a/pyproject.toml b/pyproject.toml index 1caf3e0..0311041 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ name = "am_bot" authors = [ {name = "ARKModding", email = "no-reply@arkmodding.net"}, ] -requires-python = ">=3.8" +requires-python = ">=3.10" readme = "README.md" classifiers = [] dynamic = [ @@ -40,21 +40,24 @@ exclude_dirs = [ [tool.black] line-length = 79 -target-version = ['py312'] +target-version = ['py313'] include = '\.pyi?$' [tool.isort] profile = "black" line_length = 79 lines_after_imports = 2 -skip = [".tox", "venv"] +skip = [".tox", "venv", ".venv"] [tool.ruff] exclude = [ "venv", + ".venv", "__init__.py", ] line-length = 79 + +[tool.ruff.lint] select = [ "B", "C", diff --git a/tox.ini b/tox.ini index f31a11a..81cdf63 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] skipsdist=True # Run these envs when tox is invoked without -e -envlist=lint,py{38,39,310,311,312}-unittest +envlist=lint,py{310,311,312,313}-unittest [testenv] @@ -22,11 +22,10 @@ envlist=lint,py{38,39,310,311,312}-unittest recreate=False basepython= - py38: python3.8 - py39: python3.9 py310: python3.10 py311: python3.11 py312: python3.12 + py313: python3.13 deps= lint: {[lint-config]deps} @@ -56,7 +55,7 @@ deps= commands= black . --check isort --check-only --diff . - ruff . --no-fix + ruff check . --no-fix bandit -r am_bot From efcab7cb9d4009c7e403ccd3452ad0794f031154 Mon Sep 17 00:00:00 2001 From: jslay88 Date: Fri, 12 Dec 2025 00:25:25 -0700 Subject: [PATCH 2/3] Fix actions, upgrade to python 3.13 --- .github/workflows/python.yml | 6 ------ tox.ini | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 3cfb638..2cf8b53 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -76,12 +76,6 @@ jobs: run: | tox -e ${{ matrix.toxenv }} - - name: Dump Test Coverage - if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py313-unittest' - run: | - pip install coverage - coverage xml - - name: Store Test Coverage if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py313-unittest' uses: actions/upload-artifact@v4 diff --git a/tox.ini b/tox.ini index 81cdf63..8336ddb 100644 --- a/tox.ini +++ b/tox.ini @@ -73,6 +73,8 @@ deps= commands= coverage erase coverage run -m pytest {posargs} + coverage xml -o {toxinidir}/coverage.xml + coverage report [testenv:lint] From e753350597317c0007c3976f7deaceb306144103 Mon Sep 17 00:00:00 2001 From: jslay88 Date: Fri, 12 Dec 2025 00:29:43 -0700 Subject: [PATCH 3/3] Fix actions, upgrade to python 3.13 --- .github/workflows/python.yml | 8 ++++---- pyproject.toml | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 2cf8b53..ae0b102 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -126,7 +126,7 @@ jobs: run: | coverage report -# - name: Check Coverage Diff -# if: steps.filter.outputs.python == 'true' -# run: | -# diff-cover ./coverage.xml --compare-branch=origin/main --fail-under=100 + - name: Coverage Diff + if: steps.filter.outputs.python == 'true' + run: | + diff-cover coverage.xml --compare-branch=origin/main || true diff --git a/pyproject.toml b/pyproject.toml index 0311041..c1f4e10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,6 +66,9 @@ select = [ "W", ] +[tool.coverage.run] +relative_files = true + [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} description = {file = ["README.md"]}