diff --git a/.cspell.json b/.cspell.json index 8e6b27d..5e270ee 100644 --- a/.cspell.json +++ b/.cspell.json @@ -2,6 +2,7 @@ "version": "0.2", "ignorePaths": [ "**/.cspell.json", + ".editorconfig", ".gitignore", ".gitpod.*", ".pre-commit-config.yaml", diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b70605c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +indent_size = unset + +[*.{py,toml}] +indent_size = 4 + +[LICENSE] +indent_size = unset + +[setup.cfg] +indent_size = 4 diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index a1322e2..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 -updates: - - package-ecosystem: github-actions - directory: "/" - assignees: - - redeboer - labels: - - 🖱️ DX - schedule: - interval: monthly diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1bd69f..e33e193 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,8 @@ name: CI concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + cancel-in-progress: |- + ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} env: PYTHONHASHSEED: "0" diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index d64f197..5234093 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -11,6 +11,6 @@ jobs: update_release_draft: runs-on: ubuntu-22.04 steps: - - uses: release-drafter/release-drafter@v5 + - uses: release-drafter/release-drafter@v6 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitpod.yml b/.gitpod.yml index 304c202..8b4269d 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,5 +1,5 @@ tasks: - - init: pyenv local 3.8 + - init: pyenv local 3.9 - init: pip install -e .[dev] github: @@ -21,15 +21,13 @@ vscode: - esbenp.prettier-vscode - github.vscode-github-actions - github.vscode-pull-request-github - - ms-python.black-formatter - ms-python.mypy-type-checker - ms-python.python - ms-python.vscode-pylance - redhat.vscode-yaml - ryanluker.vscode-coverage-gutters - - Soulcode.vscode-unwanted-extensions + - soulcode.vscode-unwanted-extensions - stkb.rewrap - streetsidesoftware.code-spell-checker - tamasfe.even-better-toml - - tyriar.sort-lines - yzhang.markdown-all-in-one diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d82f9f0..8204f91 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: - id: check-useless-excludes - repo: https://github.com/ComPWA/policy - rev: 0.2.0 + rev: 0.2.6 hooks: - id: check-dev-files args: @@ -26,6 +26,13 @@ repos: - --repo-name=update-pip-constraints - id: format-setup-cfg + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.3.0 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: @@ -44,18 +51,25 @@ repos: args: ["--django"] - id: trailing-whitespace - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.12.1 + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v4.0.0-alpha.8 + hooks: + - id: prettier + + - repo: https://github.com/ComPWA/mirrors-taplo + rev: v0.8.1 hooks: - - id: black + - id: taplo - - repo: https://github.com/asottile/blacken-docs - rev: 1.16.0 + - repo: https://github.com/pappasam/toml-sort + rev: v0.23.1 hooks: - - id: blacken-docs + - id: toml-sort + args: + - --in-place - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v8.3.0 + rev: v8.5.0 hooks: - id: cspell @@ -63,7 +77,9 @@ repos: rev: 2.7.3 hooks: - id: editorconfig-checker - exclude: > + name: editorconfig + alias: ec + exclude: >- (?x)^( .*\.py )$ @@ -87,31 +103,7 @@ repos: types: - python - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v4.0.0-alpha.8 - hooks: - - id: prettier - - repo: https://github.com/ComPWA/mirrors-pyright - rev: v1.1.345 + rev: v1.1.352 hooks: - id: pyright - - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.13 - hooks: - - id: ruff - args: - - --fix - - - repo: https://github.com/ComPWA/mirrors-taplo - rev: v0.8.1 - hooks: - - id: taplo - - - repo: https://github.com/pappasam/toml-sort - rev: v0.23.1 - hooks: - - id: toml-sort - args: - - --in-place diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 2346a87..00f3534 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -7,17 +7,15 @@ "esbenp.prettier-vscode", "github.vscode-github-actions", "github.vscode-pull-request-github", - "ms-python.black-formatter", "ms-python.mypy-type-checker", "ms-python.python", "ms-python.vscode-pylance", "redhat.vscode-yaml", "ryanluker.vscode-coverage-gutters", - "Soulcode.vscode-unwanted-extensions", + "soulcode.vscode-unwanted-extensions", "stkb.rewrap", "streetsidesoftware.code-spell-checker", "tamasfe.even-better-toml", - "tyriar.sort-lines", "yzhang.markdown-all-in-one" ], "unwantedRecommendations": [ @@ -25,9 +23,11 @@ "davidanson.vscode-markdownlint", "dbaeumer.vscode-eslint", "garaioag.garaio-vscode-unwanted-recommendations", + "ms-python.black-formatter", "ms-python.flake8", "ms-python.isort", "ms-python.pylint", - "travisillig.vscode-json-stable-stringify" + "travisillig.vscode-json-stable-stringify", + "tyriar.sort-lines" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 9e567ba..9f64b31 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,13 +17,12 @@ "editor.formatOnSave": "explicit", "source.organizeImports": "explicit" }, - "editor.defaultFormatter": "ms-python.black-formatter", + "editor.defaultFormatter": "charliermarsh.ruff", "editor.rulers": [88] }, "[yaml]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "black-formatter.importStrategy": "fromEnvironment", "coverage-gutters.coverageFileNames": ["coverage.xml"], "coverage-gutters.coverageReportFileName": "**/htmlcov/index.html", "coverage-gutters.showGutterCoverage": false, @@ -39,19 +38,27 @@ }, "git.rebaseWhenSync": true, "github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"], + "gitlens.telemetry.enabled": false, "multiDiffEditor.experimental.enabled": true, "mypy-type-checker.args": ["--config-file=${workspaceFolder}/pyproject.toml"], "mypy-type-checker.importStrategy": "fromEnvironment", + "notebook.codeActionsOnSave": { + "notebook.source.organizeImports": "explicit" + }, + "notebook.formatOnSave.enabled": true, "python.analysis.inlayHints.pytestParameters": true, "python.analysis.typeCheckingMode": "strict", "python.testing.pytestArgs": ["--color=no", "--no-cov", "-vv"], "python.testing.pytestEnabled": true, "python.testing.unittestEnabled": false, + "redhat.telemetry.enabled": false, "rewrap.wrappingColumn": 88, "ruff.enable": true, + "ruff.importStrategy": "fromEnvironment", "ruff.organizeImports": true, "search.exclude": { "**/tests/**/__init__.py": true, ".constraints/*.txt": true - } + }, + "telemetry.telemetryLevel": "off" } diff --git a/README.md b/README.md index 3cd0316..4cdf747 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ComPWA/update-pip-constraints/main.svg)](https://results.pre-commit.ci/latest/github/ComPWA/update-pip-constraints/main) [![Spelling checked](https://img.shields.io/badge/cspell-checked-brightgreen.svg)](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) -[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) This Python package is a wrapper around diff --git a/environment.yml b/environment.yml index a70fbd9..f62955e 100644 --- a/environment.yml +++ b/environment.yml @@ -2,7 +2,7 @@ name: update-pip-constraints channels: - defaults dependencies: - - python==3.8.* + - python==3.9.* - pip - pip: - -e .[dev] diff --git a/pyproject.toml b/pyproject.toml index 772d32e..25bd41d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,32 +8,6 @@ requires = [ [tool.setuptools_scm] write_to = "src/update_pip_constraints/version.py" -[tool.black] -exclude = ''' -/( - .*\.egg-info - | .*build - | \.eggs - | \.git - | \.pytest_cache - | \.tox - | \.venv - | \.vscode - | dist -)/ -''' -include = '\.pyi?$' -preview = true -target-version = [ - "py310", - "py311", - "py312", - "py36", - "py37", - "py38", - "py39", -] - [tool.coverage.run] branch = true source = ["src"] @@ -94,6 +68,19 @@ testpaths = [ ] [tool.ruff] +preview = true +show-fixes = true +src = [ + "src", + "tests", +] +target-version = "py37" + +[tool.ruff.format] +docstring-code-format = true +line-ending = "lf" + +[tool.ruff.lint] extend-select = [ "A", "B", @@ -136,31 +123,32 @@ ignore = [ "D407", "D416", "E501", + "ISC001", + "PLW1514", "SIM108", "UP036", ] -show-fixes = true -src = [ - "src", - "tests", -] -target-version = "py37" task-tags = ["cspell"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.isort] +split-on-trailing-comma = false + +[tool.ruff.lint.per-file-ignores] "setup.py" = ["D100"] "src/update_pip_constraints/__init__.py" = ["E402"] "tests/*" = [ "D", "INP001", "PGH001", + "PLC2701", "PLR0913", "PLR2004", + "PLR6301", "S101", "T20", ] -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "google" [tool.tomlsort] diff --git a/setup.cfg b/setup.cfg index 9407d71..49d20e5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,20 +43,15 @@ package_dir = test = pytest pytest-cov -format = - black -mypy = - mypy +types = + pytest types-setuptools types-toml -lint = - %(mypy)s - ruff; python_version >="3.7.0" sty = - %(format)s - %(lint)s - %(test)s # for pytest type hints + %(types)s + mypy pre-commit + ruff; python_version >="3.7.0" dev = %(sty)s %(test)s diff --git a/tests/test_update_pip_constraints.py b/tests/test_update_pip_constraints.py index ce4c2ce..f5ba17c 100644 --- a/tests/test_update_pip_constraints.py +++ b/tests/test_update_pip_constraints.py @@ -34,7 +34,6 @@ def test_update_constraints_file(): with open(output_file) as stream: content = stream.read() expected_packages = [ - "black", "pip-tools", "pytest", "ruff",