From e15743361bac0da178a87f84873abe86584ae7f7 Mon Sep 17 00:00:00 2001 From: CoolCat467 <52022020+CoolCat467@users.noreply.github.com> Date: Mon, 30 Dec 2024 16:52:29 -0600 Subject: [PATCH] Version 1.3.3 Update pre-commit hooks, drop official python 3.8 support, and enable more ruff rules --- .github/workflows/tests.yml | 4 +++- .pre-commit-config.yaml | 21 +++++++++++-------- helpers/gen_file_list.py | 5 ++++- pyproject.toml | 42 ++++++++++++++++++++----------------- src/fix_lwjgl/__init__.py | 7 +++++-- 5 files changed, 47 insertions(+), 32 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d502524..7f0a8fe 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,12 +20,14 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@main diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f2bbbd6..4de946e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,8 @@ ci: autofix_prs: true - autoupdate_schedule: weekly - skip: [badgie] + autoupdate_schedule: quarterly submodules: false + skip: [badgie] repos: - repo: https://github.com/pre-commit/pre-commit-hooks @@ -18,13 +18,6 @@ repos: - id: check-case-conflict - id: sort-simple-yaml files: .pre-commit-config.yaml - - repo: https://github.com/hadialqattan/pycln - rev: v2.4.0 - hooks: - - id: pycln - args: [--config=pyproject.toml, src] - types: [file] - types_or: [python, pyi] - repo: https://github.com/psf/black-pre-commit-mirror rev: 24.10.0 hooks: @@ -43,3 +36,13 @@ repos: rev: v2.3.0 hooks: - id: codespell + additional_dependencies: + - tomli + - repo: https://github.com/crate-ci/typos + rev: v1.28.4 + hooks: + - id: typos + - repo: https://github.com/woodruffw/zizmor-pre-commit + rev: v0.10.0 + hooks: + - id: zizmor diff --git a/helpers/gen_file_list.py b/helpers/gen_file_list.py index 0e9426a..8ca0b02 100755 --- a/helpers/gen_file_list.py +++ b/helpers/gen_file_list.py @@ -13,7 +13,10 @@ import json import os -from typing import Any, Container +from typing import TYPE_CHECKING, Any + +if TYPE_CHECKING: + from collections.abc import Container def get_file_list( diff --git a/pyproject.toml b/pyproject.toml index 5d371b3..d1909d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,13 +11,12 @@ authors = [ description = "Fix LWJGL (Light Weight Java Game Library) version used in Minecraft for ARM devices" readme = {file = "README.md", content-type = "text/markdown"} license = {file = "LICENSE"} -requires-python = ">=3.8" +requires-python = ">=3.9" classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: End Users/Desktop", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -33,8 +32,8 @@ keywords = [ "wrapper-script" ] dependencies = [ - "trio~=0.27.0", - "httpx~=0.28.0", + "trio~=0.28.0", + "httpx~=0.28.1", ] [tool.setuptools.dynamic] @@ -51,7 +50,7 @@ fix_lwjgl_wrapper = "fix_lwjgl:cli_run" fix_lwjgl = ["py.typed"] [tool.mypy] -mypy_path = "src" +files = ["src/fix_lwjgl/",] check_untyped_defs = true disallow_any_decorated = true disallow_any_generics = true @@ -88,7 +87,6 @@ disable_all_dunder_policy = true [tool.black] line-length = 79 -target-version = ['py38'] [tool.ruff] line-length = 79 @@ -108,12 +106,16 @@ select = [ "EXE", # flake8-executable "F", # pyflakes "FA", # flake8-future-annotations + "FLY", # flynt + "FURB", # refurb "I", # isort + "ICN", # flake8-import-conventions "N", # pep8-naming "PIE", # flake8-pie "PT", # flake8-pytest-style "PYI", # flake8-pyi "Q", # flake8-quotes + "R", # Refactor "RET", # flake8-return "RUF", # Ruff-specific rules "S", # flake8-bandit @@ -125,31 +127,33 @@ select = [ "YTT", # flake8-2020 ] extend-ignore = [ - "E501", # line-too-long - "S101", # use of assert for tests and type narrowing - "D203", # One blank line before class - "D204", # blank line thing + "D203", # one-blank-line-before-class + "D204", # one-blank-line-after-class "D211", # no-blank-line-before-class "D213", # multi-line-summary-second-line - "SIM117", # Use multiple with statements at the same time + "D417", # undocumented-param "Missing argument descriptions" + "E501", # line-too-long + "PYI041", # redundant-numeric-union + "S101", # assert (use of assert for tests and type narrowing) + "SIM117", # multiple-with-statements ] [tool.ruff.lint.per-file-ignores] "tests/*" = [ "D100", # undocumented-public-module "D103", # undocumented-public-function - "D107", # Missing docstring + "D107", # undocumented-public-init ] [tool.pytest.ini_options] -addopts = "--cov-report term-missing --cov=fix_lwjgl" +addopts = "--cov-report=term-missing --cov=fix_lwjgl" testpaths = [ "tests", ] [tool.coverage.run] branch = true -source = ["src"] +source_pkgs = ["fix_lwjgl"] omit = [] [tool.coverage.report] @@ -178,16 +182,16 @@ partial_branches = [ [tool.tox] legacy_tox_ini = """ [tox] - envlist = py38, py39, py310, py311, py312, mypy, pytest + envlist = py39, py310, py311, py312, py313, mypy, pytest isolated_build = false [gh-actions] python = - 3.8: py38, pytest, mypy - 3.9: py39, pytest + 3.9: py39, pytest, mypy 3.10: py310, pytest 3.11: py311, pytest - 3.12: py312, pytest, mypy + 3.12: py312, pytest + 3.13: py313, pytest, mypy [testenv] setenv = @@ -203,5 +207,5 @@ legacy_tox_ini = """ [testenv:mypy] deps = mypy - commands = mypy src + commands = mypy """ diff --git a/src/fix_lwjgl/__init__.py b/src/fix_lwjgl/__init__.py index c6395dd..a290951 100644 --- a/src/fix_lwjgl/__init__.py +++ b/src/fix_lwjgl/__init__.py @@ -35,7 +35,7 @@ __title__ = "Fix-LWJGL" __author__ = "CoolCat467" -__version__ = "1.3.2" +__version__ = "1.3.3" __license__ = "MIT" @@ -45,11 +45,14 @@ import subprocess import sys from configparser import ConfigParser -from typing import Any, Final, Iterable, Iterator +from typing import TYPE_CHECKING, Any, Final import httpx import trio +if TYPE_CHECKING: + from collections.abc import Iterable, Iterator + HOME = os.getenv("HOME", os.path.expanduser("~")) XDG_DATA_HOME = os.getenv( "XDG_DATA_HOME",