From 1cf1282e55643b23a1770792af14309b1b0e5f44 Mon Sep 17 00:00:00 2001 From: yuanx749 Date: Tue, 15 Oct 2024 16:29:30 +0800 Subject: [PATCH] Use ruff --- .github/workflows/codecov.yml | 8 +++++--- .pre-commit-config.yaml | 16 +++++----------- configargparser/__init__.py | 2 +- pyproject.toml | 3 +++ setup.cfg | 13 ++----------- 5 files changed, 16 insertions(+), 26 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 419d9ed..76806c2 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -8,11 +8,11 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python: ["3.7", "3.8", "3.9", "3.10"] + python: ["3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Generate coverage report @@ -21,6 +21,8 @@ jobs: pip install pytest-cov pytest --cov=configargparser --cov-report=xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: verbose: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3c05a69..f0545dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,15 +5,9 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace args: [--markdown-linebreak-ext=md] -- repo: https://github.com/psf/black - rev: 23.3.0 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.9 hooks: - - id: black -- repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort -- repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 - hooks: - - id: flake8 + - id: ruff + args: [--fix, --show-fixes] + - id: ruff-format diff --git a/configargparser/__init__.py b/configargparser/__init__.py index 765f343..8784656 100644 --- a/configargparser/__init__.py +++ b/configargparser/__init__.py @@ -1,6 +1,6 @@ """A package to help automatically create command-line interface from configuration or code.""" -__version__ = "1.3.2" +__version__ = "1.4.0" from .cap import ConfigArgumentParser from .tap import TypeArgumentParser diff --git a/pyproject.toml b/pyproject.toml index 241aca3..f47bb20 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" + +[tool.ruff.lint] +select = ["E4", "E7", "E9", "F", "I"] diff --git a/setup.cfg b/setup.cfg index 862128c..e07fa6d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,21 +18,12 @@ long_description_content_type = text/markdown keywords = CLI, option, argument, parameter, flag, configuration, parser, command, comment, dataclass, Python [options] -python_requires = >=3.7 +python_requires = >=3.8 packages = configargparser [options.extras_require] dev = pre-commit - black==23.3.0 - flake8==6.0.0 - isort==5.12.0 pytest pytest-cov - -[flake8] -extend-ignore = - E402 - E501 -extend-exclude = - .venv + ruff