mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
run pre-commit on all files (#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.
This commit is contained in:
2
.github/workflows/publish-release.yml
vendored
2
.github/workflows/publish-release.yml
vendored
@@ -41,7 +41,7 @@ jobs:
|
|||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Generate index.html in snapshot
|
- name: Generate index.html in snapshot
|
||||||
working-directory: .
|
working-directory: .
|
||||||
run: sed 's#_PATH_#https://pyscript.net/releases/${{ github.ref_name }}/#' ./public/index.html > ./pyscript.core/dist/index.html
|
run: sed 's#_PATH_#https://pyscript.net/releases/${{ github.ref_name }}/#' ./public/index.html > ./pyscript.core/dist/index.html
|
||||||
|
|||||||
8
.github/workflows/publish-snapshot.yml
vendored
8
.github/workflows/publish-snapshot.yml
vendored
@@ -39,13 +39,13 @@ jobs:
|
|||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||||
${{ runner.os }}-build-
|
${{ runner.os }}-build-
|
||||||
${{ runner.os }}-
|
${{ runner.os }}-
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
- name: Build Pyscript.core
|
- name: Build Pyscript.core
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Configure AWS credentials
|
- name: Configure AWS credentials
|
||||||
uses: aws-actions/configure-aws-credentials@v4
|
uses: aws-actions/configure-aws-credentials@v4
|
||||||
with:
|
with:
|
||||||
@@ -58,4 +58,4 @@ jobs:
|
|||||||
|
|
||||||
- name: Copy to Snapshot
|
- name: Copy to Snapshot
|
||||||
run: >
|
run: >
|
||||||
aws s3 sync ./dist/ s3://pyscript.net/snapshots/${{ inputs.snapshot_version }}/
|
aws s3 sync ./dist/ s3://pyscript.net/snapshots/${{ inputs.snapshot_version }}/
|
||||||
|
|||||||
2
.github/workflows/publish-unstable.yml
vendored
2
.github/workflows/publish-unstable.yml
vendored
@@ -46,7 +46,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Generate index.html in snapshot
|
- name: Generate index.html in snapshot
|
||||||
working-directory: .
|
working-directory: .
|
||||||
run: sed 's#_PATH_#https://pyscript.net/unstable/#' ./public/index.html > ./pyscript.core/dist/index.html
|
run: sed 's#_PATH_#https://pyscript.net/unstable/#' ./public/index.html > ./pyscript.core/dist/index.html
|
||||||
|
|||||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 3
|
fetch-depth: 3
|
||||||
|
|
||||||
# display a git log: when you run CI on PRs, github automatically
|
# display a git log: when you run CI on PRs, github automatically
|
||||||
# merges the PR into main and run the CI on that commit. The idea
|
# merges the PR into main and run the CI on that commit. The idea
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# This is the configuration for pre-commit, a local framework for managing pre-commit hooks
|
# This is the configuration for pre-commit, a local framework for managing pre-commit hooks
|
||||||
# Check out the docs at: https://pre-commit.com/
|
# Check out the docs at: https://pre-commit.com/
|
||||||
ci:
|
ci:
|
||||||
skip: [eslint]
|
#skip: [eslint]
|
||||||
autoupdate_schedule: monthly
|
autoupdate_schedule: monthly
|
||||||
|
|
||||||
default_stages: [commit]
|
default_stages: [commit]
|
||||||
@@ -24,13 +24,6 @@ repos:
|
|||||||
exclude: pyscript\.core/dist|\.min\.js$
|
exclude: pyscript\.core/dist|\.min\.js$
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
|
|
||||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
|
||||||
rev: v0.0.257
|
|
||||||
hooks:
|
|
||||||
- id: ruff
|
|
||||||
exclude: pyscript\.core/src/stdlib/pyscript/__init__\.py|pyscript\.core/test|pyscript\.core/dist|pyscript\.core/src/stdlib/pyscript\.py
|
|
||||||
args: [--fix]
|
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 23.1.0
|
rev: 23.1.0
|
||||||
hooks:
|
hooks:
|
||||||
@@ -51,3 +44,10 @@ repos:
|
|||||||
- id: prettier
|
- id: prettier
|
||||||
exclude: pyscript\.core/test|pyscript\.core/dist|pyscript\.core/types|pyscript.core/src/stdlib/pyscript.js|pyscript\.sw/
|
exclude: pyscript\.core/test|pyscript\.core/dist|pyscript\.core/types|pyscript.core/src/stdlib/pyscript.js|pyscript\.sw/
|
||||||
args: [--tab-width, "4"]
|
args: [--tab-width, "4"]
|
||||||
|
|
||||||
|
- repo: https://github.com/pycqa/isort
|
||||||
|
rev: 5.12.0
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
name: isort (python)
|
||||||
|
args: [--profile, black]
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ now = datetime.now()
|
|||||||
display(now.strftime("%m/%d/%Y, %H:%M:%S"))
|
display(now.strftime("%m/%d/%Y, %H:%M:%S"))
|
||||||
</py-script>
|
</py-script>
|
||||||
</body>
|
</body>
|
||||||
</html></pre>
|
</html></pre
|
||||||
|
>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -7,31 +7,7 @@ dynamic = ["version"]
|
|||||||
|
|
||||||
[tool.codespell]
|
[tool.codespell]
|
||||||
ignore-words-list = "afterall"
|
ignore-words-list = "afterall"
|
||||||
|
skip = "*.js,*.json"
|
||||||
[tool.ruff]
|
|
||||||
builtins = [
|
|
||||||
"Element",
|
|
||||||
"pyscript",
|
|
||||||
]
|
|
||||||
ignore = [
|
|
||||||
"S101",
|
|
||||||
"S113",
|
|
||||||
]
|
|
||||||
line-length = 100
|
|
||||||
select = [
|
|
||||||
"B",
|
|
||||||
"C9",
|
|
||||||
"E",
|
|
||||||
"F",
|
|
||||||
"I",
|
|
||||||
"S",
|
|
||||||
"UP",
|
|
||||||
"W",
|
|
||||||
]
|
|
||||||
target-version = "py310"
|
|
||||||
|
|
||||||
[tool.ruff.mccabe]
|
|
||||||
max-complexity = 10
|
|
||||||
|
|
||||||
[tool.setuptools]
|
[tool.setuptools]
|
||||||
include-package-data = false
|
include-package-data = false
|
||||||
|
|||||||
@@ -29,15 +29,15 @@
|
|||||||
# pyscript.magic_js. This is the blessed way to access them from pyscript,
|
# pyscript.magic_js. This is the blessed way to access them from pyscript,
|
||||||
# as it works transparently in both the main thread and worker cases.
|
# as it works transparently in both the main thread and worker cases.
|
||||||
|
|
||||||
|
from pyscript.display import HTML, display
|
||||||
from pyscript.magic_js import (
|
from pyscript.magic_js import (
|
||||||
RUNNING_IN_WORKER,
|
RUNNING_IN_WORKER,
|
||||||
PyWorker,
|
PyWorker,
|
||||||
window,
|
current_target,
|
||||||
document,
|
document,
|
||||||
sync,
|
sync,
|
||||||
current_target,
|
window,
|
||||||
)
|
)
|
||||||
from pyscript.display import HTML, display
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from pyscript.event_handling import when
|
from pyscript.event_handling import when
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from pyscript.util import NotSupported
|
|
||||||
import js as globalThis
|
import js as globalThis
|
||||||
|
from pyscript.util import NotSupported
|
||||||
|
|
||||||
RUNNING_IN_WORKER = not hasattr(globalThis, "document")
|
RUNNING_IN_WORKER = not hasattr(globalThis, "document")
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import random
|
import random
|
||||||
|
from datetime import datetime as dt
|
||||||
|
|
||||||
from pyscript import display
|
from pyscript import display
|
||||||
from pyweb import pydom
|
from pyweb import pydom
|
||||||
from pyweb.base import when
|
from pyweb.base import when
|
||||||
from datetime import datetime as dt
|
|
||||||
|
|
||||||
|
|
||||||
@when("click", "#just-a-button")
|
@when("click", "#just-a-button")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import pytest
|
|
||||||
from pyscript import document, when
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from pyscript import document, when
|
||||||
from pyweb import pydom
|
from pyweb import pydom
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
###### magic monkey patching ######
|
###### magic monkey patching ######
|
||||||
import sys
|
|
||||||
import builtins
|
import builtins
|
||||||
from pyscript import sync
|
import sys
|
||||||
|
|
||||||
from pyodide.code import eval_code
|
from pyodide.code import eval_code
|
||||||
|
from pyscript import sync
|
||||||
|
|
||||||
sys.stdout = sync
|
sys.stdout = sync
|
||||||
builtins.input = sync.readline
|
builtins.input = sync.readline
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from pyscript import display, sync
|
|
||||||
|
|
||||||
import a
|
import a
|
||||||
|
from pyscript import display, sync
|
||||||
|
|
||||||
display("Hello World", target="test", append=True)
|
display("Hello World", target="test", append=True)
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import re
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from .support import PyScriptTest, skip_worker, only_main
|
from .support import PyScriptTest, only_main, skip_worker
|
||||||
|
|
||||||
|
|
||||||
class TestBasic(PyScriptTest):
|
class TestBasic(PyScriptTest):
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
import html
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import html
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
@@ -15,9 +15,9 @@ from .support import (
|
|||||||
PyScriptTest,
|
PyScriptTest,
|
||||||
filter_inner_text,
|
filter_inner_text,
|
||||||
filter_page_content,
|
filter_page_content,
|
||||||
wait_for_render,
|
|
||||||
skip_worker,
|
|
||||||
only_main,
|
only_main,
|
||||||
|
skip_worker,
|
||||||
|
wait_for_render,
|
||||||
)
|
)
|
||||||
|
|
||||||
DISPLAY_OUTPUT_ID_PATTERN = r'script-py[id^="py-"]'
|
DISPLAY_OUTPUT_ID_PATTERN = r'script-py[id^="py-"]'
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from .support import PyScriptTest, filter_inner_text, only_main
|
from .support import PyScriptTest, filter_inner_text, only_main
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user