diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 7b74c8a..a949e8c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -2,56 +2,56 @@ name: Bug Report description: Found something wrong? Report it! title: "[Bug]: " body: - - type: markdown - attributes: - value: Reporting an issue is easy! Please fill out as much of the information below as possible, to make your experience easier. - - type: textarea - attributes: - label: Description of the bug - description: Please provide a brief description of what you think went wrong - placeholder: The plugin is cool, but when I asked it to turn the LEDs red they turned blue! - validations: - required: true - - type: textarea - attributes: - label: Steps to reproduce - placeholder: | - 1. Go to '...' - 2. Scroll down, click on '...' - 3. See the error '...' - validations: - required: false - - type: textarea - id: what-happened - attributes: - label: What happened instead? - placeholder: "A bug happened!" - validations: - required: true - - type: markdown - attributes: - value: | - Make sure you are up-to-date on the latest versions of all software involved. - **What versions are you running?** - - type: input - attributes: - label: Plugin version - validations: - required: true - - type: input - attributes: - label: OctoPrint version - validations: - required: true - - type: input - attributes: - label: (if relevant) OctoPi version - - type: textarea - attributes: - label: Log Files & Screenshots - description: | - Please upload both the `octoprint.log` and the `plugin_ws281x_led_status_debug.log`, preferably with debug logging enabled. - If they are relevant (for example issues with the UI) please upload screenshots of the issue. - - type: textarea - attributes: - label: Anything else? + - type: markdown + attributes: + value: Reporting an issue is easy! Please fill out as much of the information below as possible, to make your experience easier. + - type: textarea + attributes: + label: Description of the bug + description: Please provide a brief description of what you think went wrong + placeholder: The plugin is cool, but when I asked it to turn the LEDs red they turned blue! + validations: + required: true + - type: textarea + attributes: + label: Steps to reproduce + placeholder: | + 1. Go to '...' + 2. Scroll down, click on '...' + 3. See the error '...' + validations: + required: false + - type: textarea + id: what-happened + attributes: + label: What happened instead? + placeholder: "A bug happened!" + validations: + required: true + - type: markdown + attributes: + value: | + Make sure you are up-to-date on the latest versions of all software involved. + **What versions are you running?** + - type: input + attributes: + label: Plugin version + validations: + required: true + - type: input + attributes: + label: OctoPrint version + validations: + required: true + - type: input + attributes: + label: (if relevant) OctoPi version + - type: textarea + attributes: + label: Log Files & Screenshots + description: | + Please upload both the `octoprint.log` and the `plugin_ws281x_led_status_debug.log`, preferably with debug logging enabled. + If they are relevant (for example issues with the UI) please upload screenshots of the issue. + - type: textarea + attributes: + label: Anything else? diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 2ab9be6..c4d92bb 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -2,20 +2,20 @@ name: Feature Request description: Want a new feature implemented? Request improvements here. title: "[Request]: " body: - - type: markdown - attributes: - value: | - Now is your chance to convince me that this feature you want should be implemented! Go ahead, make a good case for it and I will see what can be done. - - type: textarea - attributes: - label: What would you like implemented? - description: Please provide a brief description of what you want implemented. - placeholder: It would be great if... - validations: - required: true - - type: textarea - attributes: - label: Why should this be implemented? - placeholder: This would really benefit everyone who has... - validations: - required: true + - type: markdown + attributes: + value: | + Now is your chance to convince me that this feature you want should be implemented! Go ahead, make a good case for it and I will see what can be done. + - type: textarea + attributes: + label: What would you like implemented? + description: Please provide a brief description of what you want implemented. + placeholder: It would be great if... + validations: + required: true + - type: textarea + attributes: + label: Why should this be implemented? + placeholder: This would really benefit everyone who has... + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/help.yaml b/.github/ISSUE_TEMPLATE/help.yaml index 3781d37..5ba03c3 100644 --- a/.github/ISSUE_TEMPLATE/help.yaml +++ b/.github/ISSUE_TEMPLATE/help.yaml @@ -2,36 +2,36 @@ name: Get Help description: Need help using the plugin? Get help here! labels: [question] body: - - type: markdown - attributes: - value: | - Please ensure that you include **as much detail as possible** when asking for help. + - type: markdown + attributes: + value: | + Please ensure that you include **as much detail as possible** when asking for help. - I respond to a high number of community questions across the forums and discord, you are more - likely to get a quick response if you include all the information available. Thanks! - - type: textarea - attributes: - label: Describe your problem - description: What have you setup, what is not working, what is working, what have you tried to do to solve it? - validations: - required: true - - type: markdown - attributes: - value: | - Before posting this issue, please ensure that you have read the ['Get Help Guide'](https://cp2004.gitbook.io/ws281x-led-status/guides/get-help-guide) - and the ['Troubleshooting Guide'](https://cp2004.gitbook.io/ws281x-led-status/troubleshooting-guide) and tried any solutions that seem relevant. - - type: checkboxes - attributes: - label: Please confirm the following - options: - - label: I have read the Get Help & Troubleshooting guide + I respond to a high number of community questions across the forums and discord, you are more + likely to get a quick response if you include all the information available. Thanks! + - type: textarea + attributes: + label: Describe your problem + description: What have you setup, what is not working, what is working, what have you tried to do to solve it? + validations: required: true - - type: markdown - attributes: - value: | - Log files are **required**. They provide me with important details about your install and what the plugin *thinks* is working. - Need help finding the logs? - - type: textarea - attributes: - label: Log files - placeholder: octoprint.log and plugin_ws281x_led_status_debug.log please! + - type: markdown + attributes: + value: | + Before posting this issue, please ensure that you have read the ['Get Help Guide'](https://cp2004.gitbook.io/ws281x-led-status/guides/get-help-guide) + and the ['Troubleshooting Guide'](https://cp2004.gitbook.io/ws281x-led-status/troubleshooting-guide) and tried any solutions that seem relevant. + - type: checkboxes + attributes: + label: Please confirm the following + options: + - label: I have read the Get Help & Troubleshooting guide + required: true + - type: markdown + attributes: + value: | + Log files are **required**. They provide me with important details about your install and what the plugin *thinks* is working. + Need help finding the logs? + - type: textarea + attributes: + label: Log files + placeholder: octoprint.log and plugin_ws281x_led_status_debug.log please! diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 984b9d5..5009bfd 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,10 +5,10 @@ version: 2 updates: - - package-ecosystem: "pip" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "daily" - target-branch: "maintenance" - labels: - - dependencies + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" + target-branch: "maintenance" + labels: + - dependencies diff --git a/.github/issue-validation.yml b/.github/issue-validation.yml index c309ed6..3fc938c 100644 --- a/.github/issue-validation.yml +++ b/.github/issue-validation.yml @@ -1,47 +1,47 @@ approve_label: approved problem_label: incomplete ignored_labels: - - approved - - confirmed bug - - documentation - - feedback - - grabbed - - improvement - - request - - potential bug - - not plugin - - unreproduced - - solved - - up for grabs - - upstream library + - approved + - confirmed bug + - documentation + - feedback + - grabbed + - improvement + - request + - potential bug + - not plugin + - unreproduced + - solved + - up for grabs + - upstream library ignored_authors: - - cp2004 + - cp2004 validation_comment: > - Hi @@@AUTHOR@@, + Hi @@@AUTHOR@@, - It looks like there is some information missing from this issue that is required to process it: + It looks like there is some information missing from this issue that is required to process it: - * It looks like you haven't read the ['Get Help Guide'](https://cp2004.gitbook.io/ws281x-led-status/guides/get-help-guide) + * It looks like you haven't read the ['Get Help Guide'](https://cp2004.gitbook.io/ws281x-led-status/guides/get-help-guide) - Please read this guide, especially the [troubleshooting](https://cp2004.gitbook.io/ws281x-led-status/troubleshooting-guide) section. + Please read this guide, especially the [troubleshooting](https://cp2004.gitbook.io/ws281x-led-status/troubleshooting-guide) section. - If you have read this guide, please tick the box in your issue next to 'I have read the Get Help Guide' + If you have read this guide, please tick the box in your issue next to 'I have read the Get Help Guide' - ``` - * [x] I have read the Get Help Guide - ``` + ``` + * [x] I have read the Get Help Guide + ``` - If you didn't mean to ask for help, please make sure you used the right template - - bugs and requests should have `[Bug]` and `[Request]` respectively in the title. + If you didn't mean to ask for help, please make sure you used the right template - + bugs and requests should have `[Bug]` and `[Request]` respectively in the title. - *I'm just a bot ๐Ÿค–, not a human being, so don't expect any replies - from me :) Your ticket is read by humans too, I'm just not one of them.* + *I'm just a bot ๐Ÿค–, not a human being, so don't expect any replies + from me :) Your ticket is read by humans too, I'm just not one of them.* keyphrase: "[x] I have read the Get Help Guide" diff --git a/.github/workflows/add_to_project.yml b/.github/workflows/add_to_project.yml index e7573d4..15b2aab 100644 --- a/.github/workflows/add_to_project.yml +++ b/.github/workflows/add_to_project.yml @@ -1,20 +1,20 @@ name: Add issues/PRs to my project automatically on: - issues: - types: - - opened - - transferred - pull_request_target: - types: - - opened + issues: + types: + - opened + - transferred + pull_request_target: + types: + - opened jobs: - add-to-project: - name: Add issue or PR to project - runs-on: ubuntu-latest - steps: - - uses: actions/add-to-project@main - with: - project-url: https://github.com/users/cp2004/projects/3 - github-token: ${{ secrets.PROJECT_ACCESS }} + add-to-project: + name: Add issue or PR to project + runs-on: ubuntu-latest + steps: + - uses: actions/add-to-project@main + with: + project-url: https://github.com/users/cp2004/projects/3 + github-token: ${{ secrets.PROJECT_ACCESS }} diff --git a/.github/workflows/issue-validation.yml b/.github/workflows/issue-validation.yml index e478e6d..cd26435 100644 --- a/.github/workflows/issue-validation.yml +++ b/.github/workflows/issue-validation.yml @@ -1,67 +1,67 @@ name: "Issue Labeler" on: - issues: - types: [opened, edited, closed, reopened] + issues: + types: [opened, edited, closed, reopened] jobs: - label-opened-and-edited: - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@v2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - let labels = []; - let setLabels = false; - context.payload.issue.labels.forEach(label => { labels.push(label.name) }); - switch (context.payload.action) { - case 'opened': - case 'edited': { - if (context.payload.issue.title.match(/\[request\]|feature request/i)) { - labels.push('request'); - if (labels.includes("incomplete")){ - // Remove incomplete label - const index = labels.indexOf("incomplete"); - if (index > -1) { - labels.splice(index, 1); - } - // Remove needs triage - const triageIndex = labels.indexOf("needs triage"); - if (triageIndex > -1) { - labels.splice(triageIndex, 1); - } - } - } - if (context.payload.issue.title.match(/bug/i)) { - if (!labels.includes("confirmed bug")){ - labels.push('potential bug'); - setLabels = true; - } - if (labels.includes("incomplete")){ - // Remove incomplete label - const icIndex = labels.indexOf("incomplete"); - if (icIndex > -1) { - labels.splice(icIndex, 1); - } - } - // Remove needs triage - const triageIndex = labels.indexOf("needs triage"); - if (triageIndex > -1) { - labels.splice(triageIndex, 1); - } - } - if (labels.length === 0) { - labels.push('needs triage'); - setLabels = true; - } - break; - } - } - if (setLabels) { - github.issues.setLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: labels - }) - } + label-opened-and-edited: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + let labels = []; + let setLabels = false; + context.payload.issue.labels.forEach(label => { labels.push(label.name) }); + switch (context.payload.action) { + case 'opened': + case 'edited': { + if (context.payload.issue.title.match(/\[request\]|feature request/i)) { + labels.push('request'); + if (labels.includes("incomplete")){ + // Remove incomplete label + const index = labels.indexOf("incomplete"); + if (index > -1) { + labels.splice(index, 1); + } + // Remove needs triage + const triageIndex = labels.indexOf("needs triage"); + if (triageIndex > -1) { + labels.splice(triageIndex, 1); + } + } + } + if (context.payload.issue.title.match(/bug/i)) { + if (!labels.includes("confirmed bug")){ + labels.push('potential bug'); + setLabels = true; + } + if (labels.includes("incomplete")){ + // Remove incomplete label + const icIndex = labels.indexOf("incomplete"); + if (icIndex > -1) { + labels.splice(icIndex, 1); + } + } + // Remove needs triage + const triageIndex = labels.indexOf("needs triage"); + if (triageIndex > -1) { + labels.splice(triageIndex, 1); + } + } + if (labels.length === 0) { + labels.push('needs triage'); + setLabels = true; + } + break; + } + } + if (setLabels) { + github.issues.setLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: labels + }) + } diff --git a/.github/workflows/projects.yml b/.github/workflows/projects.yml index acec299..24520de 100644 --- a/.github/workflows/projects.yml +++ b/.github/workflows/projects.yml @@ -1,33 +1,33 @@ name: Assign Issues to Projects on: - issues: - types: [opened, labeled] + issues: + types: [opened, labeled] env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - assign_one_project: - runs-on: ubuntu-latest - name: Assign to project - steps: - - name: potential bug assignment - uses: srggrs/assign-one-project-github-action@1.2.0 - if: contains(github.event.issue.labels.*.name, 'potential bug') - with: - project: "https://github.com/cp2004/OctoPrint-WS281x_LED_Status/projects/1" - column_name: "To analyse" + assign_one_project: + runs-on: ubuntu-latest + name: Assign to project + steps: + - name: potential bug assignment + uses: srggrs/assign-one-project-github-action@1.2.0 + if: contains(github.event.issue.labels.*.name, 'potential bug') + with: + project: "https://github.com/cp2004/OctoPrint-WS281x_LED_Status/projects/1" + column_name: "To analyse" - - name: confirmed bug assignment - uses: srggrs/assign-one-project-github-action@1.2.0 - if: contains(github.event.issue.labels.*.name, 'confirmed bug') - with: - project: "https://github.com/cp2004/OctoPrint-WS281x_LED_Status/projects/1" - column_name: "To fix" + - name: confirmed bug assignment + uses: srggrs/assign-one-project-github-action@1.2.0 + if: contains(github.event.issue.labels.*.name, 'confirmed bug') + with: + project: "https://github.com/cp2004/OctoPrint-WS281x_LED_Status/projects/1" + column_name: "To fix" - - name: request assignment - uses: srggrs/assign-one-project-github-action@1.2.0 - if: contains(github.event.issue.labels.*.name, 'request') - with: - project: "https://github.com/cp2004/OctoPrint-WS281x_LED_Status/projects/2" - column_name: "Needs triage" + - name: request assignment + uses: srggrs/assign-one-project-github-action@1.2.0 + if: contains(github.event.issue.labels.*.name, 'request') + with: + project: "https://github.com/cp2004/OctoPrint-WS281x_LED_Status/projects/2" + column_name: "Needs triage" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a7c6ea..48b2902 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,85 +1,85 @@ name: Release on: - release: - types: [published, prereleased] + release: + types: [published, prereleased] jobs: - build: - name: ๐Ÿ”จ Build distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: ๐Ÿ— Set up Python 3.8 - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: ๐Ÿ— Install build dependencies - run: | - python -m pip install wheel octoprint --user - - name: ๐Ÿ”จ Build a source zip - run: | - python setup.py sdist --formats=zip - - name: ๐Ÿšš rename to sdist.zip - run: | - mv dist/OctoPrint-WS281x\ LED\ Status-*.zip dist/sdist.zip - - name: โฌ† Upload build result - uses: actions/upload-artifact@v1 - with: - name: dist - path: dist + build: + name: ๐Ÿ”จ Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: ๐Ÿ— Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: ๐Ÿ— Install build dependencies + run: | + python -m pip install wheel octoprint --user + - name: ๐Ÿ”จ Build a source zip + run: | + python setup.py sdist --formats=zip + - name: ๐Ÿšš rename to sdist.zip + run: | + mv dist/OctoPrint-WS281x\ LED\ Status-*.zip dist/sdist.zip + - name: โฌ† Upload build result + uses: actions/upload-artifact@v1 + with: + name: dist + path: dist - test-install: - name: ๐Ÿงช Installation tests - needs: build - strategy: - matrix: - python: ["2.7", "3.7", "3.8"] - runs-on: ubuntu-latest - steps: - - name: ๐Ÿ— Set up Python ${{ matrix.python }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python }} - - name: โฌ‡ Download build result - uses: actions/download-artifact@v1 - with: - name: dist - path: dist - - name: ๐Ÿ— Install dependencies - run: | - python -m pip install --upgrade wheel setuptools pip - python -m pip install octoprint - - name: ๐Ÿงช Test install of package - run: | - python -m pip install dist/sdist.zip - upload-asset: - name: ๐Ÿ“ฆ Upload asset to release - runs-on: ubuntu-latest - needs: - - build - - test-install - steps: - - name: โฌ‡ Download build result - uses: actions/download-artifact@v1 - with: - name: dist - path: dist - - name: ๐Ÿšš Rename to release.zip - run: | - cp dist/sdist.zip release.zip - - name: ๐Ÿฅ… Catch release ID - id: get_release - uses: bruceadams/get-release@v1.2.2 - env: - GITHUB_TOKEN: ${{ github.token }} - - name: ๐Ÿ“ฆ Attach release artifact - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.get_release.outputs.upload_url }} - asset_path: release.zip - asset_name: release.zip - asset_content_type: application/zip + test-install: + name: ๐Ÿงช Installation tests + needs: build + strategy: + matrix: + python: ["2.7", "3.7", "3.8"] + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ— Set up Python ${{ matrix.python }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + - name: โฌ‡ Download build result + uses: actions/download-artifact@v1 + with: + name: dist + path: dist + - name: ๐Ÿ— Install dependencies + run: | + python -m pip install --upgrade wheel setuptools pip + python -m pip install octoprint + - name: ๐Ÿงช Test install of package + run: | + python -m pip install dist/sdist.zip + upload-asset: + name: ๐Ÿ“ฆ Upload asset to release + runs-on: ubuntu-latest + needs: + - build + - test-install + steps: + - name: โฌ‡ Download build result + uses: actions/download-artifact@v1 + with: + name: dist + path: dist + - name: ๐Ÿšš Rename to release.zip + run: | + cp dist/sdist.zip release.zip + - name: ๐Ÿฅ… Catch release ID + id: get_release + uses: bruceadams/get-release@v1.2.2 + env: + GITHUB_TOKEN: ${{ github.token }} + - name: ๐Ÿ“ฆ Attach release artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release.outputs.upload_url }} + asset_path: release.zip + asset_name: release.zip + asset_content_type: application/zip diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index b25f5ce..c494d52 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,18 +1,18 @@ name: "Close stale issues" on: - schedule: - - cron: "30 1 * * *" - repository_dispatch: + schedule: + - cron: "30 1 * * *" + repository_dispatch: jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v4 - with: - stale-issue-message: "This issue has been marked a stale because it has been open for 14 days with no activity. If there is no further activity in the next 7 days this issue will be closed." - close-issue-message: "This issue has been closed as there was no activity for 21 days. If this issue is still relevant, please request a reopen or create a new issue." - days-before-stale: 14 - days-before-close: 7 - any-of-labels: "question,needs information,duplicate,incomplete,awaiting information" - exempt-issue-labels: "bug" + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v4 + with: + stale-issue-message: "This issue has been marked a stale because it has been open for 14 days with no activity. If there is no further activity in the next 7 days this issue will be closed." + close-issue-message: "This issue has been closed as there was no activity for 21 days. If this issue is still relevant, please request a reopen or create a new issue." + days-before-stale: 14 + days-before-close: 7 + any-of-labels: "question,needs information,duplicate,incomplete,awaiting information" + exempt-issue-labels: "bug" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b55d7fa..ac886c3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,90 +3,90 @@ name: Test on: - push: - pull_request: - types: [opened, synchronize, reopened] - release: - types: [published, prereleased] + push: + pull_request: + types: [opened, synchronize, reopened] + release: + types: [published, prereleased] jobs: - build: - name: ๐Ÿ”จ Build distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: ๐Ÿ— Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: ๐Ÿ— Install build dependencies - run: | - python -m pip install wheel --user - python -m pip install octoprint[develop] - - name: ๐Ÿ”จ Build a binary wheel and a source tarball - run: | - python setup.py sdist bdist_wheel - - name: โฌ† Upload build result - uses: actions/upload-artifact@v1 - with: - name: dist - path: dist + build: + name: ๐Ÿ”จ Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: ๐Ÿ— Install build dependencies + run: | + python -m pip install wheel --user + python -m pip install octoprint[develop] + - name: ๐Ÿ”จ Build a binary wheel and a source tarball + run: | + python setup.py sdist bdist_wheel + - name: โฌ† Upload build result + uses: actions/upload-artifact@v1 + with: + name: dist + path: dist - test-unit: - name: ๐Ÿงช Unit tests - strategy: - matrix: - python: ["2.7", "3.7", "3.8", "3.9"] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: ๐Ÿ— Set up Python ${{ matrix.python }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python }} - - name: ๐Ÿ— Set up test dependencies - run: | - pip install octoprint[develop] pytest - pip install -e . - - name: ๐Ÿš€ Run test suite - run: | - pytest + test-unit: + name: ๐Ÿงช Unit tests + strategy: + matrix: + python: ["2.7", "3.7", "3.8", "3.9"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: ๐Ÿ— Set up Python ${{ matrix.python }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + - name: ๐Ÿ— Set up test dependencies + run: | + pip install octoprint[develop] pytest + pip install -e . + - name: ๐Ÿš€ Run test suite + run: | + pytest - test-flake8: - name: ๐Ÿงช Flake8 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: ๐Ÿ— Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: ๐Ÿ— Set up test dependencies - run: | - pip install octoprint[develop] flake8 - pip install -e . - - name: ๐Ÿš€ Run test suite - run: | - flake8 octoprint_ws281x_led_status tests setup.py + test-flake8: + name: ๐Ÿงช Flake8 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: ๐Ÿ— Set up test dependencies + run: | + pip install octoprint[develop] flake8 + pip install -e . + - name: ๐Ÿš€ Run test suite + run: | + flake8 octoprint_ws281x_led_status tests setup.py - test-install: - name: ๐Ÿงช Installation tests - needs: build - strategy: - matrix: - python: ["2.7", "3.7", "3.8", "3.9"] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: ๐Ÿ— Set up Python ${{ matrix.python }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python }} - - name: ๐Ÿš€ Install OctoPrint - run: | - pip install octoprint - - name: ๐Ÿš€ Test install of plugin - run: | - pip install . + test-install: + name: ๐Ÿงช Installation tests + needs: build + strategy: + matrix: + python: ["2.7", "3.7", "3.8", "3.9"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: ๐Ÿ— Set up Python ${{ matrix.python }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + - name: ๐Ÿš€ Install OctoPrint + run: | + pip install octoprint + - name: ๐Ÿš€ Test install of plugin + run: | + pip install . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b45eb57..10d4af3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,55 +1,44 @@ exclude: ^(docs/|translations/|.*\.css|.*\.svg|octoprint_ws281x_led_status/static/webfonts) repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 - hooks: - - id: end-of-file-fixer - - id: trailing-whitespace - - id: check-case-conflict - - id: check-json - - id: check-yaml - - id: check-toml - - id: check-merge-conflict - - repo: https://github.com/asottile/pyupgrade - rev: v2.31.0 - hooks: - - id: pyupgrade - args: ["--py37-plus"] - exclude: "setup.py|versioneer.py|_version.py" - - repo: https://github.com/OctoPrint/codemods - rev: "0.6.3" - hooks: - - id: codemod_batch - args: - [ - "--check", - "not_in", - "--check", - "detect_past_builtins_imports", - "--ignore", - "src/octoprint/vendor", - "--ignore", - "setup.py", - "--ignore", - "versioneer.py", - "--ignore", - "src/octoprint_setuptools/__init__.py", - ] - - repo: https://github.com/pre-commit/mirrors-isort - rev: v5.10.1 - hooks: - - id: isort - - repo: https://github.com/psf/black - rev: 22.1.0 - hooks: - - id: black - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.1 - hooks: - - id: flake8 - additional_dependencies: - - flake8-bugbear - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.5.1 - hooks: - - id: prettier + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-case-conflict + - id: check-json + - id: check-yaml + - id: check-toml + - id: check-merge-conflict + - repo: https://github.com/asottile/pyupgrade + rev: v3.3.1 + hooks: + - id: pyupgrade + args: ["--py37-plus"] + exclude: "setup.py|versioneer.py|_version.py" + - repo: https://github.com/OctoPrint/codemods + rev: "0.6.3" + hooks: + - id: codemod_batch + args: + ["--check", "not_in", "--check", "detect_past_builtins_imports"] + - repo: https://github.com/PyCQA/isort + rev: "5.12.0" + hooks: + - id: isort + args: ["--profile", "black", "--filter-files"] + - repo: https://github.com/psf/black + rev: 22.12.0 + hooks: + - id: black + - repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + additional_dependencies: + - flake8-bugbear + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.0-alpha.4 + hooks: + - id: prettier + args: ["--tab-width", "4"] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 101436b..3e29753 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,13 +7,13 @@ and how the plugin works. There's a couple of things to consider before making your contribution: -- Please create pull requests against the `devel` branch unless indicated otherwise. - There is an exception to this rule: documentation. See more below. +- Please create pull requests against the `devel` branch unless indicated otherwise. + There is an exception to this rule: documentation. See more below. -- If your changes are large or disruptive, please open an issue first so that we can discuss. I don't want you to put in a lot - of work only for it to end up going to waste as there were already different plans. +- If your changes are large or disruptive, please open an issue first so that we can discuss. I don't want you to put in a lot + of work only for it to end up going to waste as there were already different plans. -- Read the additional points below for details on code style, testing and how everything fits together. +- Read the additional points below for details on code style, testing and how everything fits together. ### Documentation diff --git a/README.md b/README.md index 7f2c567..2869a47 100644 --- a/README.md +++ b/README.md @@ -17,15 +17,15 @@ With lots of options effects and integrations to choose from, you can customise Most prominent features include: -- Printer status effects -- Tracking heating, printing and cooling progress -- Intercepting M150 commands & controlling with @ commands -- Easy controls for turning lights on and off from the navbar -- Theme-friendly torch button to temporarily light up your printer -- Timers to turn the LEDs off at certain times of day or after a print is done. -- Custom Triggers - add your own events, @ commands or gcode matching to trigger effects -- Powerful integration with OctoApp for Android -- ...and more! +- Printer status effects +- Tracking heating, printing and cooling progress +- Intercepting M150 commands & controlling with @ commands +- Easy controls for turning lights on and off from the navbar +- Theme-friendly torch button to temporarily light up your printer +- Timers to turn the LEDs off at certain times of day or after a print is done. +- Custom Triggers - add your own events, @ commands or gcode matching to trigger effects +- Powerful integration with OctoApp for Android +- ...and more! You can take a look at the [documentation](https://cp2004.gitbook.io/ws281x-led-status/) for more information about all that the plugin has to offer. @@ -35,9 +35,9 @@ You can take a look at the [documentation](https://cp2004.gitbook.io/ws281x-led- Setting up the plugin couldn't be easier! There are 3 main steps, with configuration made easy with the setup wizard. -- Wiring your LEDs -- Configuring SPI -- Configuring plugin settings +- Wiring your LEDs +- Configuring SPI +- Configuring plugin settings Follow the detailed [setup guide](https://cp2004.gitbook.io/ws281x-led-status/guides/setup-guide-1) in the documentation to get up and running. @@ -45,9 +45,9 @@ Follow the detailed [setup guide](https://cp2004.gitbook.io/ws281x-led-status/gu Please read the [Get Help Guide](https://cp2004.gitbook.io/ws281x-led-status/guides/get-help-guide) as well as the [rest of the documentation](https://cp2004.gitbook.io/ws281x-led-status/), to see if your question has been answered there. Still got questions? Get in touch: -- On the [OctoPrint Discord](https://discord.octoprint.org) -- On the [Community Forums](https://community.octoprint.org) -- Open an issue with the [question template](https://github.com/cp2004/OctoPrint-WS281x_LED_Status/issues/new?assignees=&labels=type%3A+question&template=question.md&title=) +- On the [OctoPrint Discord](https://discord.octoprint.org) +- On the [Community Forums](https://community.octoprint.org) +- Open an issue with the [question template](https://github.com/cp2004/OctoPrint-WS281x_LED_Status/issues/new?assignees=&labels=type%3A+question&template=question.md&title=) ## Reporting problems @@ -61,9 +61,9 @@ in touch if you don't know where to start. ## Sponsors -- [@KenLucke](https://github.com/KenLucke) -- [@iFrostizz](https://github.com/iFrostizz) -- [@CmdrCody51](https://github.com/CmdrCody51) +- [@KenLucke](https://github.com/KenLucke) +- [@iFrostizz](https://github.com/iFrostizz) +- [@CmdrCody51](https://github.com/CmdrCody51) As well as 5 others supporting me regularly through [GitHub Sponsors](https://github.com/sponsors/cp2004)! diff --git a/octoprint_ws281x_led_status/__init__.py b/octoprint_ws281x_led_status/__init__.py index 7a2a479..b60f493 100644 --- a/octoprint_ws281x_led_status/__init__.py +++ b/octoprint_ws281x_led_status/__init__.py @@ -11,23 +11,10 @@ # noinspection PyPackageRequirements import octoprint.plugin from octoprint.events import Events, all_events -from octoprint.util.version import ( - is_octoprint_compatible, - is_python_compatible, -) - -from octoprint_ws281x_led_status import ( - api, - constants, - settings, - triggers, - util, - wizard, -) -from octoprint_ws281x_led_status.constants import ( - AtCommands, - DeprecatedAtCommands, -) +from octoprint.util.version import is_octoprint_compatible, is_python_compatible + +from octoprint_ws281x_led_status import api, constants, settings, triggers, util, wizard +from octoprint_ws281x_led_status.constants import AtCommands, DeprecatedAtCommands from octoprint_ws281x_led_status.runner import EffectRunner from octoprint_ws281x_led_status.util import RestartableTimer diff --git a/octoprint_ws281x_led_status/_version.py b/octoprint_ws281x_led_status/_version.py index 92d6299..90b8b7c 100644 --- a/octoprint_ws281x_led_status/_version.py +++ b/octoprint_ws281x_led_status/_version.py @@ -1,10 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import ( - absolute_import, - division, - print_function, - unicode_literals, -) +from __future__ import absolute_import, division, print_function, unicode_literals # This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag diff --git a/octoprint_ws281x_led_status/runner/__init__.py b/octoprint_ws281x_led_status/runner/__init__.py index 489783f..b6cc5f2 100644 --- a/octoprint_ws281x_led_status/runner/__init__.py +++ b/octoprint_ws281x_led_status/runner/__init__.py @@ -4,17 +4,8 @@ import logging import math -import multiprocessing -import threading import time - -try: - # Py3 - from queue import Queue - from typing import Optional -except ImportError: - # Py2 - from Queue import Queue +from queue import Queue # noinspection PyPackageRequirements from octoprint.logging.handlers import CleaningTimedRotatingFileHandler @@ -148,7 +139,7 @@ def main_loop(self): and self.previous_state["effect"] == "blank" ): self._logger.debug( - "Returning to previous state: {}".format(self.previous_state) + f"Returning to previous state: {self.previous_state}" ) self.parse_q_msg(self.previous_state) @@ -450,7 +441,7 @@ def start_strip(self): except Exception as e: # Probably wrong settings... self._logger.error(repr(e)) self._logger.error("Strip failed to startup") - raise StripFailedError("Error initializing strip") + raise StripFailedError("Error initializing strip") from e # Create segments & segment manager try: diff --git a/octoprint_ws281x_led_status/static/js/ws281x_led_status.js b/octoprint_ws281x_led_status/static/js/ws281x_led_status.js index eccf373..3ba5178 100644 --- a/octoprint_ws281x_led_status/static/js/ws281x_led_status.js +++ b/octoprint_ws281x_led_status/static/js/ws281x_led_status.js @@ -33,7 +33,7 @@ $(function () { self.toggle_lights = function () { OctoPrint.simpleApiCommand( "ws281x_led_status", - self.lights_on() ? "lights_off" : "lights_on" + self.lights_on() ? "lights_off" : "lights_on", ).done(update_light_status); }; @@ -41,34 +41,34 @@ $(function () { if (self.torch_toggle()) { OctoPrint.simpleApiCommand( "ws281x_led_status", - self.torch_on() ? "torch_off" : "torch_on" + self.torch_on() ? "torch_off" : "torch_on", ); } else { OctoPrint.simpleApiCommand( "ws281x_led_status", - "torch_on" + "torch_on", ).done(update_light_status); } }; self.onBeforeBinding = function () { OctoPrint.simpleApiGet("ws281x_led_status").done( - update_light_status + update_light_status, ); self.torch_enabled( - self.settingsViewModel.settings.plugins.ws281x_led_status.effects.torch.enabled() + self.settingsViewModel.settings.plugins.ws281x_led_status.effects.torch.enabled(), ); self.torch_toggle( - self.settingsViewModel.settings.plugins.ws281x_led_status.effects.torch.toggle() + self.settingsViewModel.settings.plugins.ws281x_led_status.effects.torch.toggle(), ); }; self.onSettingsBeforeSave = function () { self.torch_enabled( - self.settingsViewModel.settings.plugins.ws281x_led_status.effects.torch.enabled() + self.settingsViewModel.settings.plugins.ws281x_led_status.effects.torch.enabled(), ); self.torch_toggle( - self.settingsViewModel.settings.plugins.ws281x_led_status.effects.torch.toggle() + self.settingsViewModel.settings.plugins.ws281x_led_status.effects.torch.toggle(), ); }; @@ -149,7 +149,7 @@ $(function () { var current_ma = parseInt(self.current_input(), 10); var num_pixels = parseInt( self.settingsViewModel.settings.plugins.ws281x_led_status.strip.count(), - 10 + 10, ); var current = (num_pixels * current_ma) / 1000; @@ -212,25 +212,25 @@ $(function () { self.onAfterBinding = function () { self.custom_atcommand( - self.settingsViewModel.settings.plugins.ws281x_led_status.custom.atcommand() + self.settingsViewModel.settings.plugins.ws281x_led_status.custom.atcommand(), ); self.custom_gcode( - self.settingsViewModel.settings.plugins.ws281x_led_status.custom.gcode() + self.settingsViewModel.settings.plugins.ws281x_led_status.custom.gcode(), ); self.custom_event( - self.settingsViewModel.settings.plugins.ws281x_led_status.custom.event() + self.settingsViewModel.settings.plugins.ws281x_led_status.custom.event(), ); }; self.onSettingsBeforeSave = function () { self.settingsViewModel.settings.plugins.ws281x_led_status.custom.atcommand( - self.custom_atcommand() + self.custom_atcommand(), ); self.settingsViewModel.settings.plugins.ws281x_led_status.custom.gcode( - self.custom_gcode() + self.custom_gcode(), ); self.settingsViewModel.settings.plugins.ws281x_led_status.custom.event( - self.custom_event() + self.custom_event(), ); }; diff --git a/setup.cfg b/setup.cfg index 13fc368..f1c435d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ universal = 1 [flake8] max-line-length = 90 -extend-ignore = E203, E231, E265, E266, E402, E501, E731 +extend-ignore = E203, E231, E265, E266, E402, E501, E731, B950, W503 select = B,C,E,F,W,T4,B9 exclude = setup.py diff --git a/versioneer.py b/versioneer.py index 771e405..b6693f8 100644 --- a/versioneer.py +++ b/versioneer.py @@ -1,10 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import ( - absolute_import, - division, - print_function, - unicode_literals, -) +from __future__ import absolute_import, division, print_function, unicode_literals # Version: 0.15+dev