mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2026-06-19 07:35:19 +00:00
Replace pre-commit with prek (#5142)
This commit is contained in:
@@ -37,7 +37,7 @@ Setting things up
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pre-commit install
|
||||
$ prek install -f
|
||||
|
||||
Finding something to do
|
||||
=======================
|
||||
@@ -100,7 +100,7 @@ Here's how to make a one-off code change.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pre-commit run -a
|
||||
$ prek run -a
|
||||
|
||||
- To actually make the commit (this will trigger tests style & type checks automatically):
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ The repository follows a standard structure for Python projects. Here are some k
|
||||
- Read the stability guide mentioned at docs/source/stability_policy.rst to understand if your changes
|
||||
are breaking or incompatible.
|
||||
- Try to make sure your code is asyncio-friendly and thread-safe.
|
||||
- Run `uv run pre-commit` to run pre-commit hooks before committing your changes, but after `git add`ing them.
|
||||
- Run `uv run prek` to run pre-commit hooks before committing your changes, but after `git add`ing them.
|
||||
- Make sure you always test your changes. Either update or write new tests in the `tests/` directory.
|
||||
|
||||
### Pull Requests:
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# Config file for workflows/labelling.yml
|
||||
|
||||
version: 1
|
||||
|
||||
labels:
|
||||
- label: "⚙️ dependencies"
|
||||
authors: ["dependabot[bot]", "pre-commit-ci[bot]"]
|
||||
- label: "🛠 code-quality"
|
||||
authors: ["pre-commit-ci[bot]"]
|
||||
@@ -1,19 +0,0 @@
|
||||
name: PR Labeler
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
pre-commit-ci:
|
||||
permissions:
|
||||
contents: read # for srvaroa/labeler to read config file
|
||||
pull-requests: write # for srvaroa/labeler to add labels in PR
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: srvaroa/labeler@0a20eccb8c94a1ee0bed5f16859aece1c45c3e55 # v1.13.0
|
||||
# Config file at .github/labeler.yml
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -0,0 +1,26 @@
|
||||
name: Prek checks
|
||||
permissions:
|
||||
contents: read # Needed to see what files to run pre-commit on
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- '**' # Matches all branch names, for PRs
|
||||
push:
|
||||
branches:
|
||||
- 'master' # Run tests on master branch
|
||||
|
||||
# Cancel any in-progress runs of this workflow for the same PR or branch when a new commit is pushed.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
prek:
|
||||
name: prek
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: j178/prek-action@0bb87d7f00b0c99306c8bcb8b8beba1eb581c037 # v1.1.1
|
||||
@@ -1,11 +1,3 @@
|
||||
ci:
|
||||
autofix_prs: false
|
||||
# We use Renovate to update this file now, but we can't disable automatic pre-commit updates
|
||||
# when using the `pre-commit` GitHub Action, so we set the schedule to quarterly to avoid
|
||||
# frequent updates.
|
||||
autoupdate_schedule: quarterly
|
||||
autoupdate_commit_msg: 'Bump `pre-commit` Hooks to Latest Versions'
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: 'v0.15.5'
|
||||
@@ -29,6 +21,7 @@ repos:
|
||||
- cachetools>=7.0.0,<8.0.0
|
||||
- aiolimiter~=1.1,<1.3
|
||||
- . # this basically does `pip install -e .`
|
||||
priority: 10
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.19.1
|
||||
hooks:
|
||||
@@ -46,6 +39,7 @@ repos:
|
||||
- cachetools>=7.0.0,<8.0.0
|
||||
- aiolimiter~=1.1,<1.3
|
||||
- . # this basically does `pip install -e .`
|
||||
priority: 10
|
||||
- id: mypy
|
||||
name: mypy-examples
|
||||
files: ^examples/.*\.py$
|
||||
@@ -58,3 +52,4 @@ repos:
|
||||
- APScheduler>=3.10.4,<3.12.0
|
||||
- cachetools>=7.0.0,<8.0.0
|
||||
- . # this basically does `pip install -e .`
|
||||
priority: 10
|
||||
|
||||
@@ -43,10 +43,6 @@
|
||||
:target: https://app.codacy.com/gh/python-telegram-bot/python-telegram-bot/dashboard
|
||||
:alt: Code quality: Codacy
|
||||
|
||||
.. image:: https://results.pre-commit.ci/badge/github/python-telegram-bot/python-telegram-bot/master.svg
|
||||
:target: https://results.pre-commit.ci/latest/github/python-telegram-bot/python-telegram-bot/master
|
||||
:alt: pre-commit.ci status
|
||||
|
||||
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
|
||||
:target: https://github.com/psf/black
|
||||
:alt: Code Style: Black
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Replace `pre-commit` with `prek`"
|
||||
[[pull_requests]]
|
||||
uid = "5142"
|
||||
author_uids = ["harshil21"]
|
||||
closes_threads = ["5138"]
|
||||
+1
-1
@@ -132,7 +132,7 @@ docs = [
|
||||
"pydantic >= 2.12.0a1 ; python_version >= '3.14'"
|
||||
]
|
||||
linting = [
|
||||
"pre-commit",
|
||||
"prek",
|
||||
"ruff==0.15.5",
|
||||
"mypy==1.18.2",
|
||||
"pylint==4.0.5"
|
||||
|
||||
Reference in New Issue
Block a user