Skip to content

Commit 6e58d79

Browse files
Merge branch 'main' into continue-in-finally
2 parents 487034a + dd97c21 commit 6e58d79

765 files changed

Lines changed: 9517 additions & 2300 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
env:
1111
# Also change CACHE_VERSION in the other workflows
12-
CACHE_VERSION: 6
12+
CACHE_VERSION: 7
1313
DEFAULT_PYTHON: 3.8
1414
PRE_COMMIT_CACHE: ~/.cache/pre-commit
1515

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Most of this is inspired by the mypy primer
2+
# See: https://github.com/hauntsaninja/mypy_primer
3+
# This is the primer job that runs on the default 'main' branch
4+
# It is also responsible for caching the packages to prime on
5+
6+
name: Primer / Main
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- doc/data/messages/**
14+
15+
env:
16+
CACHE_VERSION: 1
17+
18+
jobs:
19+
run-primer:
20+
name: Run / ${{ matrix.python-version }}
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 45
23+
strategy:
24+
matrix:
25+
python-version: ["3.8"]
26+
steps:
27+
- name: Check out code from GitHub
28+
uses: actions/checkout@v3.0.2
29+
- name: Set up Python ${{ matrix.python-version }}
30+
id: python
31+
uses: actions/setup-python@v3.1.2
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
# Restore cached Python environment
36+
- name: Generate partial Python venv restore key
37+
id: generate-python-key
38+
run: >-
39+
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
40+
hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt')
41+
}}"
42+
- name: Restore Python virtual environment
43+
id: cache-venv
44+
uses: actions/cache@v3.0.2
45+
with:
46+
path: venv
47+
key: >-
48+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
49+
steps.generate-python-key.outputs.key }}
50+
restore-keys: |
51+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}-
52+
- name: Create Python virtual environment
53+
if: steps.cache-venv.outputs.cache-hit != 'true'
54+
run: |
55+
python -m venv venv
56+
. venv/bin/activate
57+
python -m pip install -U pip setuptools wheel
58+
pip install -U -r requirements_test.txt
59+
60+
# Cache primer packages
61+
- name: Get commit string
62+
id: commitstring
63+
run: |
64+
. venv/bin/activate
65+
python tests/primer/primer_tool.py prepare --make-commit-string
66+
output=$(python tests/primer/primer_tool.py prepare --read-commit-string)
67+
echo "::set-output name=commitstring::$output"
68+
- name: Restore projects cache
69+
id: cache-projects
70+
uses: actions/cache@v3
71+
with:
72+
path: .pylint_primer_tests/
73+
key: >-
74+
${{ runner.os }}-${{ matrix.python-version }}-${{
75+
steps.commitstring.outputs.commitstring }}-primer
76+
- name: Regenerate cache
77+
run: |
78+
. venv/bin/activate
79+
python tests/primer/primer_tool.py prepare --clone
80+
- name: Upload output diff
81+
uses: actions/upload-artifact@v3
82+
with:
83+
name: primer_commitstring
84+
path: .pylint_primer_tests/commit_string.txt
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Most of this is inspired by the mypy primer
2+
# See: https://github.com/hauntsaninja/mypy_primer
3+
# This is the primer job that runs on every PR
4+
5+
name: Primer / Run
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- "pylint/**"
11+
- "tests/primer/**"
12+
- "requirements*"
13+
- ".github/workflows/**"
14+
15+
env:
16+
CACHE_VERSION: 1
17+
18+
jobs:
19+
run-primer:
20+
name: Run / ${{ matrix.python-version }}
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 120
23+
strategy:
24+
matrix:
25+
python-version: ["3.8"]
26+
steps:
27+
- name: Check out code from GitHub
28+
uses: actions/checkout@v3.0.2
29+
- name: Set up Python ${{ matrix.python-version }}
30+
id: python
31+
uses: actions/setup-python@v3.1.2
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
- uses: actions/setup-node@v1
35+
with:
36+
version: 12
37+
- run: npm install @octokit/rest
38+
39+
# Restore cached Python environment
40+
- name: Generate partial Python venv restore key
41+
id: generate-python-key
42+
run: >-
43+
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
44+
hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt')
45+
}}"
46+
- name: Restore Python virtual environment
47+
id: cache-venv
48+
uses: actions/cache@v3.0.2
49+
with:
50+
path: venv
51+
key: >-
52+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
53+
steps.generate-python-key.outputs.key }}
54+
restore-keys: |
55+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}-
56+
- name: Create Python virtual environment
57+
if: steps.cache-venv.outputs.cache-hit != 'true'
58+
run: |
59+
python -m venv venv
60+
. venv/bin/activate
61+
python -m pip install -U pip setuptools wheel
62+
pip install -U -r requirements_test.txt
63+
64+
# Cache primer packages
65+
- name: Download diffs
66+
uses: actions/github-script@v6
67+
with:
68+
script: |
69+
// Download 'main' pylint output
70+
const fs = require('fs');
71+
const { Octokit } = require("@octokit/rest");
72+
const octokit = new Octokit({});
73+
const runs = await octokit.rest.actions.listWorkflowRuns({
74+
owner: context.repo.owner,
75+
repo: context.repo.repo,
76+
workflow_id: ".github/workflows/primer_run_main.yaml",
77+
status: "completed"
78+
});
79+
const lastRunMain = runs.data.workflow_runs.reduce(function(prev, current) {
80+
return (prev.run_number > current.run_number) ? prev : current
81+
})
82+
console.log("Last run on main:")
83+
console.log(lastRunMain.html_url)
84+
const artifacts_main = await github.rest.actions.listWorkflowRunArtifacts({
85+
owner: context.repo.owner,
86+
repo: context.repo.repo,
87+
run_id: lastRunMain.id,
88+
});
89+
const [matchArtifactMain] = artifacts_main.data.artifacts.filter((artifact) =>
90+
artifact.name == "primer_commitstring");
91+
const downloadWorkflow = await github.rest.actions.downloadArtifact({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
artifact_id: matchArtifactMain.id,
95+
archive_format: "zip",
96+
});
97+
fs.writeFileSync("primer_commitstring.zip", Buffer.from(downloadWorkflow.data));
98+
- name: Copy and unzip the commit string
99+
run: |
100+
unzip primer_commitstring.zip
101+
cp commit_string.txt .pylint_primer_tests/commit_string.txt
102+
- name: Get commit string
103+
id: commitstring
104+
run: |
105+
. venv/bin/activate
106+
output=$(python tests/primer/primer_tool.py prepare --read-commit-string)
107+
echo "::set-output name=commitstring::$output"
108+
- name: Restore projects cache
109+
id: cache-projects
110+
uses: actions/cache@v3
111+
with:
112+
path: .pylint_primer_tests/
113+
key: >-
114+
${{ runner.os }}-${{ matrix.python-version }}-${{
115+
steps.commitstring.outputs.commitstring }}-primer
116+
- name: Check cache
117+
run: |
118+
. venv/bin/activate
119+
python tests/primer/primer_tool.py prepare --check
120+
121+
- name: Save PR number
122+
run: |
123+
echo ${{ github.event.pull_request.number }} | tee pr_number.txt
124+
- name: Upload PR number
125+
uses: actions/upload-artifact@v2
126+
with:
127+
name: primer_pylint_output_workflow
128+
path: pr_number.txt

.github/workflows/tests.yaml

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ jobs:
5858
- name: Run pytest
5959
run: |
6060
. venv/bin/activate
61-
pytest -vv --durations=20 --benchmark-disable --cov --cov-report= tests/
61+
pytest --durations=10 --benchmark-disable --cov --cov-report= tests/
6262
- name: Run functional tests with minimal messages config
6363
run: |
6464
. venv/bin/activate
6565
pytest -vv --minimal-messages-config tests/test_functional.py
6666
- name: Upload coverage artifact
67-
uses: actions/upload-artifact@v3.0.0
67+
uses: actions/upload-artifact@v3.1.0
6868
with:
6969
name: coverage-${{ matrix.python-version }}
7070
path: .coverage
@@ -159,7 +159,7 @@ jobs:
159159
run: >-
160160
echo "::set-output name=datetime::"$(date "+%Y%m%d_%H%M")
161161
- name: Upload benchmark artifact
162-
uses: actions/upload-artifact@v3.0.0
162+
uses: actions/upload-artifact@v3.1.0
163163
with:
164164
name:
165165
benchmark-${{ runner.os }}-${{ matrix.python-version }}_${{
@@ -213,7 +213,53 @@ jobs:
213213
- name: Run pytest
214214
run: |
215215
. venv\\Scripts\\activate
216-
pytest -vv --durations=20 --benchmark-disable tests/
216+
pytest --durations=10 --benchmark-disable tests/
217+
218+
tests-macos:
219+
name: run / ${{ matrix.python-version }} / macOS
220+
runs-on: macos-latest
221+
timeout-minutes: 25
222+
needs: tests-linux
223+
strategy:
224+
fail-fast: false
225+
matrix:
226+
# We only run on the oldest supported version on Mac
227+
python-version: [3.7]
228+
steps:
229+
- name: Check out code from GitHub
230+
uses: actions/checkout@v3.0.2
231+
- name: Set up Python ${{ matrix.python-version }}
232+
id: python
233+
uses: actions/setup-python@v3.1.2
234+
with:
235+
python-version: ${{ matrix.python-version }}
236+
- name: Generate partial Python venv restore key
237+
id: generate-python-key
238+
run: >-
239+
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
240+
hashFiles('setup.cfg', 'requirements_test_min.txt')
241+
}}"
242+
- name: Restore Python virtual environment
243+
id: cache-venv
244+
uses: actions/cache@v3.0.2
245+
with:
246+
path: venv
247+
key: >-
248+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
249+
steps.generate-python-key.outputs.key }}
250+
restore-keys: |
251+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}-
252+
- name: Create Python virtual environment
253+
if: steps.cache-venv.outputs.cache-hit != 'true'
254+
run: |
255+
python -m venv venv
256+
. venv/bin/activate
257+
python -m pip install -U pip setuptools wheel
258+
pip install -U -r requirements_test.txt
259+
- name: Run pytest
260+
run: |
261+
. venv/bin/activate
262+
pytest --durations=10 --benchmark-disable tests/
217263
218264
tests-pypy:
219265
name: run / ${{ matrix.python-version }} / Linux
@@ -257,4 +303,4 @@ jobs:
257303
- name: Run pytest
258304
run: |
259305
. venv/bin/activate
260-
pytest -vv --durations=20 --benchmark-disable tests/
306+
pytest --durations=10 --benchmark-disable tests/

.gitignore

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
/pylint.egg-info/
1010
.tox
1111
*.sw[a-z]
12-
doc/messages/
13-
doc/technical_reference/extensions.rst
14-
doc/technical_reference/features.rst
15-
doc/user_guide/configuration/all-options.rst
12+
# Can't use | operator in .gitignore, see
13+
# https://unix.stackexchange.com/a/31806/189111
14+
doc/user_guide/messages/convention/
15+
doc/user_guide/messages/error/
16+
doc/user_guide/messages/fatal/
17+
doc/user_guide/messages/information/
18+
doc/user_guide/messages/refactor/
19+
doc/user_guide/messages/warning/
1620
pyve
1721
build-stamp
1822
.coverage

.pre-commit-config.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
rev: v1.4
1414
hooks:
1515
- id: autoflake
16-
exclude: &fixtures tests/functional/|tests/input|doc/data/messages|tests(/\w*)*data/
16+
exclude: &fixtures tests(/\w*)*/functional/|tests/input|doc/data/messages|tests(/\w*)*data/
1717
args:
1818
- --in-place
1919
- --remove-all-unused-imports
@@ -80,13 +80,14 @@ repos:
8080
language: system
8181
types: [text]
8282
files: ^(ChangeLog|doc/whatsnew/\d+\.\d+\.rst)
83-
- repo: https://github.com/myint/rstcheck
84-
rev: "v5.0.0"
83+
- repo: https://github.com/rstcheck/rstcheck
84+
rev: "v6.0.0rc2"
8585
hooks:
8686
- id: rstcheck
87-
args: ["--ignore-roles=func,class,mod", "--report=warning"]
87+
args: ["--report-level=warning"]
8888
types: [text] # necessary to include ChangeLog file
8989
files: ^(ChangeLog|doc/(.*/)*.*\.rst)
90+
additional_dependencies: [Sphinx==4.5.0]
9091
- repo: https://github.com/pre-commit/mirrors-mypy
9192
rev: v0.950
9293
hooks:
@@ -106,9 +107,9 @@ repos:
106107
args: [--prose-wrap=always, --print-width=88]
107108
exclude: tests(/\w*)*data/
108109
- repo: https://github.com/DanielNoord/pydocstringformatter
109-
rev: v0.5.3
110+
rev: v0.6.0
110111
hooks:
111112
- id: pydocstringformatter
112113
exclude: *fixtures
113-
args: ["--split-summary-body", "--max-summary-lines=2"]
114+
args: ["--max-summary-lines=2", "--linewrap-full-docstring"]
114115
files: "pylint"

0 commit comments

Comments
 (0)