From 6214b7f02790f06d6a4ea7d31732e831ca5a306e Mon Sep 17 00:00:00 2001 From: Ajimaru Date: Tue, 1 Dec 2026 04:42:18 +0100 Subject: [PATCH 1/5] chore: restructure repository by removing unused files and updating issue templates --- .gitattributes | 34 +++++++ .github/CODEOWNERS | 35 ------- .github/ISSUE_TEMPLATE/bug_report.yml | 108 +++++++-------------- .github/ISSUE_TEMPLATE/config.yml | 1 + .github/ISSUE_TEMPLATE/feature_request.yml | 35 ++++--- .github/pull_request_template.md | 29 +++--- .gitignore | 2 - AUTHORS.md | 12 --- CONTRIBUTING.md | 17 +--- README.md | 2 +- Taskfile.yml | 79 --------------- extras/README.txt | 16 --- extras/github/bug_report.yml | 96 ------------------ extras/github/feature_request.yml | 26 ----- octoprint_logmonitor/__init__.py | 9 +- octoprint_logmonitor/_version.py | 3 - pyproject.toml | 8 +- pytest.ini | 5 - translations/README.txt | 38 ++++---- 19 files changed, 144 insertions(+), 411 deletions(-) create mode 100644 .gitattributes delete mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 AUTHORS.md delete mode 100644 Taskfile.yml delete mode 100644 extras/README.txt delete mode 100644 extras/github/bug_report.yml delete mode 100644 extras/github/feature_request.yml delete mode 100644 octoprint_logmonitor/_version.py delete mode 100644 pytest.ini diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b90a385 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,34 @@ +# Store text files with LF in the repository and check them out with LF on all +# platforms, matching .editorconfig (end_of_line = lf). +* text=auto eol=lf + +# Windows-only scripts keep CRLF to stay runnable on Windows. +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +# Binary files: never normalise, never diff as text. +*.mo binary +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary +*.webp binary +*.zip binary +*.gz binary +*.db binary +*.woff binary +*.woff2 binary +*.ttf binary +*.otf binary +*.eot binary +*.pdf binary +*.xlsx binary + +# Minified third-party bundles stay byte-identical and out of language stats. +*.min.js -text linguist-vendored +*.min.css -text linguist-vendored + +# Jinja2 templates count as HTML in GitHub's language statistics. +*.jinja2 linguist-language=HTML diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index ed0af7e..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,35 +0,0 @@ -# This file defines default code owners and reviewers for the OctoPrint Log Monitor plugin -# GitHub will automatically request reviews from these owners when pull requests are opened -# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners - -# Default reviewers for the entire repository -* @OctoPrint-LogMonitor/core-team - -# Core plugin logic -octoprint_logmonitor/__init__.py @OctoPrint-LogMonitor/core-team -octoprint_logmonitor/log_tailer.py @OctoPrint-LogMonitor/core-team -octoprint_logmonitor/log_searcher.py @OctoPrint-LogMonitor/core-team -octoprint_logmonitor/security.py @OctoPrint-LogMonitor/core-team @OctoPrint-LogMonitor/security-team - -# Frontend code -octoprint_logmonitor/static/ @OctoPrint-LogMonitor/frontend-team -octoprint_logmonitor/templates/ @OctoPrint-LogMonitor/frontend-team - -# Tests - require code owner + test specialist approval -tests/ @OctoPrint-LogMonitor/core-team @OctoPrint-LogMonitor/test-team - -# Documentation -README.md @OctoPrint-LogMonitor/core-team @OctoPrint-LogMonitor/docs-team -CHANGELOG.md @OctoPrint-LogMonitor/core-team -CONTRIBUTING.md @OctoPrint-LogMonitor/core-team @OctoPrint-LogMonitor/docs-team -SECURITY.md @OctoPrint-LogMonitor/core-team @OctoPrint-LogMonitor/security-team -CODE_OF_CONDUCT.md @OctoPrint-LogMonitor/core-team -AUTHORS.md @OctoPrint-LogMonitor/core-team - -# Configuration and metadata -setup.py @OctoPrint-LogMonitor/core-team -pyproject.toml @OctoPrint-LogMonitor/core-team -.github/ @OctoPrint-LogMonitor/core-team - -# CI/CD workflows -.github/workflows/ @OctoPrint-LogMonitor/core-team @OctoPrint-LogMonitor/devops-team diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 1b0fce5..49de745 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,96 +1,58 @@ -name: "🐛 Report a bug" -description: "Create a bug report to help improve OctoPrint-LogMonitor" +name: Bug report +description: Something is not working as expected +labels: ["bug"] body: - type: markdown attributes: - value: >- - **Thank you for wanting to report a bug in OctoPrint-LogMonitor!** - - * First, be sure you are running the [latest version of the OctoPrint-LogMonitor plugin](https://github.com/Ajimaru/OctoPrint-LogMonitor/releases). - * You will also need to [enable debugging on the plugin](https://docs.octoprint.org/en/main/configuration/logging_yaml.html). - * This may be done through the *Settings* > *OctoPrint* > *Logging* > *Logging Levels* section. - * Select the "octoprint.plugins.logmonitor" name, and make sure Level is "DEBUG". - * Save, then restart OctoPrint, which allows the developers to see debug information from the moment the plugin is loaded. - * Finally, when submitting a bug report, you **must** [include a Systeminfo Bundle](https://community.octoprint.org/t/what-is-a-systeminfo-bundle-and-how-can-i-obtain-one/29887), generated after the point the bug occurs. This allows the developers to examine the debug logs produced from your plugin installation. + value: | + Thanks for taking the time to report a bug. Please fill in the fields below — + version numbers and logs are what make a bug reproducible. - Thank you for your help! - type: textarea + id: what-happened attributes: - label: "The problem" - description: >- - Describe the issue you are experiencing here. Tell us what you were trying to do - step by step, and what happened that you did not expect. - - Provide a clear and concise description of what the problem is and include as many - details as possible. - placeholder: | - 1. ... - 2. ... - 3. ... + label: What happened? + description: What went wrong, and what did you expect instead? validations: required: true - - type: markdown - attributes: - value: | - ## Environment - - type: input + + - type: textarea + id: steps attributes: - label: "Version of OctoPrint-LogMonitor" - description: 'Can be found in *Settings* > *Plugin Manager*, next to "OctoPrint-LogMonitor".' + label: Steps to reproduce + placeholder: | + 1. Open the Log Monitor tab … + 2. … + 3. See error validations: required: true + - type: input + id: plugin-version attributes: - label: "Version of OctoPrint" - description: "Can be found in the lower left corner of the web interface." + label: Plugin version + description: See *Settings* → *Plugin Manager*. validations: required: true + - type: input + id: octoprint-version attributes: - label: "Operating system running OctoPrint" - description: >- - OctoPi, Linux, Windows, MacOS, something else? With version please? OctoPi's - version can be found in `/etc/octopi_version` or in the lower left corner of the - web interface. + label: OctoPrint version validations: required: true - - type: input - attributes: - label: "Printer model & used firmware incl. version" - description: "If applicable, always include if unsure" - - type: input - attributes: - label: "Browser and version of browser, operating system running browser" - description: "If applicable, always include if unsure" - - type: markdown - attributes: - value: | - ## Logs and other files needed for analysis - - type: markdown - attributes: - value: >- - Please also be sure to upload the following files below: - * Systeminfo Bundle: See [here](https://community.octoprint.org/t/what-is-a-systeminfo-bundle-and-how-can-i-obtain-one/29887) if you don't know where to find that. Just attach down below as-is. Note that you'll need at least OctoPrint 1.6.0 for this to be available - we no longer accept bug reports created for older versions than this. - * If you are reporting an issue that involves communicating with you printer, **be sure to enable `serial.log` before reproducing and creating the Systeminfo Bundle**! - * Your browser's JavaScript console, if you are reporting a problem with the - user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that. - * If possible, screenshots or videos showing the problem, especially if you - are reporting a problem with the user interface! - * GCODE files with which to reproduce, if you are reporting an issue with - GCODE file analysis or printing behaviour. - - Please be aware that unless at least Systeminfo Bundle is included, your bug report - will not be processed and closed after a while. - - type: checkboxes + - type: textarea + id: logs attributes: - label: "Checklist of files to include below" - options: - - label: "Systeminfo Bundle (always include!)" - required: true - - label: "Contents of the JavaScript browser console (always include in cases of issues with the user interface)" - - label: "Screenshots and/or videos showing the problem (always include in case of issues with the user interface)" - - label: "GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour)" + label: Log output + description: | + Relevant part of `octoprint.log` (logger `octoprint.plugins.logmonitor`), and the + browser console for UI problems. This is inserted as code, so no backticks needed. + render: shell + - type: textarea + id: context attributes: - label: "Additional information & file uploads" + label: Anything else? + description: Operating system, browser, the log file involved, screenshots, … diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index b284836..309400c 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,26 +1,31 @@ -name: "✨ Request a feature" -description: "Request a new feature to implement in OctoPrint-LogMonitor" -title: "[Request]" +name: Feature request +description: Suggest a new feature or an improvement +labels: ["enhancement"] body: - - type: markdown - attributes: - value: > - **Thank you for wanting to request a feature in OctoPrint-LogMonitor!** - type: textarea + id: problem attributes: - label: "Is your feature request related to a problem? Please describe." - description: 'A clear and concise description of what the problem is. Eg, "I''m always frustrated when [...]".' + label: What problem would this solve? + description: What are you trying to do that is hard or impossible today? + validations: + required: true + - type: textarea + id: solution attributes: - label: "Describe the solution you'd like" - description: "A clear and concise description of what you want to happen." + label: How should it work? + description: Your idea of the feature, from a user's point of view. validations: required: true + - type: textarea + id: alternatives attributes: - label: "Describe alternatives you've considered" - description: "A clear and concise description of any alternative solutions or features you've considered." + label: Alternatives you considered + description: Workarounds you already tried, or other ways this could be solved. + - type: textarea + id: context attributes: - label: "Additional context" - description: "Add any other context or screenshots about the feature request here." + label: Anything else? + description: Mockups, links to other plugins or hardware, related issues, … diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 21b03f8..9bf7fc1 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,18 +1,23 @@ -# Description +## What does this change? -## Related Issues + -## Type of Change +Closes # -- [ ] Bugfix -- [ ] Feature -- [ ] Docs -- [ ] Refactor -- [ ] Security +## Type of change + +- [ ] Bug fix +- [ ] New feature +- [ ] Documentation +- [ ] Refactoring / maintenance +- [ ] CI + +## How was it tested? + + ## Checklist -- [ ] Description of change -- [ ] Related issue(s) -- [ ] Tests added / updated -- [ ] Documentation updated +- [ ] Existing settings keep working, or the change explains what users need to do +- [ ] README and docs updated, if the change affects them +- [ ] Translations updated with `pybabel` (extract, update, compile), if UI strings changed diff --git a/.gitignore b/.gitignore index 111cc2f..36acab1 100644 --- a/.gitignore +++ b/.gitignore @@ -43,8 +43,6 @@ venv/ env/ .logs/ .coverage -.venv-octoprint-*/ -.development/ .cache/ .githooks/ .pre-commit-config.yaml diff --git a/AUTHORS.md b/AUTHORS.md deleted file mode 100644 index 7c9487a..0000000 --- a/AUTHORS.md +++ /dev/null @@ -1,12 +0,0 @@ -# Authors and Contributors - -## Original Author - -- Ajimaru (@Ajimaru) - -## Contributors - -Add yourself below using one of the following formats: - -- Name \ -- Name (@github-handle) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e1d8a4..7d8a20d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,12 +65,12 @@ Build distributions: python -m build --sdist --wheel ``` -Translation workflow with Task: +Translation workflow (Babel): ```bash -task babel-extract -task babel-update -task babel-compile +pybabel extract --sort-output -F babel.cfg -o translations/messages.pot . +pybabel update -i translations/messages.pot -d translations -l de +pybabel compile -d translations ``` Run OctoPrint in safe mode when manually testing plugin behavior: @@ -98,15 +98,6 @@ Before opening a PR, check that: If possible, keep each PR to one concern. -## Authors - -Contributors are listed in [AUTHORS.md](AUTHORS.md). To add yourself, append a new line in one of these formats: - -```text -- Name -- Name (@github-handle) -``` - ## License By contributing, you agree that your work is licensed under [AGPL-3.0-or-later](LICENSE). diff --git a/README.md b/README.md index bdbcbc3..fe3de84 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ Note: For logs and troubleshooting, enable "debug logging" in the plugin setting ## Credits - **Development**: Built following [OctoPrint Plugin Guidelines](https://docs.octoprint.org/en/main/plugins/index.html) -- **Contributors**: See [AUTHORS.md](AUTHORS.md) +- **Author and maintainer**: [Ajimaru](https://github.com/Ajimaru) ## 100% Badge Coverage diff --git a/Taskfile.yml b/Taskfile.yml deleted file mode 100644 index 93aa6de..0000000 --- a/Taskfile.yml +++ /dev/null @@ -1,79 +0,0 @@ -# https://taskfile.dev - -version: "3" - -env: - LOCALES: [] # list your included locales here, e.g. ["de", "fr"] - TRANSLATIONS: octoprint_logmonitor/translations # translations folder, do not touch - -tasks: - install: - desc: Installs the plugin into the current venv - cmds: - - "python -m pip install -e .[develop]" - - ### Build related - - build: - desc: Builds sdist & wheel - cmds: - - python -m build --sdist --wheel - - build-sdist: - desc: Builds sdist - cmds: - - python -m build --sdist - - build-wheel: - desc: Builds wheel - cmds: - - python -m build --wheel - - ### Translation related - - babel-new: - desc: Create a new translation for a locale - cmds: - - task: babel-extract - - | - pybabel init --input-file=translations/messages.pot --output-dir=translations --locale="{{ .CLI_ARGS }}" - - babel-extract: - desc: Update pot file from source - cmds: - - pybabel extract --mapping-file=babel.cfg --output-file=translations/messages.pot --msgid-bugs-address=i18n@octoprint.org --copyright-holder="The OctoPrint Project" . - - babel-update: - desc: Update translation files from pot file - cmds: - - for: - var: LOCALES - cmd: pybabel update --input-file=translations/messages.pot --output-dir=translations --locale={{ .ITEM }} - - babel-refresh: - desc: Update translation files from source - cmds: - - task: babel-extract - - task: babel-update - - babel-compile: - desc: Compile translation files - cmds: - - pybabel compile --directory=translations - - babel-bundle: - desc: Bundle translations - preconditions: - - test -d {{ .TRANSLATIONS }} - cmds: - - for: - var: LOCALES - cmd: | - locale="{{ .ITEM }}" - source="translations/${locale}" - target="{{ .TRANSLATIONS }}/${locale}" - - [ ! -d "${target}" ] || rm -r "${target}" - - echo "Copying translations for locale ${locale} from ${source} to ${target}..." - cp -r "${source}" "${target}" diff --git a/extras/README.txt b/extras/README.txt deleted file mode 100644 index 0ba32cf..0000000 --- a/extras/README.txt +++ /dev/null @@ -1,16 +0,0 @@ -Currently Cookiecutter generates the following helpful extras to this folder: - -logmonitor.md - Data file for plugins.octoprint.org. Fill in the missing TODOs once your - plugin is ready for release and file a PR as described at - https://plugins.octoprint.org/help/registering/ to get it published. - -github/bug_report.yml - A GitHub issue form for bug reports. Adjust as desired & place in your - repository as `.github/bug_report.yml` to activate. - -github/feature_request.yml - A GitHub issue form for feature requests. Adjust as desired and place in - your repository as `.github/feature_request.yml` to activate. - -This folder may be safely removed if you don't need it. diff --git a/extras/github/bug_report.yml b/extras/github/bug_report.yml deleted file mode 100644 index 062575b..0000000 --- a/extras/github/bug_report.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: 🐛 Report a bug -description: Create a bug report to help improve OctoPrint-LogMonitor -body: - - type: markdown - attributes: - value: >- - **Thank you for wanting to report a bug in OctoPrint-LogMonitor!** - - * First, be sure you are running the [latest version of the OctoPrint-LogMonitor plugin](https://github.com/Ajimaru/OctoPrint-LogMonitor/releases). - * You will also need to [enable debugging on the plugin](https://docs.octoprint.org/en/main/configuration/logging_yaml.html). - * This may be done through the *Settings* > *OctoPrint* > *Logging* > *Logging Levels* section. - * Select the "octoprint.plugins.logmonitor" name, and make sure Level is "DEBUG". - * Save, then restart OctoPrint, which allows the developers to see debug information from the moment the plugin is loaded. - * Finally, when submitting a bug report, you **must** [include a Systeminfo Bundle](https://community.octoprint.org/t/what-is-a-systeminfo-bundle-and-how-can-i-obtain-one/29887), generated after the point the bug occurs. This allows the developers to examine the debug logs produced from your plugin installation. - - Thank you for your help! - - type: textarea - attributes: - label: The problem - description: >- - Describe the issue you are experiencing here. Tell us what you were trying to do - step by step, and what happened that you did not expect. - - Provide a clear and concise description of what the problem is and include as many - details as possible. - placeholder: | - 1. ... - 2. ... - 3. ... - validations: - required: true - - type: markdown - attributes: - value: | - ## Environment - - type: input - attributes: - label: Version of OctoPrint-LogMonitor - description: Can be found in *Settings* > *Plugin Manager*, next to "OctoPrint-LogMonitor". - validations: - required: true - - type: input - attributes: - label: Version of OctoPrint - description: Can be found in the lower left corner of the web interface. - validations: - required: true - - type: input - attributes: - label: Operating system running OctoPrint - description: >- - OctoPi, Linux, Windows, MacOS, something else? With version please? OctoPi's - version can be found in `/etc/octopi_version` or in the lower left corner of the - web interface. - validations: - required: true - - type: input - attributes: - label: Printer model & used firmware incl. version - description: If applicable, always include if unsure - - type: input - attributes: - label: Browser and version of browser, operating system running browser - description: If applicable, always include if unsure - - type: markdown - attributes: - value: | - ## Logs and other files needed for analysis - - type: markdown - attributes: - value: >- - Please also be sure to upload the following files below: - - * Systeminfo Bundle: See [here](https://community.octoprint.org/t/what-is-a-systeminfo-bundle-and-how-can-i-obtain-one/29887) if you don't know where to find that. Just attach down below as-is. Note that you'll need at least OctoPrint 1.6.0 for this to be available - we no longer accept bug reports created for older versions than this. - * If you are reporting an issue that involves communicating with you printer, **be sure to enable `serial.log` before reproducing and creating the Systeminfo Bundle**! - * Your browser's JavaScript console, if you are reporting a problem with the - user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that. - * If possible, screenshots or videos showing the problem, especially if you - are reporting a problem with the user interface! - * GCODE files with which to reproduce, if you are reporting an issue with - GCODE file analysis or printing behaviour. - - Please be aware that unless at least Systeminfo Bundle is included, your bug report - will not be processed and closed after a while. - - type: checkboxes - attributes: - label: Checklist of files to include below - options: - - label: Systeminfo Bundle (always include!) - required: true - - label: Contents of the JavaScript browser console (always include in cases of issues with the user interface) - - label: Screenshots and/or videos showing the problem (always include in case of issues with the user interface) - - label: GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour) - - type: textarea - attributes: - label: Additional information & file uploads diff --git a/extras/github/feature_request.yml b/extras/github/feature_request.yml deleted file mode 100644 index e5b9b04..0000000 --- a/extras/github/feature_request.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: ✨ Request a feature -description: Request a new feature to implement in OctoPrint-LogMonitor -title: "[Request]" -body: - - type: markdown - attributes: - value: > - **Thank you for wanting to request a feature in OctoPrint-LogMonitor!** - - type: textarea - attributes: - label: Is your feature request related to a problem? Please describe. - description: A clear and concise description of what the problem is. Eg, "I'm always frustrated when [...]". - - type: textarea - attributes: - label: Describe the solution you'd like - description: A clear and concise description of what you want to happen. - validations: - required: true - - type: textarea - attributes: - label: Describe alternatives you've considered - description: A clear and concise description of any alternative solutions or features you've considered. - - type: textarea - attributes: - label: Additional context - description: Add any other context or screenshots about the feature request here. diff --git a/octoprint_logmonitor/__init__.py b/octoprint_logmonitor/__init__.py index 9e1190e..34576c9 100644 --- a/octoprint_logmonitor/__init__.py +++ b/octoprint_logmonitor/__init__.py @@ -12,13 +12,14 @@ import os import threading from datetime import datetime +from importlib.metadata import PackageNotFoundError +from importlib.metadata import version as _pkg_version from typing import Any, Literal import flask import octoprint.plugin from octoprint.server.util.flask import no_firstrun_access -from ._version import VERSION as PLUGIN_VERSION from .log_searcher import LogSearcher from .log_tailer import LogTailer from .security import ( @@ -37,6 +38,12 @@ # pylint: disable=broad-except,global-statement,too-many-lines # intentional: plugin handlers must not crash OctoPrint +# Version lives in pyproject.toml; read it back from the package metadata. +try: + PLUGIN_VERSION = _pkg_version("OctoPrint-LogMonitor") +except PackageNotFoundError: + PLUGIN_VERSION = "0.0.0+unknown" + # Error codes returned by ``_resolve_log_path``. _LogPathErrorCode = Literal["invalid", "denied", "not_found"] diff --git a/octoprint_logmonitor/_version.py b/octoprint_logmonitor/_version.py deleted file mode 100644 index 57a3810..0000000 --- a/octoprint_logmonitor/_version.py +++ /dev/null @@ -1,3 +0,0 @@ -"""Single source of truth for the plugin version used by dev tooling.""" - -VERSION = "0.2.5" diff --git a/pyproject.toml b/pyproject.toml index e2300e2..9156239 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,10 +46,16 @@ develop = [ "build", "pytest", "pytest-cov", - "go-task-bin", "flask" ] +[tool.pytest.ini_options] +testpaths = ["tests"] +markers = [ + "smoke: mark test as smoke test", + "regression: mark test as regression test", +] + [tool.black] line-length = 79 diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 82c6975..0000000 --- a/pytest.ini +++ /dev/null @@ -1,5 +0,0 @@ -[pytest] -testpaths = tests -markers = - smoke: mark test as smoke test - regression: mark test as regression test diff --git a/translations/README.txt b/translations/README.txt index d0f58ec..083c00b 100644 --- a/translations/README.txt +++ b/translations/README.txt @@ -1,24 +1,20 @@ -Your plugin's translations will reside here. The provided Taskfile supports a -couple of additional commands to make managing your translations easier: +Your plugin's translations reside here. They are managed with pybabel (Babel) +directly; run the commands from the repository root. -go-task babel-extract - Extracts any translateable messages (marked with Jinja's `_("...")` or - JavaScript's `gettext("...")`) and creates the initial `messages.pot` file. -go-task babel-refresh - Reruns extraction and updates the `messages.pot` file. -go-task babel-new -- - Creates a new translation folder for locale ``. -go-task babel-compile - Compiles the translations into `mo` files, ready to be used within - OctoPrint. +Extract translatable strings into the template (messages.pot): + pybabel extract --sort-output -F babel.cfg -o translations/messages.pot . -If you want to bundle translations with your plugin, create a new folder -`octoprint_logmonitor/translations`. When that folder exists, -an additional command becomes available: +Create a new locale catalog (e.g. de): + pybabel init -i translations/messages.pot -d translations -l de -go-task babel-bundle - Moves the translations for the locales defined in Taskfile.yml to - octoprint_logmonitor/translations, - effectively bundling them with your plugin. This is interesting for languages - you can guarantee to keep up to date yourself with each new release of your - plugin. +Update an existing catalog after the template changed: + pybabel update -i translations/messages.pot -d translations -l de + +Compile catalogs into the .mo files OctoPrint loads at runtime: + pybabel compile -d translations -l de + +To bundle a translation with the plugin, the compiled catalog must also live +under octoprint_logmonitor/translations//LC_MESSAGES/: + mkdir -p octoprint_logmonitor/translations/de/LC_MESSAGES + cp translations/de/LC_MESSAGES/messages.mo \ + octoprint_logmonitor/translations/de/LC_MESSAGES/ From 69b0057505f2116892c27c82ca97b6bbc356fb85 Mon Sep 17 00:00:00 2001 From: Ajimaru Date: Tue, 1 Dec 2026 18:49:34 +0100 Subject: [PATCH 2/5] chore: format code and improve consistency across various files --- .editorconfig | 25 +- .github/workflows/codeql.yml | 94 ++--- docs/rest-api.md | 8 +- eslint.config.mjs | 72 ++-- .../static/css/logmonitor.css | 390 +++++++++--------- octoprint_logmonitor/static/js/logmonitor.js | 158 +++---- 6 files changed, 342 insertions(+), 405 deletions(-) diff --git a/.editorconfig b/.editorconfig index df59181..ad4ec7d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,18 +1,23 @@ -# This file is for unifying the coding style for different editors and IDEs -# editorconfig.org - +# Coding style shared by all plugins, matching OctoPrint itself (its +# .editorconfig and .prettierrc.yaml). See https://editorconfig.org root = true [*] -end_of_line = lf charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true +max_line_length = 90 -[**.py] -indent_style = space -indent_size = 4 +# Python stays at 88 (black/isort default) until the linters move to 90 too; +# isort reads this value. +[*.py] +max_line_length = 88 -[**.js] -indent_style = space -indent_size = 4 +[*.{yml,yaml,json,less,md}] +indent_size = 2 + +[*.{bat,cmd,ps1}] +end_of_line = crlf diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 9e46925..5a4c6dc 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,11 +13,11 @@ name: "CodeQL Advanced" on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] schedule: - - cron: '19 4 * * 1' + - cron: "19 4 * * 1" jobs: analyze: @@ -43,12 +43,12 @@ jobs: fail-fast: false matrix: include: - - language: actions - build-mode: none - - language: javascript-typescript - build-mode: none - - language: python - build-mode: none + - language: actions + build-mode: none + - language: javascript-typescript + build-mode: none + - language: python + build-mode: none # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' # Use `c-cpp` to analyze code written in C, C++ or both # Use 'java-kotlin' to analyze code written in Java, Kotlin or both @@ -58,46 +58,46 @@ jobs: # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages steps: - - name: Checkout repository - uses: actions/checkout@v7 + - name: Checkout repository + uses: actions/checkout@v7 - # Add any setup steps before running the `github/codeql-action/init` action. - # This includes steps like installing compilers or runtimes (`actions/setup-node` - # or others). This is typically only required for manual builds. - # - name: Setup runtime (example) - # uses: actions/setup-example@v1 + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v4 - with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - name: Run manual build steps - if: matrix.build-mode == 'manual' - shell: bash - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - name: Run manual build steps + if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{matrix.language}}" diff --git a/docs/rest-api.md b/docs/rest-api.md index 1a39ffe..9b3dc64 100644 --- a/docs/rest-api.md +++ b/docs/rest-api.md @@ -20,9 +20,7 @@ List available log files. ```json { - "files": [ - { "name": "octoprint.log", "size": 123456, "modified": 1719999999.0 } - ] + "files": [{ "name": "octoprint.log", "size": 123456, "modified": 1719999999.0 }] } ``` @@ -64,9 +62,7 @@ Export search results (the client sends the results back). ```json { - "results": [ - { "timestamp": "…", "logger": "…", "level": "…", "message": "…" } - ], + "results": [{ "timestamp": "…", "logger": "…", "level": "…", "message": "…" }], "format": "csv" } ``` diff --git a/eslint.config.mjs b/eslint.config.mjs index 87e18cd..4f0d281 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,39 +1,39 @@ export default [ - { - files: ["**/*.js"], - languageOptions: { - ecmaVersion: 2022, - sourceType: "script", - globals: { - API_BASEURL: "readonly", - BASEURL: "readonly", - OCTOPRINT_VIEWMODELS: "readonly", - PNotify: "readonly", - $: "readonly", - Audio: "readonly", - Blob: "readonly", - Date: "readonly", - Math: "readonly", - Object: "readonly", - RegExp: "readonly", - alert: "readonly", - confirm: "readonly", - console: "readonly", - document: "readonly", - encodeURIComponent: "readonly", - gettext: "readonly", - isNaN: "readonly", - parseInt: "readonly", - ko: "readonly", - ngettext: "readonly", - setTimeout: "readonly", - clearInterval: "readonly", - setInterval: "readonly", - window: "readonly", - }, + { + files: ["**/*.js"], + languageOptions: { + ecmaVersion: 2022, + sourceType: "script", + globals: { + API_BASEURL: "readonly", + BASEURL: "readonly", + OCTOPRINT_VIEWMODELS: "readonly", + PNotify: "readonly", + $: "readonly", + Audio: "readonly", + Blob: "readonly", + Date: "readonly", + Math: "readonly", + Object: "readonly", + RegExp: "readonly", + alert: "readonly", + confirm: "readonly", + console: "readonly", + document: "readonly", + encodeURIComponent: "readonly", + gettext: "readonly", + isNaN: "readonly", + parseInt: "readonly", + ko: "readonly", + ngettext: "readonly", + setTimeout: "readonly", + clearInterval: "readonly", + setInterval: "readonly", + window: "readonly", + }, + }, + rules: { + "no-unused-vars": "off", + }, }, - rules: { - "no-unused-vars": "off", - }, - }, ]; diff --git a/octoprint_logmonitor/static/css/logmonitor.css b/octoprint_logmonitor/static/css/logmonitor.css index 6b386f9..d5d9b1e 100644 --- a/octoprint_logmonitor/static/css/logmonitor.css +++ b/octoprint_logmonitor/static/css/logmonitor.css @@ -5,469 +5,469 @@ /* Container */ .logmonitor-container { - padding: 10px; + padding: 10px; } .logmonitor-container h3 { - margin-top: 0; + margin-top: 0; } .logmonitor-container h4 { - margin-top: 20px; - margin-bottom: 10px; - border-bottom: 1px solid rgba(127, 127, 127, 0.35); - padding-bottom: 5px; + margin-top: 20px; + margin-bottom: 10px; + border-bottom: 1px solid rgba(127, 127, 127, 0.35); + padding-bottom: 5px; } .logmonitor-subtabs { - margin-top: 10px; - margin-bottom: 15px; + margin-top: 10px; + margin-bottom: 15px; } .logmonitor-subtab-panel { - margin-top: 10px; + margin-top: 10px; } /* Stream Panel */ .logmonitor-stream-panel { - margin-bottom: 30px; + margin-bottom: 30px; } .logmonitor-controls, .logmonitor-search-controls, .logmonitor-history-controls { - margin-bottom: 15px; - background: rgba(127, 127, 127, 0.08); - padding: 10px; - border-radius: 4px; + margin-bottom: 15px; + background: rgba(127, 127, 127, 0.08); + padding: 10px; + border-radius: 4px; } .logmonitor-controls-row { - margin-bottom: 10px; + margin-bottom: 10px; } .logmonitor-controls-row:last-child { - margin-bottom: 0; + margin-bottom: 0; } .logmonitor-file-select { - margin-right: 10px; - max-width: 250px; + margin-right: 10px; + max-width: 250px; } .logmonitor-controls .btn, .logmonitor-search-controls .btn, .logmonitor-history-controls .btn, .logmonitor-pagination .btn { - min-height: 34px; - padding: 6px 12px; - font-family: inherit; - font-size: 13px; - line-height: 20px; + min-height: 34px; + padding: 6px 12px; + font-family: inherit; + font-size: 13px; + line-height: 20px; } /* Log Output */ .logmonitor-output { - font-family: - "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; - font-size: 12px; - background: #1e1e1e; - color: #d4d4d4; - padding: 10px; - border-radius: 4px; - height: 500px; - overflow-y: scroll; - overflow-x: auto; - white-space: normal; + font-family: + "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; + font-size: 12px; + background: #1e1e1e; + color: #d4d4d4; + padding: 10px; + border-radius: 4px; + height: 500px; + overflow-y: scroll; + overflow-x: auto; + white-space: normal; } .logmonitor-line { - padding: 2px 0; - line-height: 1.4; - white-space: normal; + padding: 2px 0; + line-height: 1.4; + white-space: normal; } .logmonitor-timestamp { - color: #808080; - margin-right: 8px; + color: #808080; + margin-right: 8px; } .logmonitor-level { - font-weight: bold; - margin-right: 8px; - min-width: 65px; - display: inline-block; + font-weight: bold; + margin-right: 8px; + min-width: 65px; + display: inline-block; } .logmonitor-logger { - color: #9cdcfe; - margin-right: 8px; + color: #9cdcfe; + margin-right: 8px; } .logmonitor-message { - color: #d4d4d4; - white-space: pre-wrap; - word-break: break-word; + color: #d4d4d4; + white-space: pre-wrap; + word-break: break-word; } /* Severity Colors */ .logmonitor-level-debug .logmonitor-level { - color: #c586c0; + color: #c586c0; } .logmonitor-level-unknown .logmonitor-level { - color: #b0b0b0; + color: #b0b0b0; } .logmonitor-level-info .logmonitor-level { - color: #4ec9b0; + color: #4ec9b0; } .logmonitor-level-warning .logmonitor-level { - color: #dcdcaa; + color: #dcdcaa; } .logmonitor-level-error .logmonitor-level { - color: #f48771; + color: #f48771; } .logmonitor-level-critical .logmonitor-level { - color: #ff0000; - font-weight: bold; - text-shadow: 0 0 5px rgba(255, 0, 0, 0.5); + color: #ff0000; + font-weight: bold; + text-shadow: 0 0 5px rgba(255, 0, 0, 0.5); } .logmonitor-level-critical { - background: rgba(255, 0, 0, 0.1); + background: rgba(255, 0, 0, 0.1); } /* Status Bar */ .logmonitor-status { - margin-top: 10px; - padding: 8px; - background: rgba(127, 127, 127, 0.08); - border-radius: 4px; - font-size: 12px; - color: inherit; - opacity: 0.8; + margin-top: 10px; + padding: 8px; + background: rgba(127, 127, 127, 0.08); + border-radius: 4px; + font-size: 12px; + color: inherit; + opacity: 0.8; } /* Search Panel */ .logmonitor-search-panel { - margin-top: 10px; + margin-top: 10px; } .logmonitor-search-controls { - display: flex; - flex-direction: column; - gap: 10px; + display: flex; + flex-direction: column; + gap: 10px; } .logmonitor-search-filters { - margin: 0; + margin: 0; } .logmonitor-search-results { - margin-top: 15px; + margin-top: 15px; } .logmonitor-search-status { - display: flex; - align-items: center; - gap: 8px; - margin-top: 10px; - color: inherit; - opacity: 0.8; + display: flex; + align-items: center; + gap: 8px; + margin-top: 10px; + color: inherit; + opacity: 0.8; } .logmonitor-search-spinner { - width: 12px; - height: 12px; - border: 2px solid rgba(127, 127, 127, 0.4); - border-top-color: currentColor; - border-radius: 50%; - animation: logmonitor-spin 0.8s linear infinite; + width: 12px; + height: 12px; + border: 2px solid rgba(127, 127, 127, 0.4); + border-top-color: currentColor; + border-radius: 50%; + animation: logmonitor-spin 0.8s linear infinite; } .logmonitor-search-summary { - margin-bottom: 8px; - color: inherit; - opacity: 0.8; + margin-bottom: 8px; + color: inherit; + opacity: 0.8; } .logmonitor-search-table { - width: 100%; - table-layout: fixed; - font-family: - "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; - font-size: 12px; + width: 100%; + table-layout: fixed; + font-family: + "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; + font-size: 12px; } .logmonitor-search-table .logmonitor-search-width-timestamp { - width: 112px; + width: 112px; } .logmonitor-search-table .logmonitor-search-width-logger { - width: 150px; + width: 150px; } .logmonitor-search-table .logmonitor-search-width-level { - width: 64px; + width: 64px; } .logmonitor-search-table .logmonitor-search-width-message { - width: auto; + width: auto; } .logmonitor-search-table th, .logmonitor-search-table td { - vertical-align: top; - word-break: break-word; + vertical-align: top; + word-break: break-word; } .logmonitor-search-col-timestamp { - color: inherit; - opacity: 0.7; + color: inherit; + opacity: 0.7; } .logmonitor-search-col-logger { - color: #3a9bd4; + color: #3a9bd4; } .logmonitor-search-col-level { - white-space: nowrap; - word-break: normal; + white-space: nowrap; + word-break: normal; } .logmonitor-search-table th:nth-child(3), .logmonitor-search-table td:nth-child(3) { - white-space: nowrap; - word-break: normal; + white-space: nowrap; + word-break: normal; } .logmonitor-search-col-level .logmonitor-level { - white-space: nowrap; + white-space: nowrap; } .logmonitor-search-highlight { - background: #fff2a8; - color: #111; - padding: 0 1px; + background: #fff2a8; + color: #111; + padding: 0 1px; } .logmonitor-search-table tr.logmonitor-level-debug { - border-left: 3px solid #c586c0; + border-left: 3px solid #c586c0; } .logmonitor-search-table tr.logmonitor-level-unknown { - border-left: 3px solid #9e9e9e; - background: rgba(158, 158, 158, 0.08); + border-left: 3px solid #9e9e9e; + background: rgba(158, 158, 158, 0.08); } .logmonitor-search-table tr.logmonitor-level-info { - border-left: 3px solid #4ec9b0; + border-left: 3px solid #4ec9b0; } .logmonitor-search-table tr.logmonitor-level-warning { - border-left: 3px solid #dcdcaa; - background: rgba(220, 220, 170, 0.1); + border-left: 3px solid #dcdcaa; + background: rgba(220, 220, 170, 0.1); } .logmonitor-search-table tr.logmonitor-level-error { - border-left: 3px solid #f48771; - background: rgba(244, 135, 113, 0.1); + border-left: 3px solid #f48771; + background: rgba(244, 135, 113, 0.1); } .logmonitor-search-table tr.logmonitor-level-critical { - border-left: 3px solid #ff0000; - background: rgba(255, 0, 0, 0.1); + border-left: 3px solid #ff0000; + background: rgba(255, 0, 0, 0.1); } .logmonitor-search-col-message .logmonitor-message { - white-space: pre-wrap; + white-space: pre-wrap; } @keyframes logmonitor-spin { - to { - transform: rotate(360deg); - } + to { + transform: rotate(360deg); + } } .logmonitor-pagination { - margin-top: 15px; - text-align: center; + margin-top: 15px; + text-align: center; } .logmonitor-pagination button { - margin: 0 5px; + margin: 0 5px; } .logmonitor-pagination span { - margin: 0 10px; - color: inherit; - opacity: 0.8; + margin: 0 10px; + color: inherit; + opacity: 0.8; } .logmonitor-history-controls { - display: flex; - align-items: center; - flex-wrap: wrap; - gap: 8px; + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 8px; } .logmonitor-history-controls .btn { - margin-right: 0; + margin-right: 0; } .logmonitor-history-controls .text-muted { - margin-left: 0; + margin-left: 0; } .logmonitor-history-list { - max-height: 520px; - overflow-y: auto; - border: 1px solid rgba(127, 127, 127, 0.35); - border-radius: 4px; - background: rgba(127, 127, 127, 0.06); + max-height: 520px; + overflow-y: auto; + border: 1px solid rgba(127, 127, 127, 0.35); + border-radius: 4px; + background: rgba(127, 127, 127, 0.06); } .logmonitor-history-entry { - padding: 8px 10px; - border-bottom: 1px solid rgba(127, 127, 127, 0.2); + padding: 8px 10px; + border-bottom: 1px solid rgba(127, 127, 127, 0.2); } .logmonitor-history-entry:last-child { - border-bottom: 0; + border-bottom: 0; } .logmonitor-history-source { - margin-left: 6px; + margin-left: 6px; } /* Settings */ .logmonitor-alert-settings-group { - border: 0; - margin: 0; - padding: 0; + border: 0; + margin: 0; + padding: 0; } .logmonitor-settings-disabled { - opacity: 0.5; + opacity: 0.5; } .logmonitor-monitor-status { - display: flex; - align-items: flex-start; - gap: 8px; - margin-bottom: 8px; + display: flex; + align-items: flex-start; + gap: 8px; + margin-bottom: 8px; } .logmonitor-monitor-status-grid > div { - margin-bottom: 6px; + margin-bottom: 6px; } .logmonitor-monitor-status-list { - margin: 4px 0 0 16px; + margin: 4px 0 0 16px; } /* Navbar */ .logmonitor-navbar-link { - position: relative; - display: inline-block; + position: relative; + display: inline-block; } .logmonitor-badge { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - padding: 2px 5px; - font-size: 10px; - font-weight: bold; - border-radius: 3px; - background: #d9534f; - color: white; - z-index: 2; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + padding: 2px 5px; + font-size: 10px; + font-weight: bold; + border-radius: 3px; + background: #d9534f; + color: white; + z-index: 2; } .logmonitor-badge.badge-warning { - background: #f0ad4e; + background: #f0ad4e; } .logmonitor-badge.badge-info { - background: #5bc0de; + background: #5bc0de; } /* Sidebar */ .logmonitor-sidebar { - margin-bottom: 15px; + margin-bottom: 15px; } .logmonitor-sidebar h4 { - margin-top: 0; - font-size: 14px; - border-bottom: 1px solid rgba(127, 127, 127, 0.35); - padding-bottom: 5px; + margin-top: 0; + font-size: 14px; + border-bottom: 1px solid rgba(127, 127, 127, 0.35); + padding-bottom: 5px; } .logmonitor-sidebar-content { - padding: 5px 0; + padding: 5px 0; } .logmonitor-sidebar-status { - margin-bottom: 10px; - padding: 8px; - background: rgba(127, 127, 127, 0.08); - border-radius: 3px; + margin-bottom: 10px; + padding: 8px; + background: rgba(127, 127, 127, 0.08); + border-radius: 3px; } .logmonitor-sidebar-status i { - margin-right: 5px; + margin-right: 5px; } .logmonitor-sidebar-alerts { - margin-bottom: 10px; + margin-bottom: 10px; } .logmonitor-sidebar-alerts .alert { - margin-bottom: 5px; - padding: 8px; + margin-bottom: 5px; + padding: 8px; } .logmonitor-sidebar-alerts .alert.badge-warning, .logmonitor-sidebar-alerts .alert.alert-warning, .logmonitor-sidebar-alerts .alert.badge-info, .logmonitor-sidebar-alerts .alert.alert-info { - color: #111; + color: #111; } .logmonitor-sidebar-alerts .alert.badge-important, .logmonitor-sidebar-alerts .alert.alert-important, .logmonitor-sidebar-alerts .alert.alert-error, .logmonitor-sidebar-alerts .alert.alert-danger { - color: #fff; + color: #fff; } .logmonitor-sidebar-alerts .alert .muted { - color: inherit !important; - opacity: 1; + color: inherit !important; + opacity: 1; } .logmonitor-sidebar-actions button { - margin-bottom: 5px; + margin-bottom: 5px; } /* Responsive adjustments */ @media (max-width: 768px) { - .logmonitor-output { - height: 300px; - } - - .logmonitor-file-select { - max-width: 100%; - display: block; - margin-bottom: 5px; - } + .logmonitor-output { + height: 300px; + } + + .logmonitor-file-select { + max-width: 100%; + display: block; + margin-bottom: 5px; + } } /* diff --git a/octoprint_logmonitor/static/js/logmonitor.js b/octoprint_logmonitor/static/js/logmonitor.js index 496abec..4a9fbd6 100644 --- a/octoprint_logmonitor/static/js/logmonitor.js +++ b/octoprint_logmonitor/static/js/logmonitor.js @@ -24,11 +24,7 @@ $(() => { self.activeSubtab = ko.observable("live"); self.switchSubtab = (tabName) => { - if ( - tabName !== "live" && - tabName !== "search" && - tabName !== "history" - ) { + if (tabName !== "live" && tabName !== "search" && tabName !== "history") { return false; } @@ -49,9 +45,7 @@ $(() => { var ps = getPluginSettings(); var setting = ps && ps[settingName]; if (typeof setting === "function") return setting(); - return setting === undefined || setting === null - ? fallbackValue - : setting; + return setting === undefined || setting === null ? fallbackValue : setting; } self.isDebugMode = ko.pureComputed(() => { @@ -100,10 +94,7 @@ $(() => { : 0; new PNotify({ title: "Log Monitor", - text: - "Wrote " + - count + - " debug test entries to OctoPrint log.", + text: "Wrote " + count + " debug test entries to OctoPrint log.", type: "success", }); }) @@ -214,19 +205,14 @@ $(() => { self.alertDetails = ko.pureComputed(() => { var counts = self.alertCounts(); var parts = []; - [ - "CRITICAL", - "ERROR", - "WARNING", - "UNKNOWN", - "INFO", - "DEBUG", - ].forEach((level) => { - var count = counts[level] || 0; - if (count > 0) { - parts.push(level + ": " + count); - } - }); + ["CRITICAL", "ERROR", "WARNING", "UNKNOWN", "INFO", "DEBUG"].forEach( + (level) => { + var count = counts[level] || 0; + if (count > 0) { + parts.push(level + ": " + count); + } + }, + ); return parts.join(" | "); }); @@ -237,19 +223,14 @@ $(() => { var counts = self.alertCounts(); var lines = []; - [ - "CRITICAL", - "ERROR", - "WARNING", - "UNKNOWN", - "INFO", - "DEBUG", - ].forEach((level) => { - var count = counts[level] || 0; - if (count > 0) { - lines.push(level + ": " + count); - } - }); + ["CRITICAL", "ERROR", "WARNING", "UNKNOWN", "INFO", "DEBUG"].forEach( + (level) => { + var count = counts[level] || 0; + if (count > 0) { + lines.push(level + ": " + count); + } + }, + ); return "Alerts\n" + lines.join("\n"); }); @@ -305,19 +286,13 @@ $(() => { // Apply severity filter if (line.level === "DEBUG" && !self.showDebug()) return false; if (line.level === "INFO" && !self.showInfo()) return false; - if (line.level === "WARNING" && !self.showWarning()) - return false; + if (line.level === "WARNING" && !self.showWarning()) return false; if (line.level === "ERROR" && !self.showError()) return false; - if (line.level === "CRITICAL" && !self.showCritical()) - return false; - if (line.level === "UNKNOWN" && !self.showUnknown()) - return false; + if (line.level === "CRITICAL" && !self.showCritical()) return false; + if (line.level === "UNKNOWN" && !self.showUnknown()) return false; // Apply text filter - if ( - filter && - line.message.toLowerCase().indexOf(filter) === -1 - ) { + if (filter && line.message.toLowerCase().indexOf(filter) === -1) { return false; } @@ -328,8 +303,7 @@ $(() => { // Computed: Status text self.statusText = ko.computed(() => { if (self.isStreaming()) { - var activeFile = - self.activeStreamFile() || self.selectedLogFile(); + var activeFile = self.activeStreamFile() || self.selectedLogFile(); var text = gettext("Streaming: ") + activeFile; if (self.isSwitchingStream()) { text += gettext(" (switching...)"); @@ -359,21 +333,16 @@ $(() => { self.statusSummary = ko.computed(() => { if (self.hasAlerts()) { var count = self.alertCount(); - return ngettext( - "%(count)s alert", - "%(count)s alerts", + return ngettext("%(count)s alert", "%(count)s alerts", count).replace( + "%(count)s", count, - ).replace("%(count)s", count); + ); } return gettext("No alerts"); }); - self.showNavbar = ko.observable( - !!getPluginSetting("show_navbar", true), - ); - self.showSidebar = ko.observable( - !!getPluginSetting("show_sidebar", true), - ); + self.showNavbar = ko.observable(!!getPluginSetting("show_navbar", true)); + self.showSidebar = ko.observable(!!getPluginSetting("show_sidebar", true)); function bindVisibilityToSetting(settingKey, target) { var ps = getPluginSettings(); @@ -398,13 +367,8 @@ $(() => { self.paginationInfo = ko.pureComputed(() => { var pageSize = getPluginSetting("search_page_size", 50); var start = self.currentPage() * pageSize + 1; - var end = Math.min( - (self.currentPage() + 1) * pageSize, - self.totalResults(), - ); - return ( - "Showing " + start + "-" + end + " of " + self.totalResults() - ); + var end = Math.min((self.currentPage() + 1) * pageSize, self.totalResults()); + return "Showing " + start + "-" + end + " of " + self.totalResults(); }); self.updateSettingsDefaultLogFileDropdown = (fileNames) => { @@ -415,11 +379,7 @@ $(() => { select.empty(); select.append( - $( - '", - ), + $('"), ); fileNames.forEach((name) => { @@ -455,9 +415,7 @@ $(() => { self.renderAlertMonitorStatus = (data, errorText) => { var target = $("#settings_plugin_logmonitor_alert_monitor_status"); - var badge = $( - "#settings_plugin_logmonitor_alert_monitor_status_badge", - ); + var badge = $("#settings_plugin_logmonitor_alert_monitor_status_badge"); if (!target.length) return; function renderLogList(logs) { @@ -522,9 +480,7 @@ $(() => { self.loadAlertMonitorStatus = function () { var target = $("#settings_plugin_logmonitor_alert_monitor_status"); - var badge = $( - "#settings_plugin_logmonitor_alert_monitor_status_badge", - ); + var badge = $("#settings_plugin_logmonitor_alert_monitor_status_badge"); if (target.length) { target.text("Loading alert monitor status..."); } @@ -562,10 +518,7 @@ $(() => { return; } - if ( - currentSelection && - fileNames.indexOf(currentSelection) !== -1 - ) { + if (currentSelection && fileNames.indexOf(currentSelection) !== -1) { return; } @@ -596,9 +549,7 @@ $(() => { var fileNames = rawFiles .map((file) => { - return typeof file === "string" - ? file - : file && file.name; + return typeof file === "string" ? file : file && file.name; }) .filter((name) => { return typeof name === "string" && name.length > 0; @@ -692,9 +643,7 @@ $(() => { } self.isStreaming(true); - self.activeStreamFile( - (response && response.file) || streamFile, - ); + self.activeStreamFile((response && response.file) || streamFile); if (!flushIntervalId) { flushIntervalId = setInterval(flushLineBuffer, 1000); @@ -755,9 +704,7 @@ $(() => { // Search functions self.searchButtonText = ko.pureComputed(() => { - return self.isSearching() - ? gettext("Searching...") - : gettext("Search"); + return self.isSearching() ? gettext("Searching...") : gettext("Search"); }); function escapeHtml(value) { @@ -798,9 +745,7 @@ $(() => { continue; } - pieces.push( - escapeHtml(rawText.slice(lastIndex, match.index)), - ); + pieces.push(escapeHtml(rawText.slice(lastIndex, match.index))); pieces.push( '' + escapeHtml(matchedText) + @@ -838,8 +783,7 @@ $(() => { } self.lastSearchAt = now; - var pageSize = - self.settings.settings.plugins.logmonitor.search_page_size(); + var pageSize = self.settings.settings.plugins.logmonitor.search_page_size(); var offset = self.currentPage() * pageSize; if ( @@ -877,8 +821,7 @@ $(() => { var message = "Error performing search"; if (error && error.status === 429) { - message = - "Too many search requests. Please wait a moment."; + message = "Too many search requests. Please wait a moment."; } self.debugLog("Search failed", { @@ -976,8 +919,7 @@ $(() => { return; } - var url = - pluginBaseUrl + "/download/" + encodeURIComponent(filename); + var url = pluginBaseUrl + "/download/" + encodeURIComponent(filename); self.downloadInProgress(true); @@ -1071,8 +1013,7 @@ $(() => { bindVisibilityToSetting("show_sidebar", self.showSidebar); var pluginSettings = getPluginSettings(); - var defaultLogFileObs = - pluginSettings && pluginSettings.default_log_file; + var defaultLogFileObs = pluginSettings && pluginSettings.default_log_file; if (typeof defaultLogFileObs === "function") { defaultLogFileObs.subscribe((newValue) => { var files = self.availableLogFiles(); @@ -1089,18 +1030,14 @@ $(() => { self.selectedLogFile.subscribe((newValue) => { if (suppressStreamSwitch) return; if (!self.isStreaming() || self.isSwitchingStream()) return; - if (typeof newValue !== "string" || newValue.length === 0) - return; + if (typeof newValue !== "string" || newValue.length === 0) return; if (newValue === self.activeStreamFile()) return; self.startStream(newValue, { isAutoSwitch: true }); }); - if ( - self.settings.settings.plugins.logmonitor.auto_start_streaming() - ) { - var file = - self.settings.settings.plugins.logmonitor.default_log_file(); + if (self.settings.settings.plugins.logmonitor.auto_start_streaming()) { + var file = self.settings.settings.plugins.logmonitor.default_log_file(); if (file) { setSelectedLogFile(file); setTimeout(() => { @@ -1161,8 +1098,7 @@ $(() => { // In-app OctoPrint-style toast notification (PNotify) if (alert.notification_enabled) { - var notificationMessage = - alert.message || "Severity: " + alert.level; + var notificationMessage = alert.message || "Severity: " + alert.level; var pnotifyType = "info"; if (alert.level === "CRITICAL" || alert.level === "ERROR") { From 320ac35ba2ebb1624ef005fd02e21183db313787 Mon Sep 17 00:00:00 2001 From: Ajimaru Date: Wed, 2 Dec 2026 08:28:04 +0100 Subject: [PATCH 3/5] chore: clean up workflows by removing unused files and updating CI configurations --- .codacy.yml | 26 +- .github/workflows/bandit-sarif.yml | 55 ---- .github/workflows/ci.yml | 431 +++++++++++++++++------------ .github/workflows/codeql.yml | 104 ++----- .github/workflows/i18n.yml | 88 ------ .github/workflows/lint.yml | 118 -------- README.md | 3 - codecov.yml | 35 --- 8 files changed, 289 insertions(+), 571 deletions(-) delete mode 100644 .github/workflows/bandit-sarif.yml delete mode 100644 .github/workflows/i18n.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 codecov.yml diff --git a/.codacy.yml b/.codacy.yml index 7fa30e2..90608b6 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -1,19 +1,19 @@ --- +# Paths Codacy does not analyse; shared by all plugins. exclude_paths: - - ".codacy/**" - "tests/**" - - "build/**" - - ".cache/**" - - ".venv-*/**" - - "**/site-packages/**" - - "OctoPrint_LogMonitor.egg-info/**" + - "**/test/**" + - "docs/**" + - "scripts/**" - "translations/**" - - ".venv/**" + - "**/translations/**" + - "archive/**" + - "3rdPartySoftware/**" + - "**/vendor/**" + - "**/*.min.js" + - "**/*.min.css" - "eslint.config.mjs" - # CSS is excluded from Codacy: its server-side Stylelint profile is - # misconfigured (it references non-existent "scss_*"-prefixed rules, which - # fail to load and report as errors on line 1), and the remaining findings - # are pure style/notation preferences that conflict with our actual CSS - # formatter (Prettier, run via pre-commit) and with deliberate - # browser-compatibility choices (rgba()/max-width over modern syntax). - "**/*.css" + +# Codacy's server-side Stylelint profile reports broken "scss_*" rules and +# style nits that contradict Prettier, so CSS is excluded above. diff --git a/.github/workflows/bandit-sarif.yml b/.github/workflows/bandit-sarif.yml deleted file mode 100644 index fbd1b00..0000000 --- a/.github/workflows/bandit-sarif.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Bandit SARIF - -on: - push: - branches: [main] - pull_request: - branches: [main] - schedule: - - cron: "27 01 * * *" - workflow_dispatch: {} - -permissions: - contents: read - security-events: write - actions: read - -concurrency: - group: bandit-sarif-${{ github.ref }} - cancel-in-progress: true - -jobs: - bandit-security-scan: - name: Bandit Security Scan (SARIF) - runs-on: ubuntu-latest - - steps: - - # Checkout repository code - name: Checkout - uses: actions/checkout@v7 - - - # Setup Python for Bandit scanning - name: Set up Python - uses: actions/setup-python@v7 - with: - python-version: "3.12" - cache: "pip" - - - # Install Bandit and SARIF formatter - name: Install tools - run: | - python -m pip install --upgrade pip setuptools wheel - pip install "bandit==1.9.3" bandit-sarif-formatter - - - # Execute Bandit and emit SARIF - name: Run Bandit (SARIF) - run: | - mkdir -p reports - bandit -r octoprint_logmonitor -x .venv,venv,.git -ll \ - --format sarif --output reports/bandit.sarif - - - # Upload SARIF to GitHub Security tab - name: Upload Bandit SARIF to GitHub Security - uses: github/codeql-action/upload-sarif@v4 - with: - sarif_file: reports/bandit.sarif diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72c141f..5bc7fa4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,225 +1,308 @@ name: CI +# Lint, tests, build and translation checks for pull requests and the long-lived +# branches. Every plugin repo uses this workflow; only env and matrices differ. on: - push: - branches: ["main"] - tags: ["v*"] pull_request: + push: + branches: [main, dev] concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: contents: read +env: + PLUGIN_PACKAGE: octoprint_logmonitor + # pip arguments for the test run, installed after OctoPrint. + TEST_DEPS: "-e .[develop]" + TEST_PATH: "" + # "pre-commit" once the repo has a hook config, else "ruff" with RUFF_ARGS. + LINT: ruff + RUFF_ARGS: "" + # setup.py imports octoprint_setuptools, so those builds need OctoPrint installed. + BUILD_ARGS: "" + jobs: - test: - name: Test (Python ${{ matrix.python-version }}) - runs-on: ${{ matrix.os }} - env: - BABEL_VERSION: "2.18.0" - POLIB_VERSION: "1.2.0" + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-python@v7 + with: + python-version: "3.13" + + # Hooks with `language: system` need the node packages and ShellCheck 0.11. + - name: Set up Node.js + if: env.LINT == 'pre-commit' && hashFiles('package.json') != '' + uses: actions/setup-node@v7 + with: + node-version: "22" + + - name: Install node packages + if: env.LINT == 'pre-commit' && hashFiles('package.json') != '' + run: | + if [ -f package-lock.json ]; then npm ci --no-audit --no-fund + else npm install --no-audit --no-fund; fi + + - name: Install ShellCheck + if: env.LINT == 'pre-commit' && hashFiles('.githooks/shellcheck-hook.sh') != '' + run: | + url=https://github.com/koalaman/shellcheck/releases/download/v0.11.0/shellcheck-v0.11.0.linux.x86_64.tar.xz + curl -fsSL "$url" | tar -xJ -C "$RUNNER_TEMP" + sudo install "$RUNNER_TEMP/shellcheck-v0.11.0/shellcheck" /usr/local/bin/shellcheck + + - name: Cache pre-commit hook environments + if: env.LINT == 'pre-commit' + uses: actions/cache@v6 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + + - name: Run pre-commit + if: env.LINT == 'pre-commit' + # The translations hook needs a local venv; the Translations job covers it. + env: + SKIP: check-translations + run: | + python -m pip install pre-commit + pre-commit run --all-files --show-diff-on-failure + + - name: Run ruff + if: env.LINT == 'ruff' + run: | + python -m pip install ruff + # The variables hold several arguments; split them on purpose. + # shellcheck disable=SC2086 + ruff check $RUFF_ARGS . + + tests: + name: Tests (OctoPrint ${{ matrix.octoprint }}, Python ${{ matrix.python }}) + runs-on: ${{ matrix.runner }} strategy: fail-fast: false matrix: include: - # Pinned: actions/setup-python has no Python 3.9 for ubuntu-latest - # (26.04) any more, only up to 24.04. - - python-version: "3.9" - os: ubuntu-24.04 - run-precommit: false # Modern pre-commit hooks require Python >= 3.10 - run-coverage: false - run-build: false - - python-version: "3.10" - os: ubuntu-latest - run-precommit: true - run-coverage: false - run-build: false - - python-version: "3.11" - os: ubuntu-latest - run-precommit: true - run-coverage: false - run-build: false - - python-version: "3.12" - os: ubuntu-latest - run-precommit: true - run-coverage: true - run-build: true - - python-version: "3.13" - os: ubuntu-latest - run-precommit: true - run-coverage: false - run-build: false - + # Every Python version each OctoPrint generation supports. + - { octoprint: "1.x", python: "3.9", runner: ubuntu-24.04 } + - { octoprint: "1.x", python: "3.10", runner: ubuntu-latest } + - { octoprint: "1.x", python: "3.11", runner: ubuntu-latest } + - { octoprint: "1.x", python: "3.12", runner: ubuntu-latest } + - { octoprint: "1.x", python: "3.13", runner: ubuntu-latest } + - { octoprint: "2.x", python: "3.9", runner: ubuntu-24.04 } + - { octoprint: "2.x", python: "3.10", runner: ubuntu-latest } + - { octoprint: "2.x", python: "3.11", runner: ubuntu-latest } + - { octoprint: "2.x", python: "3.12", runner: ubuntu-latest } + - { octoprint: "2.x", python: "3.13", runner: ubuntu-latest, coverage: true } + - { octoprint: "2.x", python: "3.14", runner: ubuntu-latest } + - { octoprint: "2.x", python: "3.15", runner: ubuntu-latest } + env: + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_API_TOKEN }} steps: - - # Checkout repository code - name: Checkout - uses: actions/checkout@v7 + - uses: actions/checkout@v7 - - # Setup Python version and pip cache - name: Set up Python - uses: actions/setup-python@v7 + - uses: actions/setup-python@v7 with: - python-version: ${{ matrix.python-version }} - cache: pip + python-version: ${{ matrix.python }} - - # Upgrade pip and build tools - name: Upgrade pip/setuptools/wheel + - name: Install OctoPrint and test dependencies run: | python -m pip install --upgrade pip setuptools wheel + # OctoPrint 1.x's octoprint_setuptools still needs pkg_resources. + if [ "${{ matrix.octoprint }}" = "1.x" ]; then + python -m pip install "OctoPrint>=1.11,<2" "setuptools<81" + else + python -m pip install "OctoPrint>=2,<3" + fi + set -f # keep extras like .[test] away from globbing + # The variables hold several arguments; split them on purpose. + # shellcheck disable=SC2086 + python -m pip install pytest pytest-cov $TEST_DEPS - - # Create venv and install all dependencies - name: Create venv and install dependencies - run: | - python -m venv .venv - . .venv/bin/activate - python -m pip install --upgrade pip setuptools wheel - python -m pip install "OctoPrint>=1.10.0,<2" - python -m pip install "Babel==${{ env.BABEL_VERSION }}" "polib==${{ env.POLIB_VERSION }}" - python -m pip install -e ".[develop]" build pytest pytest-cov pre-commit - - - # Run unit tests (no coverage) - name: Run tests - if: ${{ !matrix.run-coverage }} - run: | - if [ -d .venv ]; then . .venv/bin/activate; fi - pytest -q - - - # Run unit tests with coverage reporting - name: Run tests (with coverage) - if: ${{ matrix.run-coverage }} + - name: Run tests run: | - if [ -d .venv ]; then . .venv/bin/activate; fi - pytest -q --cov=octoprint_logmonitor --cov-branch --cov-report=xml:coverage.xml + # The variables hold several arguments; split them on purpose. + # shellcheck disable=SC2086 + if [ "${{ matrix.coverage }}" = "true" ]; then + python -m pytest -q $TEST_PATH --cov="$PLUGIN_PACKAGE" --cov-report=xml + else + python -m pytest -q $TEST_PATH + fi - - # Upload coverage.xml to Codecov - name: Upload coverage to Codecov - if: ${{ matrix.run-coverage && github.repository == 'Ajimaru/OctoPrint-LogMonitor' }} - uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7 + - name: Upload coverage to Codecov + if: matrix.coverage + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: - token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml - flags: unittests - disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false - - # Upload coverage report to Codacy (optional) - name: Upload coverage to Codacy - if: ${{ matrix.run-coverage && github.repository == 'Ajimaru/OctoPrint-LogMonitor' }} - env: - CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }} - CODACY_ORGANIZATION_PROVIDER: gh - CODACY_USERNAME: Ajimaru - CODACY_PROJECT_NAME: OctoPrint-LogMonitor - continue-on-error: true - run: | - bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml + # Skipped until the repo has a CODACY_API_TOKEN secret. + - name: Upload coverage to Codacy + if: matrix.coverage && env.CODACY_PROJECT_TOKEN != '' + run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml - - # Setup Node.js for pre-commit hooks (ESLint/Prettier) - name: Set up Node.js for hooks - if: ${{ matrix.run-precommit && hashFiles('.pre-commit-config.yaml') != '' }} - uses: actions/setup-node@v7 + build: + name: Build & load (OctoPrint ${{ matrix.octoprint }}) + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + include: + - { octoprint: "1.x", python: "3.9", runner: ubuntu-24.04, disabled: false } + - { octoprint: "2.x", python: "3.13", runner: ubuntu-latest, disabled: false } + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-python@v7 with: - node-version: "20.19.0" - cache: "npm" - cache-dependency-path: "package-lock.json" + python-version: ${{ matrix.python }} - - # Install npm dependencies required by hooks - name: Install Node.js dependencies for hooks - if: ${{ matrix.run-precommit && hashFiles('.pre-commit-config.yaml') != '' }} + - name: Install OctoPrint run: | - if [ -f package.json ] && [ -f package-lock.json ]; then - npm ci --no-audit --no-fund - elif [ -f package.json ]; then - npm install --no-audit --no-fund + python -m pip install --upgrade pip build setuptools wheel + # OctoPrint 1.x's octoprint_setuptools still needs pkg_resources. + if [ "${{ matrix.octoprint }}" = "1.x" ]; then + python -m pip install "OctoPrint>=1.11,<2" "setuptools<81" + else + python -m pip install "OctoPrint>=2,<3" fi - - # Install ShellCheck >= 0.11.0 required by custom shellcheck-hook.sh - name: Install ShellCheck - if: ${{ matrix.run-precommit && hashFiles('.pre-commit-config.yaml') != '' }} + - name: Build sdist and wheel run: | - set -e - SHELLCHECK_VERSION="0.11.0" - INSTALL_DIR="/usr/local/bin" - SHELLCHECK_URL="https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" - - echo "Downloading ShellCheck ${SHELLCHECK_VERSION}..." - mkdir -p /tmp/shellcheck-install - cd /tmp/shellcheck-install - wget -q "${SHELLCHECK_URL}" -O shellcheck.tar.xz - tar -xf shellcheck.tar.xz - - echo "Installing to ${INSTALL_DIR}..." - sudo cp "shellcheck-v${SHELLCHECK_VERSION}/shellcheck" "${INSTALL_DIR}/shellcheck" - sudo chmod +x "${INSTALL_DIR}/shellcheck" - - echo "Verifying installation..." - "${INSTALL_DIR}/shellcheck" --version - - - # Execute pre-commit hooks across repository - name: Run pre-commit - if: ${{ matrix.run-precommit && hashFiles('.pre-commit-config.yaml') != '' }} + # The variables hold several arguments; split them on purpose. + # shellcheck disable=SC2086 + python -m build $BUILD_ARGS + + # A plugin must never pin an OctoPrint version: pip would then change the + # host's OctoPrint, e.g. lift a 1.x instance to 2.x. Minimum versions belong + # in __plugin_check__. A bare "OctoPrint" (added by octoprint_setuptools) is + # fine, any installed version satisfies it. + - name: Check the wheel does not pin OctoPrint run: | - if [ -d .venv ]; then . .venv/bin/activate; fi - pre-commit run --all-files + python - <<'PY' + import glob + import re + import sys + import zipfile + + wheel = glob.glob("dist/*.whl")[0] + with zipfile.ZipFile(wheel) as zf: + meta = next(n for n in zf.namelist() if n.endswith(".dist-info/METADATA")) + lines = zf.read(meta).decode("utf-8").splitlines() + reqs = [line.split(":", 1)[1].strip() for line in lines if line.startswith("Requires-Dist:")] + bad = [r for r in reqs if re.match(r"octoprint\s*(\[[^\]]*\])?\s*\(?\s*[<>=!~]", r, re.I)] + if bad: + sys.exit("The plugin must not pin an OctoPrint version: " + ", ".join(bad)) + print("no OctoPrint version pin among", len(reqs), "dependencies") + PY - - name: Smoke install (import check) + - name: Install the wheel run: | - if [ -d .venv ]; then . .venv/bin/activate; fi - python -c "import importlib, sys; importlib.import_module('octoprint_logmonitor'); print('ok')" + before=$(python -c "from importlib.metadata import version; print(version('OctoPrint'))") + python -m pip install dist/*.whl + after=$(python -c "from importlib.metadata import version; print(version('OctoPrint'))") + echo "OctoPrint $before -> $after" + if [ "$before" != "$after" ]; then + echo "::error::Installing the plugin changed OctoPrint from $before to $after" + exit 1 + fi - - # Build source and wheel distributions - name: Build package - if: ${{ matrix.run-build }} + # Runs outside the checkout so the installed package is imported. + - name: Load the plugin + working-directory: ${{ runner.temp }} + env: + # disabled: this OctoPrint is unsupported, the plugin has to switch itself off. + EXPECT_DISABLED: ${{ matrix.disabled }} run: | - if [ -d .venv ]; then . .venv/bin/activate; fi - python -m build + python - <<'PY' + import importlib + import importlib.metadata + import os - octoprint-smoke: - name: Smoke (OctoPrint ${{ matrix.octoprint-label }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - octoprint-label: "1.10.0 (minimum)" - octoprint-source: pypi - octoprint-spec: "OctoPrint==1.10.0" - python-version: "3.10" - - octoprint-label: "devel (git dev branch)" - octoprint-source: git - python-version: "3.12" + plugin = importlib.import_module(os.environ["PLUGIN_PACKAGE"]) + check = getattr(plugin, "__plugin_check__", None) + compatible = check() if callable(check) else True + if os.environ["EXPECT_DISABLED"] == "true": + assert not compatible, "__plugin_check__ accepted an unsupported OctoPrint" + print("disabled itself on this OctoPrint, as expected") + raise SystemExit(0) + assert compatible, "__plugin_check__ rejected a supported OctoPrint" + if callable(getattr(plugin, "__plugin_load__", None)): + plugin.__plugin_load__() + impl = getattr(plugin, "__plugin_implementation__", None) + assert impl is not None, "no __plugin_implementation__" + base = os.path.dirname(plugin.__file__) + # OctoPrint injects these before calling get_assets(); its default + # implementation discovers the assets with them. + if not hasattr(impl, "_basefolder"): + impl._basefolder = base + if not hasattr(impl, "_identifier"): + eps = importlib.metadata.entry_points() + group = ( + eps.select(group="octoprint.plugin") + if hasattr(eps, "select") + else eps.get("octoprint.plugin", []) + ) + impl._identifier = next(e.name for e in group if e.value == plugin.__name__) + if callable(getattr(impl, "get_assets", None)): + for names in impl.get_assets().values(): + for name in names: + path = os.path.join(base, "static", name) + assert os.path.isfile(path), f"asset missing from the wheel: {name}" + print("loaded", plugin.__name__, getattr(plugin, "__plugin_version__", "?")) + PY + translations: + name: Translations + runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v7 + - uses: actions/checkout@v7 - - name: Set up Python - uses: actions/setup-python@v7 + - uses: actions/setup-python@v7 with: - python-version: ${{ matrix.python-version }} - cache: pip + python-version: "3.13" - - name: Install OctoPrint (PyPI) - if: matrix.octoprint-source == 'pypi' - run: | - python -m pip install --upgrade pip - python -m pip install "setuptools<81" "${{ matrix.octoprint-spec }}" + # babel.cfg may load OctoPrint's Jinja extensions; OctoPrint also brings Babel. + - name: Install OctoPrint + run: python -m pip install "OctoPrint>=2,<3" - - name: Install OctoPrint (git dev branch) - if: matrix.octoprint-source == 'git' + - name: Check catalogs against the sources run: | - python -m pip install --upgrade pip setuptools wheel - python -m pip install "git+https://github.com/OctoPrint/OctoPrint@dev#egg=OctoPrint" + pybabel -q extract -F babel.cfg -o "$RUNNER_TEMP/messages.pot" . + python - <<'PY' + import glob + import os + import sys - - name: Install plugin - run: | - python -m pip install . + from babel.messages.pofile import read_po - - name: Smoke test plugin import - run: | - python -m pip install --upgrade "setuptools<81" - mkdir ../smoketest - cd ../smoketest - python -c "import octoprint_logmonitor; print(getattr(octoprint_logmonitor, '__version__', 'unknown'))" + def msgids(path): + with open(path, "rb") as f: + return { + (m.context, m.id if isinstance(m.id, str) else m.id[0]) + for m in read_po(f) + if m.id + } + + fresh = msgids(os.path.join(os.environ["RUNNER_TEMP"], "messages.pot")) + problems = [] + if msgids("translations/messages.pot") != fresh: + problems.append("translations/messages.pot is out of date") + for po in sorted(glob.glob("translations/*/LC_MESSAGES/messages.po")): + if fresh - msgids(po): + problems.append(f"{po} is missing messages") + if problems: + print("\n".join(problems)) + print("Fix: see translations/README.txt (pybabel extract, update, compile).") + sys.exit(1) + print(f"{len(fresh)} messages, catalogs in sync") + PY + + - name: Compile catalogs + if: hashFiles('translations/*/LC_MESSAGES/messages.po') != '' + run: pybabel compile -d translations --statistics diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5a4c6dc..9b94804 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,103 +1,37 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL Advanced" +name: CodeQL on: push: - branches: ["main"] + branches: [main, dev] pull_request: - branches: ["main"] schedule: - - cron: "19 4 * * 1" + - cron: "27 1 * * 1" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + security-events: write + actions: read jobs: analyze: name: Analyze (${{ matrix.language }}) - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners (GitHub.com only) - # Consider using larger runners or machines with greater resources for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - permissions: - # required for all workflows - security-events: write - - # required to fetch internal or private CodeQL packs - packages: read - - # only required for workflows in private repositories - actions: read - contents: read - + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - include: - - language: actions - build-mode: none - - language: javascript-typescript - build-mode: none - - language: python - build-mode: none - # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' - # Use `c-cpp` to analyze code written in C, C++ or both - # Use 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, - # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. - # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how - # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + language: [actions, javascript-typescript, python] steps: - - name: Checkout repository - uses: actions/checkout@v7 - - # Add any setup steps before running the `github/codeql-action/init` action. - # This includes steps like installing compilers or runtimes (`actions/setup-node` - # or others). This is typically only required for manual builds. - # - name: Setup runtime (example) - # uses: actions/setup-example@v1 + - uses: actions/checkout@v7 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v4 + - uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - name: Run manual build steps - if: matrix.build-mode == 'manual' - shell: bash - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 + build-mode: none - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 + - uses: github/codeql-action/analyze@v4 with: - category: "/language:${{matrix.language}}" + category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/i18n.yml b/.github/workflows/i18n.yml deleted file mode 100644 index 16dd9ef..0000000 --- a/.github/workflows/i18n.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: i18n - -on: - pull_request: - push: - branches: ["main"] - tags: ["v*"] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - i18n: - name: i18n catalog check - runs-on: ubuntu-latest - - steps: - - # Checkout repository code - name: Checkout - uses: actions/checkout@v7 - - - # Setup Python 3.12 for i18n tools - name: Set up Python - uses: actions/setup-python@v7 - with: - python-version: "3.12" - cache: pip - - - # Create venv and install Babel and polib for i18n - name: Create venv and install minimal i18n deps - run: | - python -m venv .venv - . .venv/bin/activate - python -m pip install --upgrade pip - python -m pip install setuptools 'polib==1.2.0' 'Babel>=2.16,<2.17' 'OctoPrint>=1.11.0,<2' - - - # Extract and validate translation catalog - name: Verify messages.pot is up to date - run: | - . .venv/bin/activate - ./.venv/bin/pybabel extract --sort-output -F babel.cfg -o /tmp/messages.pot . - python - <<'PY' - import pathlib - import sys - - def normalize(path: str) -> str: - text = pathlib.Path(path).read_text(encoding="utf-8") - lines = text.splitlines() - out = [] - for line in lines: - # These headers are time/tool-version dependent. - if line.startswith('"POT-Creation-Date:'): - continue - if line.startswith('"Generated-By:'): - continue - out.append(line) - return "\n".join(out).strip() + "\n" - - repo = "translations/messages.pot" - tmp = "/tmp/messages.pot" - - if not pathlib.Path(repo).exists(): - print(f"Missing {repo}") - sys.exit(1) - - if normalize(repo) != normalize(tmp): - print("translations/messages.pot is out of date. Run:") - print(" pybabel extract --sort-output -F babel.cfg -o translations/messages.pot .") - print(" pybabel update -i translations/messages.pot -d translations -l de") - print(" pybabel update -i translations/messages.pot -d translations -l en") - sys.exit(1) - PY - - - # Compile translation catalogs and copy to plugin directory - name: Compile catalogs - run: | - . .venv/bin/activate - ./.venv/bin/pybabel compile -d translations - mkdir -p octoprint_logmonitor/translations - if [ -n "$(find translations -maxdepth 2 -type f -print -quit 2>/dev/null)" ]; then - cp -a translations/* octoprint_logmonitor/translations/ - else - echo "Warning: translations/ is empty or missing; skipping copy" - fi diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 25b5dcc..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: Lint - -on: - push: - branches: [main] - pull_request: - branches: [main] - workflow_dispatch: {} - -permissions: - contents: read - -concurrency: - group: lint-${{ github.ref }} - cancel-in-progress: true - -jobs: - lint: - name: Lint (Python 3.12) - runs-on: ubuntu-latest - env: - BABEL_VERSION: "2.18.0" - POLIB_VERSION: "1.2.0" - BANDIT_VERSION: "1.9.3" - - steps: - - # Checkout repository code - name: Checkout - uses: actions/checkout@v7 - - - # Setup Python and pip cache - name: Set up Python - uses: actions/setup-python@v7 - with: - python-version: "3.12" - cache: pip - - - # Display versions for easier debugging - name: Show tool versions - run: | - python --version - pip --version - - - # Upgrade installer/build chain - name: Upgrade pip/setuptools/wheel - run: | - python -m pip install --upgrade pip setuptools wheel - - - # Install lint/security baseline deps - name: Install minimal CI dependencies - run: | - python -m pip install pre-commit "Babel==${{ env.BABEL_VERSION }}" "polib==${{ env.POLIB_VERSION }}" - - - # Setup Node.js for ESLint/Prettier hooks - name: Set up Node.js for hooks - if: ${{ hashFiles('.pre-commit-config.yaml') != '' }} - uses: actions/setup-node@v7 - with: - node-version: "20.19.0" - cache: "npm" - cache-dependency-path: "package-lock.json" - - - # Install npm dependencies only if package.json exists - name: Install Node.js dependencies for hooks - if: ${{ hashFiles('.pre-commit-config.yaml') != '' }} - run: | - if [ -f package.json ] && [ -f package-lock.json ]; then - npm ci --no-audit --no-fund - elif [ -f package.json ]; then - npm install --no-audit --no-fund - else - echo "No package.json present; skipping npm install" - fi - - - # Create venv for local hook scripts requiring .venv - name: Create ./.venv for translation check - run: | - python -m venv .venv - . .venv/bin/activate - python -m pip install --upgrade pip - python -m pip install "Babel==${{ env.BABEL_VERSION }}" "polib==${{ env.POLIB_VERSION }}" - - - # Install ShellCheck required by local hook - name: Install ShellCheck - if: ${{ hashFiles('.pre-commit-config.yaml') != '' }} - run: | - set -e - SHELLCHECK_VERSION="0.11.0" - INSTALL_DIR="/usr/local/bin" - SHELLCHECK_URL="https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" - - mkdir -p /tmp/shellcheck-install - cd /tmp/shellcheck-install - wget -q "${SHELLCHECK_URL}" -O shellcheck.tar.xz - tar -xf shellcheck.tar.xz - - sudo cp "shellcheck-v${SHELLCHECK_VERSION}/shellcheck" "${INSTALL_DIR}/shellcheck" - sudo chmod +x "${INSTALL_DIR}/shellcheck" - "${INSTALL_DIR}/shellcheck" --version - - - # Run complete pre-commit suite - name: Run pre-commit on all files - if: ${{ hashFiles('.pre-commit-config.yaml') != '' }} - run: | - pre-commit run --all-files --show-diff-on-failure --color always - - - # Run Bandit as explicit security lint step - name: Bandit (security) - if: success() || failure() - run: | - pip install "bandit==${{ env.BANDIT_VERSION }}" - bandit -r octoprint_logmonitor -x .venv,venv,.git -ll - - - # Print summary - name: Summary - if: always() - run: | - echo "Lint workflow finished" diff --git a/README.md b/README.md index fe3de84..ac7724a 100644 --- a/README.md +++ b/README.md @@ -190,10 +190,7 @@ Summary: this project exposes many status and quality badges (CI, linting, cover ### 🏗️ 1. Build & Test Status [![CI](https://img.shields.io/github/actions/workflow/status/Ajimaru/OctoPrint-LogMonitor/ci.yml?branch=main&style=flat-square&label=CI&logo=githubactions&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/actions/workflows/ci.yml?query=branch%3Amain) -[![i18n](https://img.shields.io/github/actions/workflow/status/Ajimaru/OctoPrint-LogMonitor/i18n.yml?branch=main&style=flat-square&label=i18n&logo=githubactions&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/actions/workflows/i18n.yml?query=branch%3Amain) -[![Lint](https://img.shields.io/github/actions/workflow/status/Ajimaru/OctoPrint-LogMonitor/lint.yml?branch=main&style=flat-square&label=Lint&logo=githubactions&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/actions/workflows/lint.yml?query=branch%3Amain) [![Docs workflow](https://img.shields.io/github/actions/workflow/status/Ajimaru/OctoPrint-LogMonitor/docs.yml?branch=main&style=flat-square&label=docs&logo=githubactions&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/actions/workflows/docs.yml?query=branch%3Amain) -[![Bandit SARIF](https://img.shields.io/github/actions/workflow/status/Ajimaru/OctoPrint-LogMonitor/bandit-sarif.yml?branch=main&style=flat-square&label=Bandit%20SARIF&logo=githubactions&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/actions/workflows/bandit-sarif.yml?query=branch%3Amain) ### 🧪 2. Code Quality & Formatting diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 3edb6a2..0000000 --- a/codecov.yml +++ /dev/null @@ -1,35 +0,0 @@ -codecov: - require_ci_to_pass: true - -coverage: - precision: 2 - round: down - range: "70...100" - - status: - project: - default: - target: auto - threshold: 2% - base: auto - informational: false - patch: - default: - target: 70% - threshold: 5% - informational: false - -ignore: - - "tests/**" - - "build/**" - - ".venv/**" - - ".venv-*/**" - - "OctoPrint_LogMonitor.egg-info/**" - -comment: - layout: "reach,diff,flags,files" - behavior: default - require_changes: false - require_base: false - require_head: true - hide_project_coverage: false From e9afa6db209640861eb809dc894b33e66b57709e Mon Sep 17 00:00:00 2001 From: Ajimaru Date: Wed, 2 Dec 2026 08:45:53 +0100 Subject: [PATCH 4/5] chore: update Python compatibility range to 3.9-3.15 in various files --- CONTRIBUTING.md | 2 +- README.md | 4 ++-- docs/contributing.md | 2 +- extras/logmonitor.md | 2 +- octoprint_logmonitor/__init__.py | 2 +- pyproject.toml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d8a20d..7b96068 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ Open a [feature request](https://github.com/Ajimaru/OctoPrint-LogMonitor/issues) Requirements: -- Python 3.9+ +- Python 3.9 to 3.15 - a local OctoPrint environment for manual testing Recommended setup: diff --git a/README.md b/README.md index ac7724a..e2a15ff 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![License](https://img.shields.io/github/license/Ajimaru/OctoPrint-LogMonitor?style=flat-square&logo=gnu&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/blob/main/LICENSE) -[![Python](https://img.shields.io/badge/python-3.9%2B-blue?style=flat-square&logo=python&logoColor=white)](https://python.org) +[![Python](https://img.shields.io/badge/python-3.9--3.15-blue?style=flat-square&logo=python&logoColor=white)](https://python.org) [![OctoPrint](https://img.shields.io/badge/OctoPrint-1.10.0%2B-blue?style=flat-square&logo=octoprint&logoColor=white)](https://octoprint.org) [![Latest Release](https://img.shields.io/github/v/release/Ajimaru/OctoPrint-LogMonitor?sort=semver&style=flat-square&logo=github&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/releases/latest) [![Downloads](https://img.shields.io/github/downloads/Ajimaru/OctoPrint-LogMonitor/total?style=flat-square&logo=github&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/releases) @@ -212,7 +212,7 @@ Summary: this project exposes many status and quality badges (CI, linting, cover [![Latest Release](https://img.shields.io/github/v/release/Ajimaru/OctoPrint-LogMonitor?sort=semver&style=flat-square&logo=github&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/releases/latest) [![Downloads](https://img.shields.io/github/downloads/Ajimaru/OctoPrint-LogMonitor/total?style=flat-square&logo=github&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/releases) [![Pre‑Release](https://img.shields.io/github/v/release/Ajimaru/OctoPrint-LogMonitor?include_prereleases&label=pre-release&style=flat-square&logo=github&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/releases) -[![Python](https://img.shields.io/badge/python-3.9%2B-blue?style=flat-square&logo=python&logoColor=white)](https://python.org) +[![Python](https://img.shields.io/badge/python-3.9--3.15-blue?style=flat-square&logo=python&logoColor=white)](https://python.org) [![OctoPrint](https://img.shields.io/badge/OctoPrint-1.10.0%2B-blue?style=flat-square&logo=octoprint&logoColor=white)](https://octoprint.org) [![Maintenance](https://img.shields.io/maintenance/yes/2026?style=flat-square&logo=github&logoColor=white)](https://github.com/Ajimaru/OctoPrint-LogMonitor/graphs/commit-activity) diff --git a/docs/contributing.md b/docs/contributing.md index 6db0d22..4ecc130 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -11,7 +11,7 @@ Keep changes small, testable, and focused. ## Local setup -- Python 3.9+ +- Python 3.9 to 3.15 - A local OctoPrint environment for manual testing For full contribution details, see the repository [CONTRIBUTING.md](https://github.com/Ajimaru/OctoPrint-LogMonitor/blob/main/CONTRIBUTING.md). diff --git a/extras/logmonitor.md b/extras/logmonitor.md index f4e93df..77eddaa 100644 --- a/extras/logmonitor.md +++ b/extras/logmonitor.md @@ -92,7 +92,7 @@ compatibility: # # Plugins that only support Python 2 will not be accepted into the plugin repository. - python: ">=3.9,<4" + python: ">=3.9,<3.16" # TODO # If any of the below attributes apply to your project, uncomment the corresponding lines. This is MANDATORY! diff --git a/octoprint_logmonitor/__init__.py b/octoprint_logmonitor/__init__.py index 34576c9..9cc4f2c 100644 --- a/octoprint_logmonitor/__init__.py +++ b/octoprint_logmonitor/__init__.py @@ -1748,7 +1748,7 @@ def get_update_information(self): # ~~ Plugin metadata __plugin_name__ = "Log Monitor" -__plugin_pythoncompat__ = ">=3.9,<4" +__plugin_pythoncompat__ = ">=3.9,<3.16" __plugin_version__ = PLUGIN_VERSION __plugin_description__ = ( "Live log streaming and searching for OctoPrint with severity alerting" diff --git a/pyproject.toml b/pyproject.toml index 9156239..19e3e3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ authors = [ ] readme = {file = "README.md", content-type = "text/markdown"} -requires-python = ">=3.9, <4" +requires-python = ">=3.9,<3.16" # any additional requirements (besides OctoPrint) should be listed here # From bf6a55d9831fb6ca5e6c300dd41b90f150947eb6 Mon Sep 17 00:00:00 2001 From: Ajimaru Date: Wed, 2 Dec 2026 12:08:18 +0100 Subject: [PATCH 5/5] chore: update Codacy environment variable names and improve coverage upload conditions --- .github/workflows/ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5bc7fa4..347a357 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,7 +101,7 @@ jobs: - { octoprint: "2.x", python: "3.14", runner: ubuntu-latest } - { octoprint: "2.x", python: "3.15", runner: ubuntu-latest } env: - CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_API_TOKEN }} + CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }} steps: - uses: actions/checkout@v7 @@ -141,9 +141,15 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false - # Skipped until the repo has a CODACY_API_TOKEN secret. + # Needs the Codacy account API token as CODACY_API_TOKEN; skipped without it. + # Like Codecov, a failed upload must not turn a passing test run red. - name: Upload coverage to Codacy - if: matrix.coverage && env.CODACY_PROJECT_TOKEN != '' + if: matrix.coverage && env.CODACY_API_TOKEN != '' + continue-on-error: true + env: + CODACY_ORGANIZATION_PROVIDER: gh + CODACY_USERNAME: ${{ github.repository_owner }} + CODACY_PROJECT_NAME: ${{ github.event.repository.name }} run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml build: