diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index af4bcd5e2dc..2e178927525 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -2,62 +2,64 @@ name: Bug Report description: Create a report to help us improve labels: ["type: bug", "needs-triage"] body: -- type: markdown + - type: markdown attributes: - value: | - Thanks for helping PyScript! 🐍 + value: | + Thanks for helping PyScript! 🐍 - Going through bugs and issues takes up a lot of time, so please be so kind and take a few minutes to fill out all the areas to the best of your ability. + Going through bugs and issues takes up a lot of time, so please be so kind and take a few minutes to fill out all the areas to the best of your ability. - There will always be more issues than there is time to do them, and so we will need to selectively close issues that don't provide enough information, so we can focus our time on helping people like you who fill out the issue form completely. Thank you for your collaboration! + There will always be more issues than there is time to do them, and so we will need to selectively close issues that don't provide enough information, so we can focus our time on helping people like you who fill out the issue form completely. Thank you for your collaboration! - There are also already a lot of open issues, so please take 2 minutes and search through existing ones to see if what you are experiencing already exists + There are also already a lot of open issues, so please take 2 minutes and search through existing ones to see if what you are experiencing already exists. - Thanks for helping PyScript be amazing. We are nothing without people like you helping build a better community 💐! -- type: checkboxes + Finally, if you are opening **a bug report related to PyScript.com** please [use this repository instead](https://github.com/anaconda/pyscript-dot-com-issues/issues/new/choose). + + Thanks for helping PyScript be amazing. We are nothing without people like you helping build a better community 💐! + - type: checkboxes id: checks attributes: - label: Checklist - description: Please confirm and check all the following options. - options: - - label: I added a descriptive title - required: true - - label: I searched for other issues and couldn't find a solution or duplication - required: true - - label: I already searched in Google and didn't find any good information or help - required: true -- type: textarea + label: Checklist + description: Please confirm and check all the following options. + options: + - label: I added a descriptive title + required: true + - label: I searched for other issues and couldn't find a solution or duplication + required: true + - label: I already searched in Google and didn't find any good information or help + required: true + - type: textarea id: what-happened attributes: - label: What happened? - description: And what should have happened instead? This really helps everyone review quicker and greatly increases the chance that someone can get around to solve your issue - placeholder: Tell us what you see! + label: What happened? + description: And what should have happened instead? This really helps everyone review quicker and greatly increases the chance that someone can get around to solve your issue + placeholder: Tell us what you see! validations: - required: true -- type: dropdown + required: true + - type: dropdown id: browsers attributes: - label: What browsers are you seeing the problem on? (if applicable) - multiple: true - options: - - Firefox - - Chrome - - Safari - - Microsoft Edge - - Other + label: What browsers are you seeing the problem on? (if applicable) + multiple: true + options: + - Firefox + - Chrome + - Safari + - Microsoft Edge + - Other validations: - required: false -- type: textarea + required: false + - type: textarea id: list attributes: - label: Console info - description: | - If there are errors in your browser console then its helpful to be able to troubleshoot. - - Chrome , Firefox, and Edge: Right-click on the page and select *Inspect*. Alternatively you can press F12 on your keyboard. - - Safari: Find instructions [here](https://support.apple.com/guide/safari/use-the-developer-tools-in-the-develop-menu-sfri20948/mac). - render: shell -- type: textarea + label: Console info + description: | + If there are errors in your browser console then its helpful to be able to troubleshoot. + - Chrome , Firefox, and Edge: Right-click on the page and select *Inspect*. Alternatively you can press F12 on your keyboard. + - Safari: Find instructions [here](https://support.apple.com/guide/safari/use-the-developer-tools-in-the-develop-menu-sfri20948/mac). + render: shell + - type: textarea id: context attributes: - label: Additional Context - description: Add any additional context information or screenshots you think are useful. + label: Additional Context + description: Add any additional context information or screenshots you think are useful. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 451a4c5db6d..cbd90d4bb82 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,8 @@ -blank_issues_enabled: false +blank_issues_enabled: true contact_links: -- name: Question - url: https://community.anaconda.cloud/c/tech-topics/pyscript + - name: Feature Proposals + url: https://github.com/pyscript/pyscript/discussions/new?category=proposals + about: Create a feature request to make PyScript even better + - name: Questions + url: https://github.com/pyscript/pyscript/discussions/new?category=q-a about: For questions or discussions about pyscript diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml deleted file mode 100644 index 5f791094c95..00000000000 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Feature Request -description: Create a feature request to make PyScript even better -labels: ["type: enhancement", "needs-triage"] -body: -- type: markdown - attributes: - value: | - ### Thanks for helping PyScript! 🐍 - - Going through feature requests and issues takes up a lot of time, so please be so kind and take a few minutes to fill out all the areas to the best of your ability. - - There will always be more great ideas than there is time to do them, and so we will need to selectively close issues that don't provide enough information, so everyone can focus our time on helping people like you who fill out the form completely. Thank you for your collaboration! - - There are also already a lot of open requests, so please take 2 minutes and search through existing ones to see if your idea already exists. If you find something close, please upvote that request and comment. - - Thanks for helping PyScript be amazing. We are nothing without people like you helping build a better community 💐! - - ### Lets make sure you are in the right place. If you have an idea/request for: - - - #### A specific package/library (such as pandas or scikit learn): - - Search for that respective library on github repo or website. You will have much more success there. - - - #### A general Python question/feature request: - - Try out a forum post [here](https://discuss.python.org/c/users/7) - -- type: checkboxes - id: checks - attributes: - label: Checklist - description: Please confirm and check all the following options - options: - - label: I added a descriptive title - required: true - - label: I searched for other feature requests and couldn't find a duplicate (including also the ``type-feature`` tag) - required: true - - label: I confirmed that it's not related to another project are area (see the above section) - required: true -- type: textarea - id: request-idea - attributes: - label: What is the idea? - description: Describe what the feature is and the desired state - placeholder: This feature would allow any user of PyScript to type in a simple command in the console and show all variables currently in use - validations: - required: true -- type: textarea - id: why - attributes: - label: Why is this needed - description: | - Who would benefit from this and why would this add value to them? What problem does this solve? - placeholder: This would benefit users who would like to see what is being used so they can learn and debug faster -- type: textarea - id: what - attributes: - label: What should happen? - description: | - What should be the user experience with the feature? Describe from a user perpective what they would do and see - placeholder: A user would type in ``PyScript debug`` in the browser console and see a list of all variables created. -- type: textarea - id: context - attributes: - label: Additional Context - description: | - Is there any other information that you think would be valuable for the team to know? diff --git a/.github/ISSUE_TEMPLATE/misc.yml b/.github/ISSUE_TEMPLATE/misc.yml deleted file mode 100644 index cb327275c88..00000000000 --- a/.github/ISSUE_TEMPLATE/misc.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Miscellaneous -description: For issues that don't belong in other categories -labels: ["type: misc", "needs-triage"] -body: -- type: markdown - attributes: - value: | - Thanks for helping PyScript! 🐍 - - This issue is for things that doesn't make sense to put into the other issue categories and we don't want it to get lost. - - Going through issues takes up a lot of time, so please be so kind and take a few minutes to fill out all the areas to the best of your ability. - - There will always be more issues than there is time to do them, and so we will need to selectively close issues that don't provide enough information, so we can focus our time on helping people like you who fill out the issue form completely. Thank you for your collaboration! - - There are also already a lot of open issues, so please take 2 minutes and search through existing ones to see if what you are experiencing already exists - - Thanks for helping PyScript be amazing. We are nothing without people like you helping build a better community 💐! -- type: checkboxes - id: checks - attributes: - label: Checklist - description: Please confirm and check all the following options. - options: - - label: I added a descriptive title - required: true - - label: I searched for other issues and couldn't find a duplication - required: true - - label: I already searched in Google and didn't find any good information or help - required: true -- type: textarea - id: what - attributes: - label: What is the issue/comment/problem? - description: This is a miscellaneous issue so this could be just about anything. We simply ask that you provide as many details as you can to help spur discussion or the outcome you want. - validations: - required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..591e81853a0 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,12 @@ +## Description + + + +## Changes + + + +## Checklist + +- [ ] I have checked `make build` works locally. +- [ ] I have created / updated documentation for this change (if applicable). diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000..e29bff2bead --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# Keep GitHub Actions up to date with GitHub's Dependabot... +# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + groups: + github-actions: + patterns: + - "*" # Group all Actions updates into a single larger pull request + schedule: + interval: weekly diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000000..0bc80808634 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,5 @@ +changelog: + categories: + - title: New Features + - title: Breaking Changes + - title: Known Issues diff --git a/.github/workflows/build-alpha.yml b/.github/workflows/build-alpha.yml deleted file mode 100644 index 30b2501b8a1..00000000000 --- a/.github/workflows/build-alpha.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: '[CI] Build Alpha' - -on: - push: - tags: - - '**' # Currently any tag, need to slim down - paths: - - pyscriptjs/** - -env: - MINICONDA_PYTHON_VERSION: py38 - MINICONDA_VERSION: 4.11.0 - -defaults: - run: - working-directory: pyscriptjs - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - - name: Checkout - uses: actions/checkout@v3 - - - name: Install node - uses: actions/setup-node@v3 - with: - node-version: 18.x - - - name: Cache node modules - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: setup Miniconda - uses: conda-incubator/setup-miniconda@v2 - - - name: Setup Environment - run: make setup - - - name: Build and Test - run: make test - - # Deploy to S3 - - name: Configure AWS credentials - if: github.ref == 'refs/heads/main' # Only deploy on merge into main - uses: aws-actions/configure-aws-credentials@v1.6.1 - with: - aws-region: ${{secrets.AWS_REGION}} - role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} - - - name: Sync to S3 - if: github.ref == 'refs/heads/main' - run: aws s3 sync --quiet ./examples/build/ s3://pyscript.net/alpha/ diff --git a/.github/workflows/build-latest.yml b/.github/workflows/build-latest.yml deleted file mode 100644 index 8477cf15c0f..00000000000 --- a/.github/workflows/build-latest.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: '[CI] Build Latest' - -on: - push: # Only run on merges into main that modify files under pyscriptjs/ - branches: - - main - paths: - - pyscriptjs/** - - .github/workflows/build-latest.yml # Test that workflow works when changed - - pull_request: # Run on any PR that modifies files in pyscriptjs/ - branches: - - main - paths: - - pyscriptjs/** - - .github/workflows/build-latest.yml # Test that workflow works when changed - -env: - MINICONDA_PYTHON_VERSION: py38 - MINICONDA_VERSION: 4.11.0 - -defaults: - run: - working-directory: pyscriptjs - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - - name: Checkout - uses: actions/checkout@v3 - - - name: Install node - uses: actions/setup-node@v3 - with: - node-version: 18.x - - - name: Cache node modules - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: setup Miniconda - uses: conda-incubator/setup-miniconda@v2 - - - name: Setup Environment - run: make setup - - - name: Build and Test - run: make test - - # Deploy to S3 - - name: Configure AWS credentials - if: github.ref == 'refs/heads/main' # Only deploy on merge into main - uses: aws-actions/configure-aws-credentials@v1.6.1 - with: - aws-region: ${{secrets.AWS_REGION}} - role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} - - - name: Sync to S3 - if: github.ref == 'refs/heads/main' - run: aws s3 sync --quiet ./examples/build/ s3://pyscript.net/unstable diff --git a/.github/workflows/docs-latest.yml b/.github/workflows/docs-latest.yml deleted file mode 100644 index 1a05385e7ba..00000000000 --- a/.github/workflows/docs-latest.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: '[Docs] Build Latest' - -on: - push: - branches: - - main - paths: - - docs/** - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - env: - SPHINX_HTML_BASE_URL: https://docs.pyscript.net/ - steps: - - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - - name: Setup - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - activate-environment: docs - environment-file: docs/environment.yml - python-version: '3.9' - - - name: Build - shell: bash -l {0} - run: | - cd docs/ - make html - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: pyscript-docs-latest - path: docs/_build/html/ - - # Deploy to S3 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1.6.1 - with: - aws-region: ${{secrets.AWS_REGION}} - role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} - - - name: Copy redirect file - run: aws s3 cp --quiet ./docs/_build/html/_static/redirect.html s3://docs.pyscript.net/index.html - - # - name: Delete latest directory - # run: aws s3 rm --recursive s3://docs.pyscript.net/latest/ - - - name: Sync to S3 - run: aws s3 sync --quiet ./docs/_build/html/ s3://docs.pyscript.net/latest/ diff --git a/.github/workflows/docs-release.yml b/.github/workflows/docs-release.yml deleted file mode 100644 index a007e9bc8d5..00000000000 --- a/.github/workflows/docs-release.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: '[Docs] Build Release' - -on: - # Any time a tag or branch is created - # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#create - create: - paths: - - docs/** - -jobs: - build: - if: startsWith(github.ref, 'refs/tags') # Only if tagged - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - env: - SPHINX_HTML_BASE_URL: https://docs.pyscript.net/ - steps: - - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - - name: Setup - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - activate-environment: docs - environment-file: docs/environment.yml - python-version: '3.9' - - - name: Build - shell: bash -l {0} - run: | - cd docs/ - make html - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: pyscript-docs-${{ github.ref_name }} - path: docs/_build/html/ - - # Deploy to S3 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1.6.1 - with: - aws-region: ${{secrets.AWS_REGION}} - role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} - - - name: Copy redirect file - run: aws s3 cp --quiet ./docs/_build/html/_static/redirect.html s3://docs.pyscript.net/index.html - - # - name: Delete release directory - # run: aws s3 rm --recursive s3://docs.pyscript.net/${{ github.ref_name }}/ - - - name: Sync to S3 - run: aws s3 sync --quiet ./docs/_build/html/ s3://docs.pyscript.net/${{ github.ref_name }}/ diff --git a/.github/workflows/docs-review.yml b/.github/workflows/docs-review.yml deleted file mode 100644 index 358efd24c1e..00000000000 --- a/.github/workflows/docs-review.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: '[Docs] Build Review' - -on: - pull_request: - branches: - - '*' - paths: - - docs/** - -concurrency: - # Concurrency group that uses the workflow name and PR number if available - # or commit SHA as a fallback. If a new build is triggered under that - # concurrency group while a previous build is running it will be canceled. - # Repeated pushes to a PR will cancel all previous builds, while multiple - # merges to main will not cancel. - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - env: - SPHINX_HTML_BASE_URL: https://docs.pyscript.net/ - steps: - - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - - name: Setup - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - activate-environment: docs - environment-file: docs/environment.yml - python-version: '3.9' - - - name: Build - shell: bash -l {0} - run: | - cd docs/ - make html - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: pyscript-docs-review-${{ github.event.number }} - path: docs/_build/html/ - - # Deploy to S3 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1.6.1 - with: - aws-region: ${{secrets.AWS_REGION}} - role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} - - - name: Copy redirect file - run: aws s3 cp --quiet ./docs/_build/html/_static/redirect.html s3://docs.pyscript.net/index.html - - # - name: Delete review directory - # run: aws s3 rm --recursive s3://docs.pyscript.net/review/${{ github.event.number }}/ - - - name: Sync to S3 - run: aws s3 sync --quiet ./docs/_build/html/ s3://docs.pyscript.net/review/${{ github.event.number }}/ - - - name: Adding step summary - run: | - echo "### Review documentation" >> $GITHUB_STEP_SUMMARY - echo "As with any pull request, you can find the rendered documentation version for pull request ${{ github.event.number }} here:" - echo "" >> $GITHUB_STEP_SUMMARY # this is a blank line - echo "https://docs.pyscript.net/review/${{ github.event.number }}/" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 00000000000..43fe719dbf1 --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,71 @@ +name: "Prepare Release" + +on: + push: + tags: + - "[0-9][0-9][0-9][0-9].[0-9][0-9].[0-9]+" # YYYY.MM.MICRO + +defaults: + run: + working-directory: ./core + +jobs: + prepare-release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install node + uses: actions/setup-node@v4 + with: + 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 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: NPM Install + run: npm install && npx playwright install chromium + + - name: Build + run: npm run build + + - name: Generate index.html + working-directory: . + 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 + + - name: Prepare Release + uses: softprops/action-gh-release@v2 + with: + draft: true + prerelease: true + generate_release_notes: true + files: ./build.zip diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 00000000000..5c605299dbc --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,78 @@ +name: "Publish Release" + +on: + release: + types: [published] + +defaults: + run: + working-directory: ./core + +jobs: + publish-release: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install node + uses: actions/setup-node@v4 + with: + 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 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: npm install + run: npm install && npx playwright install chromium + + - name: build + run: npm run build + + - name: Generate index.html in snapshot + working-directory: . + 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 + with: + aws-region: ${{ secrets.AWS_REGION }} + role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} + + - name: Sync to S3 + run: + | # Update /latest and create an explicitly versioned directory under releases/YYYY.MM.MICRO/ + aws s3 sync --quiet ./dist/ s3://pyscript.net/latest/ + aws s3 sync --quiet ./dist/ s3://pyscript.net/releases/${{ github.ref_name }}/ diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml new file mode 100644 index 00000000000..b7f51d52ae7 --- /dev/null +++ b/.github/workflows/publish-snapshot.yml @@ -0,0 +1,76 @@ +name: "Publish Snapshot" + +on: + workflow_dispatch: + inputs: + snapshot_version: + description: "The calver version of this snapshot: 2022.09.1 or 2022.09.1.RC1" + type: string + required: true + +defaults: + run: + working-directory: ./core + +jobs: + publish-snapshot: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install node + uses: actions/setup-node@v4 + with: + 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 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Install Dependencies + run: npm install && npx playwright install chromium + + - name: Build Pyscript.core + run: npm run build + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-region: ${{ secrets.AWS_REGION }} + role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} + + - name: Generate index.html in snapshot + working-directory: . + 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: > + aws s3 sync ./dist/ s3://pyscript.net/snapshots/${{ inputs.snapshot_version }}/ diff --git a/.github/workflows/publish-unstable.yml b/.github/workflows/publish-unstable.yml new file mode 100644 index 00000000000..89a0e2b8902 --- /dev/null +++ b/.github/workflows/publish-unstable.yml @@ -0,0 +1,76 @@ +name: "Publish Unstable" + +on: + push: # Only run on merges into main that modify files under core/ and examples/ + branches: + - main + paths: + - core/** + - examples/** + + workflow_dispatch: + +jobs: + publish-unstable: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + defaults: + run: + working-directory: ./core + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install node + uses: actions/setup-node@v4 + with: + 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 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: NPM Install + run: npm install && npx playwright install chromium + + - name: Build + run: npm run build + + - name: Generate index.html in snapshot + working-directory: . + 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 + with: + aws-region: ${{ secrets.AWS_REGION }} + role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} + + - name: Sync to S3 + run: aws s3 sync --quiet ./dist/ s3://pyscript.net/unstable/ diff --git a/.github/workflows/sync-examples.yml b/.github/workflows/sync-examples.yml deleted file mode 100644 index c67c8c5c1a8..00000000000 --- a/.github/workflows/sync-examples.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: '[CI] Sync Examples' - -on: - push: # Only run on merges into main that modify files under examples/ - branches: - - main - paths: - - examples/** - - .github/workflows/sync-examples.yml # Test that workflow works when changed - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - defaults: - run: - working-directory: examples - - steps: - - # Deploy to S3 - - name: Checkout - uses: actions/checkout@v3 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1.6.1 - with: - aws-region: ${{secrets.AWS_REGION}} - role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} - - name: Sync to S3 - # Sync outdated or new files, delete ones no longer in source - run: aws s3 sync --quiet --delete . s3://pyscript.net/examples/ # Sync directory, delete what is not in source diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000000..785b7cbbf3f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,80 @@ +name: "[CI] Test" + +on: + push: # Only run on merges into main that modify certain files + branches: + - main + paths: + - core/** + - .github/workflows/test.yml + + pull_request: # Only run on merges into main that modify certain files + branches: + - main + paths: + - core/** + - .github/workflows/test.yml + workflow_dispatch: + +jobs: + BuildAndTest: + runs-on: ubuntu-latest + env: + MINICONDA_PYTHON_VERSION: py38 + MINICONDA_VERSION: 4.11.0 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 3 + + # 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 + # here is to show enough of git log to understand what is the + # actual commit (in the PR) that we are using. See also + # 'fetch-depth: 3' above. + - name: git log + run: git log --graph -3 + + - name: Install node + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Cache node modules + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: setup Miniconda + uses: conda-incubator/setup-miniconda@v3 + + - name: Create and activate virtual environment + run: | + python3 -m venv test_venv + source test_venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV + echo VIRTUAL_ENV=$VIRTUAL_ENV >> $GITHUB_ENV + + - name: Setup dependencies in virtual environment + run: | + make setup + + - name: Build + run: make build # Integration tests run in the build step. + + - uses: actions/upload-artifact@v4 + with: + name: pyscript + path: | + core/dist/ + if-no-files-found: error + retention-days: 7 diff --git a/.gitignore b/.gitignore index da873c29f20..6ccef40cf9e 100644 --- a/.gitignore +++ b/.gitignore @@ -51,7 +51,6 @@ coverage.xml *.py,cover .hypothesis/ .pytest_cache/ -pyscriptjs/examples # Translations *.mo @@ -136,3 +135,18 @@ dmypy.json .pyre/ node_modules/ + +coverage/ + +# junit xml for test results +test_results + +# @pyscript/core npm artifacts +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 4d1377d04e5..b18b22ee168 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,89 +1,53 @@ # This is the configuration for pre-commit, a local framework for managing pre-commit hooks # Check out the docs at: https://pre-commit.com/ +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.2.0 - hooks: - - id: check-builtin-literals - - id: check-case-conflict - - id: check-docstring-first - - id: check-executables-have-shebangs - - id: check-json - exclude: tsconfig.json - - id: check-toml - - id: check-xml - - id: check-yaml - - id: detect-private-key - - id: end-of-file-fixer - exclude: \.min\.js$ - - id: trailing-whitespace - -- repo: https://github.com/PyCQA/bandit - rev: 1.7.4 - hooks: - - id: bandit - args: - - --skip=B201 - -- repo: https://github.com/psf/black - rev: 22.3.0 - hooks: - - id: black - -- repo: https://github.com/codespell-project/codespell - rev: v2.1.0 - hooks: - - id: codespell # See 'setup.cfg' for args - -- repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 - hooks: - - id: flake8 # See 'setup.cfg' for args - additional_dependencies: [flake8-bugbear, flake8-comprehensions] - -- repo: https://github.com/pycqa/isort - rev: 5.10.1 - hooks: - - id: isort - name: isort (python) - args: [--profile, black] - -- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.3.0 - hooks: - - id: pretty-format-yaml - args: [--autofix, --indent, '4'] - exclude: .github/ISSUE_TEMPLATE/.*\.yml$ - -- repo: https://github.com/asottile/pyupgrade - rev: v2.32.1 - hooks: - - id: pyupgrade - args: - - --py310-plus - -- repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.16.0 - hooks: - - id: eslint - files: pyscriptjs/src/.*\.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx - types: [file] - additional_dependencies: - - eslint - - eslint-plugin-svelte3 - - typescript - - '@typescript-eslint/eslint-plugin' - - '@typescript-eslint/parser' - -# Commented out until mdformat-myst supports custom extensions -# See https://github.com/executablebooks/mdformat-myst/pull/9 -# - repo: https://github.com/executablebooks/mdformat -# rev: 0.7.14 # Use the ref you want to point at -# hooks: -# - id: mdformat -# additional_dependencies: -# - mdformat-gfm -# - mdformat-myst -# - mdformat-black + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-builtin-literals + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-json + exclude: tsconfig\.json + - id: check-toml + exclude: bad\.toml + - id: check-xml + - id: check-yaml + - id: detect-private-key + - id: end-of-file-fixer + exclude: core/dist|\.min\.js$ + - id: trailing-whitespace + + - repo: https://github.com/psf/black + rev: 25.1.0 + hooks: + - id: black + exclude: core/tests + args: ["-l", "88", "--skip-string-normalization"] + + - repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell # See 'pyproject.toml' for args + 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: core/tests|core/dist|core/types|core/src/stdlib/pyscript.js|pyscript\.sw/|core/src/3rd-party + args: [--tab-width, "4"] diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000..32b310b5153 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +ISSUE_TEMPLATE +*.min.* +package-lock.json diff --git a/.readthedocs.yml b/.readthedocs.yml deleted file mode 100644 index 78adcb2e958..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/CONTRIBUTING.md b/CONTRIBUTING.md index 6b770c1a862..8ce2c517a45 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,98 +1,4 @@ # Contributing to PyScript -Thank you for wanting to contribute to the PyScript project! - -## Table of contents - -* [Code of Conduct](#code-of-conduct) -* [Contributing](#contributing) - * [Reporting bugs](#reporting-bugs) - * [Reporting security issues](#reporting-security-issues) - * [Asking questions](#asking-questions) - * [Setting up your environment](#setting-up-your-environment) - * [Places to start](#places-to-start) - * [Submitting a change](#submitting-a-change) -* [License terms for contributions](#license-terms-for-contributions) -* [Becoming a maintainer](#becoming-a-maintainer) -* [Trademarks](#trademarks) - -## Code of Conduct - -The [PyScript Code of Conduct](https://github.com/pyscript/governance/blob/main/CODE-OF-CONDUCT.md) governs the project and everyone participating in it. By participating, you are expected to uphold this code. Please report unacceptable behavior to the maintainers or administrators as described in that document. - -## Contributing - -### Reporting bugs - -Bugs are tracked on the [project issues page](https://github.com/pyscript/pyscript/issues). Please check if your issue has already been filed by someone else by searching the existing issues before filing a new one. Once your issue is filed, it will be triaged by another contributor or maintainer. If there are questions raised about your issue, please respond promptly. - -#### Creating useful issues - -* Use a clear and descriptive title. -* Describe the specific steps that reproduce the problem with as many details as possible so that someone can verify the issue. -* Describe the behavior you observed, and the behavior you had expected. -* Include screenshots if they help make the issue clear. - -### Reporting security issues - -If you aren't confident that it is appropriate to submit a security issue using the above process, you can e-mail it to security@pyscript.net - -### Asking questions - -If you have questions about the project, using PyScript, or anything else, please ask in the [PyScript forum](https://community.anaconda.cloud/c/tech-topics/pyscript). - -### Setting up your environment - -* clone the repo -``` - git clone https://github.com/pyscript/pyscript -``` -* cd into the main project folder -``` - cd pyscript/pyscriptjs -``` -* install the dependencies with npm install - make sure to use nodejs version >= 16 -``` - npm install -``` -* run npm run dev to build and run the dev server. This will also watch for changes and rebuild when a file is saved. -``` - npm run dev -``` - -### Places to start - -If you would like to contribute to PyScript, but you aren't sure where to begin, here are some suggestions. - -* **Read over the existing documentation.** Are there things missing, or could they be clearer? Make some changes/additions to those documents. -* **Review the open issues.** Are they clear? Can you reproduce them? You can add comments, clarifications, or additions to those issues. If you think you have an idea of how to address the issue, submit a fix! -* **Look over the open pull requests.** Do you have comments or suggestions for the proposed changes? Add them. -* **Check out the examples.** Is there a use case that would be good to have sample code for? Create an example for it. - -### Submitting a change - -All contributions must be licensed Apache 2.0, and all files must have a copy of the boilerplate license comment (can be copied from an existing file). - -To create a change for PyScript, you can follow the process described [here](https://docs.github.com/en/get-started/quickstart/contributing-to-projects). - -* Fork a personal copy of the PyScript project. -* Make the changes you would like (don't forget to test them!) -* Please squash all commits for a change into a single commit (this can be done using "git rebase -i"). Do your best to have a well-formed commit message for the change. -* Open a pull request back to the PyScript project and address any comments/questions from the maintainers and other contributors. - -## License terms for contributions - -This Project welcomes contributions, suggestions, and feedback. All contributions, suggestions, and feedback you submitted are accepted under the [Apache 2.0](./LICENSE) license. You represent that if you do not own copyright in the code that you have the authority to submit it under the [Apache 2.0](./LICENSE) license. All feedback, suggestions, or contributions are not confidential. - - -## Becoming a maintainer - -Contributors are invited to be maintainers of the project by demonstrating good decision making in their contributions, a commitment to the goals of the project, and consistent adherence to the [code of conduct](https://github.com/pyscript/governance/blob/main/CODE-OF-CONDUCT.md). New maintainers are invited by a 3/4 vote of the existing maintainers. - -## Trademarks - -The Project abides by the Organization's [trademark policy](https://github.com/pyscript/governance/blob/main/TRADEMARKS.md). - ---- -Part of MVG-0.1-beta. -Made with love by GitHub. Licensed under the [CC-BY 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/). +Please see our guide to contributing to PyScript +[in our documentation](https://docs.pyscript.net/latest/contributing/). diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 4baa1d88374..4a7cc5032a7 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -41,5 +41,6 @@ Any names, trademarks, logos, or goodwill developed by and associated with the P Amendments to this governance policy may be made by affirmative vote of 2/3 of all Maintainers, with approval by the Organization's Steering Committee. --- + Part of MVG-0.1-beta. Made with love by GitHub. Licensed under the [CC-BY 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/). diff --git a/LICENSE b/LICENSE index 261eeb9e9f8..aa530349d35 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,11 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + + Copyright (c) 2022-present, PyScript Development Team + + Originated at Anaconda, Inc. in 2022 + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 58d4eee6c52..ab141aa6186 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -2,17 +2,23 @@ This document lists the Maintainers of the Project. Maintainers may be added once approved by the existing maintainers as described in the [Governance document](https://github.com/pyscript/pyscript/blob/main/GOVERNANCE.md). By adding your name to this list you are agreeing to abide by the Project governance documents and to abide by all of the Organization's polices, including the [code of conduct](https://github.com/pyscript/governance/blob/main/CODE-OF-CONDUCT.md), [trademark policy](https://github.com/pyscript/governance/blob/main/TRADEMARKS.md), and [antitrust policy](https://github.com/pyscript/governance/blob/main/TRADEMARKS.md). If you are participating because of your affiliation with another organization (designated below), you represent that you have the authority to bind that organization to these policies. -| **NAME** | **Organization** | -| ---------------- | ---------------- | -| Fabio Pliger | Anaconda, Inc | -| Antonio Cuni | Anaconda, Inc | -| Philipp Rudiger | Anaconda, Inc | -| Peter Wang | Anaconda, Inc | -| Kevin Goldsmith | Anaconda, Inc | -| Mariana Meireles | Anaconda, Inc | -| --- | --- | +| **NAME** | **Organization** | +| -------------------- | ---------------- | +| Fabio Pliger | Anaconda, Inc | +| Antonio Cuni | Anaconda, Inc | +| Philipp Rudiger | Anaconda, Inc | +| Peter Wang | Anaconda, Inc | +| Kevin Goldsmith | Anaconda, Inc | +| Mariana Meireles | | +| Nicholas H.Tollervey | Anaconda, Inc | +| Madhur Tandon | Anaconda, Inc | +| Ted Patrick | Anaconda, Inc | +| Jeff Glass | | +| Paul Everitt | | +| Fabio Rosado | Anaconda, Inc | +| Andrea Giammarchi | Anaconda, Inc | -______________________________________________________________________ +--- Part of MVG-0.1-beta. Made with love by GitHub. Licensed under the [CC-BY 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/). diff --git a/Makefile b/Makefile new file mode 100644 index 00000000000..0e603bfa847 --- /dev/null +++ b/Makefile @@ -0,0 +1,93 @@ +MIN_NODE_VER := 20 +MIN_NPM_VER := 6 +MIN_PY3_VER := 8 +NODE_VER := $(shell node -v | cut -d. -f1 | sed 's/^v\(.*\)/\1/') +NPM_VER := $(shell npm -v | cut -d. -f1) +PY3_VER := $(shell python3 -c "import sys;t='{v[1]}'.format(v=list(sys.version_info[:2]));print(t)") +PY_OK := $(shell python3 -c "print(int($(PY3_VER) >= $(MIN_PY3_VER)))") + +all: + @echo "\nThere is no default Makefile target right now. Try:\n" + @echo "make setup - check your environment and install the dependencies." + @echo "make update - update dependencies." + @echo "make clean - clean up auto-generated assets." + @echo "make build - build PyScript." + @echo "make precommit-check - run the precommit checks (run eslint)." + @echo "make test - run all automated tests in playwright." + @echo "make fmt - format the code." + @echo "make fmt-check - check the code formatting.\n" + +.PHONY: check-node +check-node: + @if [ $(NODE_VER) -lt $(MIN_NODE_VER) ]; then \ + echo "\033[0;31mBuild requires Node $(MIN_NODE_VER).x or higher: $(NODE_VER) detected.\033[0m"; \ + false; \ + fi + +.PHONY: check-npm +check-npm: + @if [ $(NPM_VER) -lt $(MIN_NPM_VER) ]; then \ + echo "\033[0;31mBuild requires Node $(MIN_NPM_VER).x or higher: $(NPM_VER) detected.\033[0m"; \ + false; \ + fi + +.PHONY: check-python +check-python: + @if [ $(PY_OK) -eq 0 ]; then \ + echo "\033[0;31mRequires Python 3.$(MIN_PY3_VER).x or higher: 3.$(PY3_VER) detected.\033[0m"; \ + false; \ + fi + +# Check the environment, install the dependencies. +setup: check-node check-npm check-python + cd core && npm ci && cd .. +ifeq (,$(VIRTUAL_ENV)$(CONDA_PREFIX)) + echo "\n\n\033[0;31mCannot install Python dependencies. Your virtualenv or conda env is not activated.\033[0m" + false +else + python -m pip install -r requirements.txt +endif + +# Clean up generated assets. +clean: + find . -name \*.py[cod] -delete + rm -rf $(env) *.egg-info + rm -rf .pytest_cache .coverage coverage.xml + +# Build PyScript. +build: precommit-check + cd core && npx playwright install chromium && npm run build + +# Update the dependencies. +update: + python -m pip install -r requirements.txt --upgrade + +# Run the precommit checks (run eslint). +precommit-check: + pre-commit run --all-files + +# Run all automated tests in playwright. +test: + cd core && npm run test:integration + +# Serve the repository with the correct headers. +serve: + npx mini-coi . + +# Format the code. +fmt: fmt-py + @echo "Format completed" + +# Check the code formatting. +fmt-check: fmt-py-check + @echo "Format check completed" + +# Format Python code. +fmt-py: + black -l 88 --skip-string-normalization . + +# Check the format of Python code. +fmt-py-check: + black -l 88 --check . + +.PHONY: $(MAKECMDGOALS) diff --git a/README.md b/README.md index 06af7ed0c99..130a20e6cbe 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,94 @@ # PyScript -## What is PyScript +## PyScript is an open source platform for Python in the browser. -### Summary +Using PyScript is as simple as: -PyScript is a Pythonic alternative to Scratch, JSFiddle, and other "easy to use" programming frameworks, with the goal of making the web a friendly, hackable place where anyone can author interesting and interactive applications. +```html + + +
+ + +