diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml deleted file mode 100644 index af4bcd5..0000000 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Bug Report -description: Create a report to help us improve -labels: ["type: bug", "needs-triage"] -body: -- type: markdown - attributes: - 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. - - 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 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! - validations: - 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 - validations: - 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 - id: context - attributes: - 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 deleted file mode 100644 index 451a4c5..0000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -blank_issues_enabled: false -contact_links: -- name: Question - url: https://community.anaconda.cloud/c/tech-topics/pyscript - 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 5f79109..0000000 --- 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 cb32727..0000000 --- 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/workflows/build-alpha.yml b/.github/workflows/build-alpha.yml deleted file mode 100644 index 30b2501..0000000 --- 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 8477cf1..0000000 --- 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 1a05385..0000000 --- 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 a007e9b..0000000 --- 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 c4924e5..0000000 --- a/.github/workflows/docs-review.yml +++ /dev/null @@ -1,78 +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: - if: >- - !github.event.repository.fork - 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/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..36f9b4d --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,27 @@ +name: '[CI] Run tests' + +on: [push] + +env: + MINICONDA_PYTHON_VERSION: py38 + MINICONDA_VERSION: 4.11.0 + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + + - name: Checkout + uses: actions/checkout@v3 + + - name: setup Miniconda + uses: conda-incubator/setup-miniconda@v2 + + - name: Setup Environment + run: make setup + + - name: Test + run: make test diff --git a/.github/workflows/sync-examples.yml b/.github/workflows/sync-examples.yml deleted file mode 100644 index c67c8c5..0000000 --- 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/GOVERNANCE.md b/GOVERNANCE.md deleted file mode 100644 index bbfda7a..0000000 --- a/GOVERNANCE.md +++ /dev/null @@ -1,46 +0,0 @@ -# Governance Policy - -This document provides the governance policy for the Project. Maintainers agree to this policy and to abide by all Project policies, 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/ANTITRUST.md) by adding their name to the [maintainers.md file](https://github.com/pyscript/pyscript/blob/main/MAINTAINERS.md). - -## 1. Roles. - -This project may include the following roles. Additional roles may be adopted and documented by the Project. - -**1.1. Maintainers**. Maintainers are responsible for organizing activities around developing, maintaining, and updating the Project. Maintainers are also responsible for determining consensus. This Project may add or remove Maintainers with the approval of the current Maintainers. - -**1.2. Contributors**. Contributors are those that have made contributions to the Project. - -## 2. Decisions. - -**2.1. Consensus-Based Decision Making**. Projects make decisions through consensus of the Maintainers. While explicit agreement of all Maintainers is preferred, it is not required for consensus. Rather, the Maintainers will determine consensus based on their good faith consideration of a number of factors, including the dominant view of the Contributors and nature of support and objections. The Maintainers will document evidence of consensus in accordance with these requirements. - -**2.2. Appeal Process**. Decisions may be appealed by opening an issue and that appeal will be considered by the Maintainers in good faith, who will respond in writing within a reasonable time. If the Maintainers deny the appeal, the appeal my be brought before the Organization Steering Committee, who will also respond in writing in a reasonable time. - -## 3. How We Work. - -**3.1. Openness**. Participation is open to anyone who is directly and materially affected by the activity in question. There shall be no undue financial barriers to participation. - -**3.2. Balance**. The development process should balance the interests of Contributors and other stakeholders. Contributors from diverse interest categories shall be sought with the objective of achieving balance. - -**3.3. Coordination and Harmonization**. Good faith efforts shall be made to resolve potential conflicts or incompatibility between releases in this Project. - -**3.4. Consideration of Views and Objections**. Prompt consideration shall be given to the written views and objections of all Contributors. - -**3.5. Written procedures**. This governance document and other materials documenting this project's development process shall be available to any interested person. - -## 4. No Confidentiality. - -Information disclosed in connection with any Project activity, including but not limited to meetings, contributions, and submissions, is not confidential, regardless of any markings or statements to the contrary. - -## 5. Trademarks. - -Any names, trademarks, logos, or goodwill developed by and associated with the Project (the "Marks") are controlled by the Organization. Maintainers may only use these Marks in accordance with the Organization's trademark policy. If a Maintainer resigns or is removed, any rights the Maintainer may have in the Marks revert to the Organization. - -## 6. Amendments. - -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/Makefile b/Makefile index e1551c6..6695b5b 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,45 @@ tag := latest git_hash ?= $(shell git log -1 --pretty=format:%h) -base_dir ?= $(shell git rev-parse --show-toplevel) -src_dir ?= $(base_dir)/src -examples ?= ../$(base_dir)/examples -app_dir ?= $(shell git rev-parse --show-prefix) - CONDA_EXE := conda CONDA_ENV ?= ./env env := $(CONDA_ENV) conda_run := $(CONDA_EXE) run -p $(env) +setup: + $(CONDA_EXE) env $(shell [ -d $(env) ] && echo update || echo create) -p $(env) --file environment.yml + $(conda_run) playwright install + $(CONDA_EXE) install -c anaconda pytest +# pip install playwright + +clean: + find . -name \*.py[cod] -delete + rm -rf .pytest_cache .coverage coverage.xml + +clean-all: clean + rm -rf $(env) *.egg-info + +shell: + @export CONDA_ENV_PROMPT='<{name}>' + @echo 'conda activate $(env)' + test: $(conda_run) pytest -vv $(ARGS) tests/ --log-cli-level=warning +test-py: + @echo "Tests are coming :( this is a placeholder and it's meant to fail!" + $(conda_run) pytest -vv $(ARGS) tests/ --log-cli-level=warning + +test-ts: + @echo "Tests are coming :( this is a placeholder and it's meant to fail!" + npm run tests + fmt: fmt-py fmt-ts @echo "Format completed" fmt-check: fmt-ts-check fmt-py-check @echo "Format check completed" -fmt-ts: - npm run format - -fmt-ts-check: - npm run format:check - fmt-py: $(conda_run) black --skip-string-normalization . $(conda_run) isort --profile black . @@ -36,7 +50,4 @@ fmt-py-check: lint: lint-ts @echo "Format check completed" -lint-ts: - $(conda_run) npm run lint - .PHONY: $(MAKECMDGOALS) diff --git a/README.md b/README.md index 035d737..4269877 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,12 @@ A list of community contributed content that enriches PyScript's ecosystem. -Learn [how to contribute](CONTRIBUTING.MD). +Learn [how to contribute](CONTRIBUTING.MD) to this repository. ## Index - Examples - - UI/UX - - 3rd party libraries - - requests - - PyScript tags - Video tutorials - - Beginners -- Text tutorials \ No newline at end of file +- Articles \ No newline at end of file diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..4e4bb33 --- /dev/null +++ b/environment.yml @@ -0,0 +1,14 @@ +channels: +- defaults +- conda-forge +- microsoft +dependencies: +- python=3.9 +- pip=20.2.2 +- pytest=7 +- nodejs=16 +- black +- isort +- codespell +- pre-commit +- playwright diff --git a/examples/hello_world.html b/examples/hello_world.html new file mode 100644 index 0000000..585ba33 --- /dev/null +++ b/examples/hello_world.html @@ -0,0 +1,24 @@ + + + + + + + PyScript Hello World + + + + + + + + + Hello world!
+ This is the current date and time, as computed by Python: + +from datetime import datetime +now = datetime.now().time() +print(now.strftime("%H:%M:%S")) + + + diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index e05b3e9..0000000 --- a/tests/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -tag := latest -git_hash ?= $(shell git log -1 --pretty=format:%h) - -base_dir ?= $(shell git rev-parse --show-toplevel) -src_dir ?= $(base_dir)/src -examples ?= ../$(base_dir)/examples -app_dir ?= $(shell git rev-parse --show-prefix) - -CONDA_EXE := conda -CONDA_ENV ?= ./env -env := $(CONDA_ENV) -conda_run := $(CONDA_EXE) run -p $(env) - -setup: - npm install - $(CONDA_EXE) env $(shell [ -d $(env) ] && echo update || echo create) -p $(env) --file environment.yml - $(conda_run) playwright install - $(CONDA_EXE) install -c anaconda pytest - -clean: - find . -name \*.py[cod] -delete - rm -rf .pytest_cache .coverage coverage.xml - -clean-all: clean - rm -rf $(env) *.egg-info - -shell: - @export CONDA_ENV_PROMPT='<{name}>' - @echo 'conda activate $(env)' - -dev: - npm run dev - -build: - npm run build - -example: - mkdir -p ./examples - cp -r ../examples/* ./examples - chmod -R 755 examples - find ./examples/toga -type f -name '*.html' -exec sed -i '' s+https://pyscript.net/alpha/+../build/+g {} \; - find ./examples/webgl -type f -name '*.html' -exec sed -i '' s+https://pyscript.net/alpha/+../../build/+g {} \; - find ./examples -type f -name '*.html' -exec sed -i '' s+https://pyscript.net/alpha/+../build/+g {} \; - -test: - make example - npm run build - $(conda_run) pytest -vv $(ARGS) tests/ --log-cli-level=warning - -test-py: - @echo "Tests are coming :( this is a placeholder and it's meant to fail!" - $(conda_run) pytest -vv $(ARGS) tests/ --log-cli-level=warning - -test-ts: - @echo "Tests are coming :( this is a placeholder and it's meant to fail!" - npm run tests - -fmt: fmt-py fmt-ts - @echo "Format completed" - -fmt-check: fmt-ts-check fmt-py-check - @echo "Format check completed" - -fmt-ts: - npm run format - -fmt-ts-check: - npm run format:check - -fmt-py: - $(conda_run) black --skip-string-normalization . - $(conda_run) isort --profile black . - -fmt-py-check: - $(conda_run) black -l 88 --check . - -lint: lint-ts - @echo "Format check completed" - -lint-ts: - $(conda_run) npm run lint - -.PHONY: $(MAKECMDGOALS) diff --git a/tests/__pycache__/__init__.cpython-39.pyc b/tests/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..c388072 Binary files /dev/null and b/tests/__pycache__/__init__.cpython-39.pyc differ diff --git a/tests/__pycache__/conftest.cpython-39-pytest-7.1.1.pyc b/tests/__pycache__/conftest.cpython-39-pytest-7.1.1.pyc new file mode 100644 index 0000000..3b17d60 Binary files /dev/null and b/tests/__pycache__/conftest.cpython-39-pytest-7.1.1.pyc differ diff --git a/tests/__pycache__/test_examples.cpython-39-pytest-7.1.1.pyc b/tests/__pycache__/test_examples.cpython-39-pytest-7.1.1.pyc new file mode 100644 index 0000000..c18a73b Binary files /dev/null and b/tests/__pycache__/test_examples.cpython-39-pytest-7.1.1.pyc differ diff --git a/tests/test_examples.py b/tests/test_examples.py index 147c751..df8ba50 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -33,9 +33,15 @@ ] EXAMPLES = [ + "hello_world" ] TEST_PARAMS = { + "hello_world": { + "file": "hello_world.html", + "pattern": "\\d+:\\d+:\\d+", + "title": "PyScript Hello World", + }, }