From 74dd2af9ae27e2386df189c568dd02b882cb7d37 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Fri, 7 Feb 2025 17:01:30 +0100 Subject: [PATCH 1/5] chore: add formatter ci --- .github/workflows/formatter.yml | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/formatter.yml diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml new file mode 100644 index 0000000..346076e --- /dev/null +++ b/.github/workflows/formatter.yml @@ -0,0 +1,46 @@ +name: Format + +on: + pull_request: + branches: + - "**" + push: + branches: + - "**" + +jobs: + format: + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10"] + + steps: + - name: Check out source repository + uses: actions/checkout@v3 + - name: Set up Python environment + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: autopep8 + id: autopep8 + uses: peter-evans/autopep8@v2 + with: + args: --recursive --in-place --aggressive --aggressive . + - name: flake8 Lint + uses: py-actions/flake8@v2 + + - name: commit back to repository + uses: stefanzweifel/git-auto-commit-action@v5 + with: + # These defaults somehow do not work for me, so I've set them + # explicitly + # The big number is the userid of the bot + commit_user_name: github-actions[bot] + commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com + commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> # defaults to "username ", where "username" belongs to the author of the commit that triggered the run + commit_message: "ci: automatic Python Formatter changes" From 40d1148fbe3e23eaf1030d252e3123f1229fc575 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Sat, 8 Feb 2025 17:41:10 +0100 Subject: [PATCH 2/5] chore: fix line length in tests --- tests/test_tests.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/test_tests.py b/tests/test_tests.py index c934ffb..90bf9fa 100644 --- a/tests/test_tests.py +++ b/tests/test_tests.py @@ -1,15 +1,18 @@ -# I do not trust python and it's tests, so I'm testing them. May not be worth much, but at least it shows me a few things. +# I do not trust python and it's tests, so I'm testing them. May not be worth +# much, but at least it shows me a few things. import os -import pytest # noqa: F401 do not remove this import. This is needed for pytest fixtures to work +# do not remove this import. This is needed for +# pytest fixtures to work +import pytest # noqa: F401 import senju # noqa: F401 -# Note: these weird arguments are an indicator of what should be dome before. For example, -# `temp_data_dir` is a function in `conftest.py`. If we put it in the arguments, it seems -# to run before our test, and the return value becomes a local. -# -# This is all very confusing for someone used to Rust's libtest +# Note: these weird arguments are an indicator of what should be dome +# before. For example, `temp_data_dir` is a function in `conftest.py`. If we +# put it in the arguments, it seems to run before our test, and the return +# value becomes a local. This is all very confusing for someone used to +# Rust's libtest def test_tests_are_loaded(): @@ -22,4 +25,3 @@ def test_temp_data_dir(temp_data_dir): with open(testpath, "w") as f: f.write("that dir actually works") os.remove(testpath) - From 5248a021542e8a563b9f30b40e1ca7579816643e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 8 Feb 2025 16:41:32 +0000 Subject: [PATCH 3/5] ci: automatic Python Formatter changes --- tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index b3b5622..efe5392 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,4 +8,3 @@ import pytest def temp_data_dir(): """Create a temporary directory for test data""" return Path(tempfile.mkdtemp()) - From 115123539d5633ae3a897f540499736d9586d72a Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Sat, 8 Feb 2025 17:45:02 +0100 Subject: [PATCH 4/5] chore: only run ci on PRs --- .github/workflows/formatter.yml | 3 --- .github/workflows/tests.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index 346076e..a11d2aa 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -4,9 +4,6 @@ on: pull_request: branches: - "**" - push: - branches: - - "**" jobs: format: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c469acb..0d3812f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,9 +4,6 @@ on: pull_request: branches: - "**" - push: - branches: - - "**" jobs: test: From 5119ff84f9b72968e7f88bf290b9d6e5d82d0e65 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Sat, 8 Feb 2025 17:50:41 +0100 Subject: [PATCH 5/5] chore: remove unneeded imports --- senju/main.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/senju/main.py b/senju/main.py index cc88aa4..ba7cc7d 100644 --- a/senju/main.py +++ b/senju/main.py @@ -1,10 +1,5 @@ from __future__ import annotations -from pathlib import Path - -from flask import Flask, url_for -from markupsafe import escape - def main(): print("hello world")