Skip to content

Commit

Permalink
MAINT: autoupdate pre-commit and dev files (#21)
Browse files Browse the repository at this point in the history
* FIX: add `.editorconfig` file
  • Loading branch information
redeboer authored Mar 5, 2024
1 parent 1880731 commit d043dcd
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 104 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"version": "0.2",
"ignorePaths": [
"**/.cspell.json",
".editorconfig",
".gitignore",
".gitpod.*",
".pre-commit-config.yaml",
Expand Down
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
10 changes: 0 additions & 10 deletions .github/dependabot.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
6 changes: 2 additions & 4 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tasks:
- init: pyenv local 3.8
- init: pyenv local 3.9
- init: pip install -e .[dev]

github:
Expand All @@ -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
60 changes: 26 additions & 34 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -44,26 +51,35 @@ 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

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.3
hooks:
- id: editorconfig-checker
exclude: >
name: editorconfig
alias: ec
exclude: >-
(?x)^(
.*\.py
)$
Expand All @@ -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
8 changes: 4 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
"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": [
"bungcip.better-toml",
"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"
]
}
13 changes: 10 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: update-pip-constraints
channels:
- defaults
dependencies:
- python==3.8.*
- python==3.9.*
- pip
- pip:
- -e .[dev]
Expand Down
56 changes: 22 additions & 34 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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]
Expand Down
15 changes: 5 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit d043dcd

Please sign in to comment.