8000 run pre-commit on all files (#1789) · LakshmanKishore/pyscript@4256a81 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4256a81

Browse files
authored
run pre-commit on all files (pyscript#1789)
pre-commit.ci has been disabled for a while. This PR ensures that all the files has been validated/formatted by pre-commit, to avoid spurious diffs in subsequent PRs. During the process, ruff broke the code because it removed an "unused" import which was actually used. A linter which breaks my code is a linter which I cannot trust, so I just removed it. I re-enabled isort instead.
1 parent d5b6935 commit 4256a81

File tree

16 files changed

+36
-57
lines changed

16 files changed

+36
-57
lines changed

.github/workflows/publish-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
- name: build
4343
run: npm run build
44-
44+
4545
- name: Generate index.html in snapshot
4646
working-directory: .
4747
run: sed 's#_PATH_#https://pyscript.net/releases/${{ github.ref_name }}/#' ./public/index.html > ./pyscript.core/dist/index.html

.github/workflows/publish-snapshot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ jobs:
3939
${{ runner.os }}-build-${{ env.cache-name }}-
4040
${{ runner.os }}-build-
4141
${{ runner.os }}-
42-
42+
4343
- name: Install Dependencies
4444
run: npm install
45-
45+
4646
- name: Build Pyscript.core
4747
run: npm run build
48-
48+
4949
- name: Configure AWS credentials
5050
uses: aws-actions/configure-aws-credentials@v4
5151
with:
@@ -58,4 +58,4 @@ jobs:
5858

5959
- name: Copy to Snapshot
6060
run: >
61-
aws s3 sync ./dist/ s3://pyscript.net/snapshots/${{ inputs.snapshot_version }}/
61+
aws s3 sync ./dist/ s3://pyscript.net/snapshots/${{ inputs.snapshot_version }}/

.github/workflows/publish-unstable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
- name: Build
4848
run: npm run build
49-
49+
5050
- name: Generate index.html in snapshot
5151
working-directory: .
5252
run: sed 's#_PATH_#https://pyscript.net/unstable/#' ./public/index.html > ./pyscript.core/dist/index.html

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Checkout
2727
uses: actions/checkout@v4
2828
with:
29-
fetch-depth: 3
29+
fetch-depth: 3
3030

3131
# display a git log: when you run CI on PRs, github automatically
3232
# merges the PR into main and run the CI on that commit. The idea

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This is the configuration for pre-commit, a local framework for managing pre-commit hooks
22
# Check out the docs at: https://pre-commit.com/
33
ci:
4-
skip: [eslint]
4+
#skip: [eslint]
55
autoupdate_schedule: monthly
66

77
default_stages: [commit]
@@ -24,13 +24,6 @@ repos:
2424
exclude: pyscript\.core/dist|\.min\.js$
2525
- id: trailing-whitespace
2626

27-
- repo: https://github.com/charliermarsh/ruff-pre-commit
28-
rev: v0.0.257
29-
hooks:
30-
- id: ruff
31-
exclude: pyscript\.core/src/stdlib/pyscript/__init__\.py|pyscript\.core/test|pyscript\.core/dist|pyscript\.core/src/stdlib/pyscript\.py
32-
args: [--fix]
33-
3427
- repo: https://github.com/psf/black
3528
rev: 23.1.0
3629
hooks:
@@ -51,3 +44,10 @@ repos:
5144
- id: prettier
5245
exclude: pyscript\.core/test|pyscript\.core/dist|pyscript\.core/types|pyscript.core/src/stdlib/pyscript.js|pyscript\.sw/
5346
args: [--tab-width, "4"]
47+
48+
- repo: https://github.com/pycqa/isort
49+
rev: 5.12.0
50+
hooks:
51+
- id: isort
52+
name: isort (python)
53+
args: [--profile, black]

public/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ <h2>Example</h2>
4747
display(now.strftime(&quot;%m/%d/%Y, %H:%M:%S&quot;))
4848
&lt;/py-script&gt;
4949
&lt;/body&gt;
50-
&lt;/html&gt;</pre>
50+
&lt;/html&gt;</pre
51+
>
5152
</main>
5253
</body>
53-
</html>
54+
</html>

pyproject.toml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,7 @@ dynamic = ["version"]
77

88
[tool.codespell]
99
ignore-words-list = "afterall"
10-
11-
[tool.ruff]
12-
builtins = [
13-
"Element",
14-
"pyscript",
15-
]
16-
ignore = [
17-
"S101",
18-
"S113",
19-
]
20-
line-length = 100
21-
select = [
22-
"B",
23-
"C9",
24-
"E",
25-
"F",
26-
"I",
27-
"S",
28-
"UP",
29-
"W",
30-
]
31-
target-version = "py310"
32-
33-
[tool.ruff.mccabe]
34-
max-complexity = 10
10+
skip = "*.js,*.json"
3511

3612
[tool.setuptools]
3713
include-package-data = false

pyscript.core/src/stdlib/pyscript/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
# pyscript.magic_js. This is the blessed way to access them from pyscript,
3030
# as it works transparently in both the main thread and worker cases.
3131

32+
from pyscript.display import HTML, display
3233
from pyscript.magic_js import (
3334
RUNNING_IN_WORKER,
3435
PyWorker,
35-
window,
36+
current_target,
3637
document,
3738
sync,
38-
current_target,
39+
window,
3940
)
40-
from pyscript.display import HTML, display
4141

4242
try:
4343
from pyscript.event_handling import when

pyscript.core/src/stdlib/pyscript/magic_js.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from pyscript.util import NotSupported
21
import js as globalThis
2+
from pyscript.util import NotSupported
33

44
RUNNING_IN_WORKER = not hasattr(globalThis, "document")
55

pyscript.core/test/pydom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import random
2+
from datetime import datetime as dt
3+
24
from pyscript import display
35
from pyweb import pydom
46
from pyweb.base import when
5-
from datetime import datetime as dt
67

78

89
@when("click", "#just-a-button")

0 commit comments

Comments
 (0)
0