diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3d816e9750b..591e81853a0 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,12 +4,9 @@ ## Changes - + ## Checklist - - -- [ ] All tests pass locally -- [ ] I have updated `CHANGELOG.md` -- [ ] I have created documentation for this(if applicable) +- [ ] I have checked `make build` works locally. +- [ ] I have created / updated documentation for this change (if applicable). diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 56d5ff3c5a2..43fe719dbf1 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -7,7 +7,7 @@ on: defaults: run: - working-directory: ./pyscript.core + working-directory: ./core jobs: prepare-release: @@ -19,7 +19,22 @@ jobs: - name: Install node uses: actions/setup-node@v4 with: - node-version: 18.x + node-version: 20.x + + - name: Python venv + run: python -m venv env + + - name: Activate Python + run: source env/bin/activate + + - name: Update pip + run: pip install --upgrade pip + + - name: Install PyMinifier + run: pip install --ignore-requires-python python-minifier + + - name: Install Setuptools + run: pip install setuptools - name: Cache node modules uses: actions/cache@v4 @@ -35,14 +50,14 @@ jobs: ${{ runner.os }}- - name: NPM Install - run: npm install && npx playwright install + run: npm install && npx playwright install chromium - name: Build run: npm run build - name: Generate index.html working-directory: . - run: sed 's#_PATH_#./#' ./public/index.html > ./pyscript.core/dist/index.html + run: sed -e 's#_PATH_#./#' -e 's#_DOC_VERSION_#latest#' -e 's#_TAG_VERSION_##' -e 's#_VERSION_#latest#' ./public/index.html > ./core/dist/index.html - name: Zip dist folder run: zip -r -q ./build.zip ./dist diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 64f4f9ef693..5c605299dbc 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -6,7 +6,7 @@ on: defaults: run: - working-directory: ./pyscript.core + working-directory: ./core jobs: publish-release: @@ -21,7 +21,22 @@ jobs: - name: Install node uses: actions/setup-node@v4 with: - node-version: 18.x + node-version: 20.x + + - name: Python venv + run: python -m venv env + + - name: Activate Python + run: source env/bin/activate + + - name: Update pip + run: pip install --upgrade pip + + - name: Install PyMinifier + run: pip install --ignore-requires-python python-minifier + + - name: Install Setuptools + run: pip install setuptools - name: Cache node modules uses: actions/cache@v4 @@ -37,14 +52,18 @@ jobs: ${{ runner.os }}- - name: npm install - run: npm install && npx playwright install + run: npm install && npx playwright install chromium - name: build run: npm run build - name: Generate index.html in snapshot working-directory: . - run: sed 's#_PATH_#https://pyscript.net/releases/${{ github.ref_name }}/#' ./public/index.html > ./pyscript.core/dist/index.html + run: sed -e 's#_PATH_#https://pyscript.net/releases/${{ github.ref_name }}/#' -e 's#_DOC_VERSION_#${{ github.ref_name }}#' -e 's#_TAG_VERSION_#/tag/${{ github.ref_name }}#' -e 's#_VERSION_#${{ github.ref_name }}#' ./public/index.html > ./core/dist/index.html + + - name: Generate release.tar from snapshot and put it in dist/ + working-directory: . + run: tar -cvf ../release.tar * && mv ../release.tar . - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index c270fa7651e..b7f51d52ae7 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -10,7 +10,7 @@ on: defaults: run: - working-directory: ./pyscript.core + working-directory: ./core jobs: publish-snapshot: @@ -25,7 +25,22 @@ jobs: - name: Install node uses: actions/setup-node@v4 with: - node-version: 18.x + node-version: 20.x + + - name: Python venv + run: python -m venv env + + - name: Activate Python + run: source env/bin/activate + + - name: Update pip + run: pip install --upgrade pip + + - name: Install PyMinifier + run: pip install --ignore-requires-python python-minifier + + - name: Install Setuptools + run: pip install setuptools - name: Cache node modules uses: actions/cache@v4 @@ -41,7 +56,7 @@ jobs: ${{ runner.os }}- - name: Install Dependencies - run: npm install && npx playwright install + run: npm install && npx playwright install chromium - name: Build Pyscript.core run: npm run build @@ -54,7 +69,7 @@ jobs: - name: Generate index.html in snapshot working-directory: . - run: sed 's#_PATH_#https://pyscript.net/snapshots/${{ inputs.snapshot_version }}/#' ./public/index.html > ./pyscript.core/dist/index.html + run: sed -e 's#_PATH_#https://pyscript.net/snapshots/${{ inputs.snapshot_version }}/#' -e 's#_DOC_VERSION_#${{ inputs.snapshot_version }}#' -e 's#_TAG_VERSION_#/tag/${{ inputs.snapshot_version }}#' -e 's#_VERSION_#${{ inputs.snapshot_version }}#' ./public/index.html > ./core/dist/index.html - name: Copy to Snapshot run: > diff --git a/.github/workflows/publish-unstable.yml b/.github/workflows/publish-unstable.yml index 2a81b52f3b5..89a0e2b8902 100644 --- a/.github/workflows/publish-unstable.yml +++ b/.github/workflows/publish-unstable.yml @@ -1,11 +1,11 @@ name: "Publish Unstable" on: - push: # Only run on merges into main that modify files under pyscript.core/ and examples/ + push: # Only run on merges into main that modify files under core/ and examples/ branches: - main paths: - - pyscript.core/** + - core/** - examples/** workflow_dispatch: @@ -18,7 +18,7 @@ jobs: contents: read defaults: run: - working-directory: ./pyscript.core + working-directory: ./core steps: - name: Checkout uses: actions/checkout@v4 @@ -26,7 +26,22 @@ jobs: - name: Install node uses: actions/setup-node@v4 with: - node-version: 18.x + node-version: 20.x + + - name: Python venv + run: python -m venv env + + - name: Activate Python + run: source env/bin/activate + + - name: Update pip + run: pip install --upgrade pip + + - name: Install PyMinifier + run: pip install --ignore-requires-python python-minifier + + - name: Install Setuptools + run: pip install setuptools - name: Cache node modules uses: actions/cache@v4 @@ -42,14 +57,14 @@ jobs: ${{ runner.os }}- - name: NPM Install - run: npm install && npx playwright install + run: npm install && npx playwright install chromium - name: Build run: npm run build - name: Generate index.html in snapshot working-directory: . - run: sed 's#_PATH_#https://pyscript.net/unstable/#' ./public/index.html > ./pyscript.core/dist/index.html + run: sed -e 's#_PATH_#./#' -e 's#_DOC_VERSION_#latest#' -e 's#_TAG_VERSION_##' -e 's#_VERSION_#latest#' ./public/index.html > ./core/dist/index.html - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 116f36fcd09..785b7cbbf3f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,20 +5,20 @@ on: branches: - main paths: - - pyscript.core/** + - core/** - .github/workflows/test.yml pull_request: # Only run on merges into main that modify certain files branches: - main paths: - - pyscript.core/** + - core/** - .github/workflows/test.yml workflow_dispatch: jobs: BuildAndTest: - runs-on: ubuntu-latest-8core + runs-on: ubuntu-latest env: MINICONDA_PYTHON_VERSION: py38 MINICONDA_VERSION: 4.11.0 @@ -69,24 +69,12 @@ jobs: make setup - name: Build - run: make build - - - name: Integration Tests - #run: make test-integration-parallel - run: | - make test-integration + run: make build # Integration tests run in the build step. - uses: actions/upload-artifact@v4 with: name: pyscript path: | - pyscript.core/dist/ + core/dist/ if-no-files-found: error retention-days: 7 - - - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: test_results - path: test_results/ - if-no-files-found: error diff --git a/.github/workflows/test_report.yml b/.github/workflows/test_report.yml deleted file mode 100644 index dbe61e9b80e..00000000000 --- a/.github/workflows/test_report.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Test Report -on: - workflow_run: - workflows: ['\[CI\] Test'] - types: - - completed -jobs: - report: - runs-on: ubuntu-latest-8core - steps: - - uses: dorny/test-reporter@v1.9.0 - with: - artifact: test_results - name: Test reports - path: "*.xml" - reporter: java-junit diff --git a/.gitignore b/.gitignore index d19ac9a9b6d..6ccef40cf9e 100644 --- a/.gitignore +++ b/.gitignore @@ -142,10 +142,11 @@ coverage/ test_results # @pyscript/core npm artifacts -pyscript.core/core.* -pyscript.core/dist -pyscript.core/dist.zip -pyscript.core/src/plugins.js -pyscript.core/src/stdlib/pyscript.js -pyscript.core/src/3rd-party/* -!pyscript.core/src/3rd-party/READMEmd +core/test-results/* +core/core.* +core/dist +core/dist.zip +core/src/plugins.js +core/src/stdlib/pyscript.js +core/src/3rd-party/* +!core/src/3rd-party/READMEmd diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6240966201a..b18b22ee168 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,10 +4,10 @@ ci: #skip: [eslint] autoupdate_schedule: monthly -default_stages: [commit] +default_stages: [pre-commit] repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-builtin-literals - id: check-case-conflict @@ -21,33 +21,33 @@ repos: - id: check-yaml - id: detect-private-key - id: end-of-file-fixer - exclude: pyscript\.core/dist|\.min\.js$ + exclude: core/dist|\.min\.js$ - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 24.4.2 + rev: 25.1.0 hooks: - id: black - exclude: pyscript\.core/src/stdlib/pyscript/__init__\.py + exclude: core/tests + args: ["-l", "88", "--skip-string-normalization"] - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.4.1 hooks: - id: codespell # See 'pyproject.toml' for args - exclude: \.js\.map$ + exclude: fs\.py|\.js\.map$ additional_dependencies: - tomli + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.8 + hooks: + - id: ruff + exclude: core/tests + - repo: https://github.com/hoodmane/pyscript-prettier-precommit rev: "v3.0.0-alpha.6" hooks: - id: prettier - exclude: pyscript\.core/test|pyscript\.core/dist|pyscript\.core/types|pyscript.core/src/stdlib/pyscript.js|pyscript\.sw/|pyscript.core/src/3rd-party + exclude: core/tests|core/dist|core/types|core/src/stdlib/pyscript.js|pyscript\.sw/|core/src/3rd-party args: [--tab-width, "4"] - - - repo: https://github.com/pycqa/isort - rev: 5.13.2 - hooks: - - id: isort - name: isort (python) - args: [--profile, black] diff --git a/.prettierignore b/.prettierignore index bff93a895e5..32b310b5153 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,3 @@ ISSUE_TEMPLATE *.min.* package-lock.json -docs -examples/panel.html diff --git a/.readthedocs.yml b/.readthedocs.yml deleted file mode 100644 index b5324a7e886..00000000000 --- a/.readthedocs.yml +++ /dev/null @@ -1,28 +0,0 @@ -# .readthedocs.yaml -# Read the Docs configuration file -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -# Required -version: 2 - -# Set the version of Python and other tools you might need -build: - os: ubuntu-20.04 - tools: - python: miniconda3-4.7 - -# Build documentation in the docs/ directory with Sphinx -sphinx: - configuration: docs/conf.py - -conda: - environment: docs/environment.yml - -# If using Sphinx, optionally build your docs in additional formats such as PDF -# formats: -# - pdf - -# Optionally declare the Python requirements required to build your docs -python: - install: - - requirements: docs/requirements.txt diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index c536d8c4907..00000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,87 +0,0 @@ -# Release Notes - -## 2023.05.01 - -### Features - -- Added the `xterm` attribute to `py-config`. When set to `True` or `xterm`, an (output-only) [xterm.js](http://xtermjs.org/) terminal will be used in place of the default py-terminal. -- The default version of Pyodide is now `0.23.2`. See the [Pyodide Changelog](https://pyodide.org/en/stable/project/changelog.html#version-0-23-2) for a detailed list of changes. -- Added the `@when` decorator for attaching Python functions as event handlers -- The `py-mount` attribute on HTML elements has been deprecated, and will be removed in a future release. - -#### Runtime py- attributes - -- Added logic to react to `py-*` attributes changes, removal, `py-*` attributes added to already live nodes but also `py-*` attributes added or defined via injected nodes (either appended or via `innerHTML` operations). ([#1435](https://github.com/pyscript/pyscript/pull/1435)) - -#### <script type="py"> - -- Added the ability to optionally use ` + +
+ + + +