From 2480fcd39059fde5c8ceacf6cbf003f04ca2d39f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 22 Nov 2023 15:24:06 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=93=9D=20Update=20plugin=20tutorial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure cookiecutter templates are correctly shown. Closes #4852 --- docs/plugins/gettingstarted.rst | 131 ++++++++++++++++++++++++++------ setup.py | 2 +- 2 files changed, 108 insertions(+), 25 deletions(-) diff --git a/docs/plugins/gettingstarted.rst b/docs/plugins/gettingstarted.rst index 538ed7905..c3d4d75b4 100644 --- a/docs/plugins/gettingstarted.rst +++ b/docs/plugins/gettingstarted.rst @@ -64,13 +64,15 @@ We'll start at the most basic form a plugin can take - just a few simple lines o Saving this as ``helloworld.py`` in ``~/.octoprint/plugins`` yields you something resembling these log entries upon server startup:: (venv) $ octoprint serve - 2015-01-27 11:14:35,124 - octoprint.server - INFO - Starting OctoPrint 1.2.0-dev-448-gd96e56e (devel branch) + 2023-11-20 11:14:35,122 - octoprint.startup - INFO - ****************************************************************************** + 2023-11-20 11:14:35,124 - octoprint.startup - INFO - Starting OctoPrint 1.9.3 + 2023-11-20 11:14:35,124 - octoprint.startup - INFO - ****************************************************************************** [...] - 2015-01-27 11:14:35,124 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/.octoprint/plugins, /home/pi/OctoPrint/src/octoprint/plugins and installed plugin packages... + 2023-11-20 11:14:35,124 - octoprint.plugin.core - INFO - Loading plugins from /home/gina/.octoprint/plugins, /home/gina/devel/OctoPrint/src/octoprint/plugins and installed plugin packages... [...] - 2015-01-27 11:14:36,135 - octoprint.plugin.core - INFO - 3 plugin(s) registered with the system: + 2023-11-20 11:14:36,135 - octoprint.plugin.core - INFO - 19 plugin(s) registered with the system: [...] - | Hello World (1.0.0) = /home/pi/.octoprint/plugins/helloworld.py + | Hello World (1.0.0) = /home/gina/.octoprint/plugins/helloworld.py [...] OctoPrint found that plugin in the folder and took a look into it. The name and the version it displays in that log @@ -106,7 +108,7 @@ Apart from being discovered by OctoPrint, our plugin does nothing yet. We want t and restart OctoPrint. You now get this output in the log:: - 2015-01-27 11:17:10,792 - octoprint.plugins.helloworld - INFO - Hello World! + 2023-11-20 11:17:10,792 - octoprint.plugins.helloworld - INFO - Hello World! Neat, isn't it? We added a custom class that subclasses one of OctoPrint's :ref:`plugin mixins ` with :class:`~octoprint.plugin.StartupPlugin` and another control property, ``__plugin_implementation__``, that instantiates @@ -143,7 +145,7 @@ So let's begin. We'll use the `cookiecutter =1.4,<1.7" + (venv) $ pip install "cookiecutter>=2.1.1,<3" Then we can use the ``octoprint dev plugin:new`` command [#f1]_ to generate a new OctoPrint plugin skeleton for us:: @@ -229,16 +231,75 @@ configuration parameters for you: .. code-block:: python + # coding=utf-8 + + ######################################################################################################################## + ### Do not forget to adjust the following variables to your own plugin. + + # The plugin's identifier, has to be unique plugin_identifier = "helloworld" + + # The plugin's python package, should be "octoprint_", has to be unique plugin_package = "octoprint_helloworld" + + # The plugin's human readable name. Can be overwritten within OctoPrint's internal data via __plugin_name__ in the + # plugin module plugin_name = "OctoPrint-Helloworld" + + # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module plugin_version = "1.0.0" + + # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin + # module plugin_description = """A quick "Hello World" example plugin for OctoPrint""" - plugin_author = "Your Name" + + # The plugin's author. Can be overwritten within OctoPrint's internal data via __plugin_author__ in the plugin module + plugin_author = "Your name" + + # The plugin's author's mail address. plugin_author_email = "you@somewhere.net" + + # The plugin's homepage URL. Can be overwritten within OctoPrint's internal data via __plugin_url__ in the plugin module plugin_url = "https://github.com/yourGithubName/OctoPrint-Helloworld" + + # The plugin's license. Can be overwritten within OctoPrint's internal data via __plugin_license__ in the plugin module plugin_license = "AGPLv3" + # Any additional requirements besides OctoPrint should be listed here + plugin_requires = [] + + ### -------------------------------------------------------------------------------------------------------------------- + ### More advanced options that you usually shouldn't have to touch follow after this point + ### -------------------------------------------------------------------------------------------------------------------- + + # Additional package data to install for this plugin. The subfolders "templates", "static" and "translations" will + # already be installed automatically if they exist. Note that if you add something here you'll also need to update + # MANIFEST.in to match to ensure that python setup.py sdist produces a source distribution that contains all your + # files. This is sadly due to how python's setup.py works, see also http://stackoverflow.com/a/14159430/2028598 + plugin_additional_data = [] + + # Any additional python packages you need to install with your plugin that are not contained in .* + plugin_additional_packages = [] + + # Any python packages within .* you do NOT want to install with your plugin + plugin_ignored_packages = [] + + # Additional parameters for the call to setuptools.setup. If your plugin wants to register additional entry points, + # define dependency links or other things like that, this is the place to go. Will be merged recursively with the + # default setup parameters as provided by octoprint_setuptools.create_plugin_setup_parameters using + # octoprint.util.dict_merge. + # + # Example: + # plugin_requires = ["someDependency==dev"] + # additional_setup_parameters = {"dependency_links": ["https://github.com/someUser/someRepo/archive/master.zip#egg=someDependency-dev"]} + # "python_requires": ">=3,<4" blocks installation on Python 2 systems, to prevent confused users and provide a helpful error. + # Remove it if you would like to support Python 2 as well as 3 (not recommended). + additional_setup_parameters = {"python_requires": ">=3,<4"} + + ######################################################################################################################## + + # ... remaining setup.py content ... + Now all that's left to do is to move our ``helloworld.py`` into the ``octoprint_helloworld`` folder and renaming it to ``__init__.py``. Make sure to delete the copy under ``~/.octoprint/plugins`` in the process, including the ``.pyc`` file! @@ -249,23 +310,34 @@ discoverable by OctoPrint, however we don't have to reinstall it after any chang to your OctoPrint installation:: (venv) $ octoprint dev plugin:install - running develop - running egg_info - creating OctoPrint_HelloWorld.egg-info + >> /home/gina/.pyenv/versions/3.11.2/envs/octoprint-py311/bin/python -m pip install -e . + Obtaining file:///home/gina/devel/OctoPrint-Helloworld + + Preparing metadata (setup.py): started + + Preparing metadata (setup.py): finished with status 'done' + [...] - Finished processing dependencies for OctoPrint-HelloWorld==1.0.0 + + Installing collected packages: OctoPrint-Helloworld + + Running setup.py develop for OctoPrint-Helloworld + + Successfully installed OctoPrint-Helloworld-0.1.0 Restart OctoPrint. Your plugin should still be properly discovered and the log line should be printed:: - 2015-01-27 13:43:34,134 - octoprint.server - INFO - Starting OctoPrint 1.2.0-dev-448-gd96e56e (devel branch) + 2023-11-20 13:43:34,132 - octoprint.startup - INFO - ****************************************************************************** + 2023-11-20 13:43:34,134 - octoprint.startup - INFO - Starting OctoPrint 1.9.3 + 2023-11-20 13:43:34,134 - octoprint.startup - INFO - ****************************************************************************** [...] - 2015-01-27 13:43:34,134 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/.octoprint/plugins, /home/pi/OctoPrint/src/octoprint/plugins and installed plugin packages... + 2023-11-20 13:43:34,134 - octoprint.plugin.core - INFO - Loading plugins from /home/gina/.octoprint/plugins, /home/gina/devel/OctoPrint/src/octoprint/plugins and installed plugin packages... [...] - 2015-01-27 13:43:34,818 - octoprint.plugin.core - INFO - 3 plugin(s) registered with the system: + 2023-11-20 13:43:34,818 - octoprint.plugin.core - INFO - 19 plugin(s) registered with the system: [...] - | Hello World (1.0.0) = /home/pi/devel/OctoPrint-HelloWorld/octoprint_helloworld + | Hello World (1.0.0) = /home/gina/devel/OctoPrint-HelloWorld/octoprint_helloworld [...] - 2015-01-27 13:43:38,997 - octoprint.plugins.helloworld - INFO - Hello World! + 2023-11-20 13:43:38,997 - octoprint.plugins.helloworld - INFO - Hello World! Looks like it still works! @@ -282,9 +354,20 @@ of information now defined twice: .. code-block:: python :caption: setup.py - plugin_name = "OctoPrint-HelloWorld" + # ... + + # The plugin's human readable name. Can be overwritten within OctoPrint's internal data via __plugin_name__ in the + # plugin module + plugin_name = "OctoPrint-Helloworld" + + # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module plugin_version = "1.0.0" - plugin_description = "A quick \"Hello World\" example plugin for OctoPrint" + + # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin + # module + plugin_description = """A quick "Hello World" example plugin for OctoPrint""" + + # ... The nice thing about our plugin now being a proper Python package is that OctoPrint can and will access the metadata defined within ``setup.py``! So, we don't really need to define all this data twice. Remove ``__plugin_name__``, ``__plugin_version__`` @@ -303,9 +386,9 @@ and ``__plugin_description__`` from ``__init__.py``, but leave ``__plugin_implem and restart OctoPrint:: - 2015-01-27 13:46:33,786 - octoprint.plugin.core - INFO - 3 plugin(s) registered with the system: + 2023-11-20 13:46:33,786 - octoprint.plugin.core - INFO - 19 plugin(s) registered with the system: [...] - | OctoPrint-HelloWorld (1.0.0) = /home/pi/devel/OctoPrint-HelloWorld/octoprint_helloworld + | OctoPrint-HelloWorld (1.0.0) = /home/gina/devel/OctoPrint-HelloWorld/octoprint_helloworld [...] Our "Hello World" Plugin still gets detected fine, but it's now listed under the same name it's installed under, @@ -327,9 +410,9 @@ Our "Hello World" Plugin still gets detected fine, but it's now listed under the Restart OctoPrint again:: - 2015-01-27 13:48:54,122 - octoprint.plugin.core - INFO - 3 plugin(s) registered with the system: + 2023-11-20 13:48:54,122 - octoprint.plugin.core - INFO - 19 plugin(s) registered with the system: [...] - | Hello World (1.0.0) = /home/pi/OctoPrint-HelloWorld/octoprint_helloworld + | Hello World (1.0.0) = /home/gina/devel/OctoPrint-HelloWorld/octoprint_helloworld [...] Much better! You can override pretty much all of the metadata defined within ``setup.py`` from within your Plugin itself -- @@ -339,7 +422,7 @@ overrides. Following the README of the `Plugin Skeleton `_ you could now already publish your plugin on Github and it would be directly installable by others using pip:: - (venv) $ pip install https://github.com/yourGithubName/OctoPrint-HelloWorld/archive/master.zip + (venv) $ pip install https://github.com/yourGithubName/OctoPrint-HelloWorld/archive/main.zip But let's add some more features instead. @@ -532,7 +615,7 @@ settings view model into the ``href`` attribute of the link tag: .. code-block:: html - Hello World! + Hello World! You might have noticed the quite ugly way to access our plugin's ``url`` property here: ``settings.settings.plugins.helloworld.url``. The reason for this is that we'll make our plugin use the existing ``NavigationViewModel`` which holds the diff --git a/setup.py b/setup.py index e6a83f61a..5f3c0f6de 100644 --- a/setup.py +++ b/setup.py @@ -106,7 +106,7 @@ EXTRA_REQUIRES = { "pyinstrument", ], # Dependencies for developing OctoPrint plugins - "plugins": ["cookiecutter>=2.1.1,<3"], + "plugins": ["cookiecutter>=2.1.1,<3"], # update plugin tutorial when updating this # Dependencies for building the documentation "docs": [ "sphinx", From b141f796691491cb325096dbe98064e81fef221e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Nov 2023 17:15:57 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=91=B7=20Bump=20actions/github-script?= =?UTF-8?q?=20from=206=20to=207=20(#4909)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/issue_automation.yml | 4 ++-- .github/workflows/linkify_bundles.yml | 2 +- .github/workflows/pr_automation.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue_automation.yml b/.github/workflows/issue_automation.yml index ab645ab90..4d7235133 100644 --- a/.github/workflows/issue_automation.yml +++ b/.github/workflows/issue_automation.yml @@ -7,7 +7,7 @@ jobs: issue-automation: runs-on: ubuntu-latest steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -72,7 +72,7 @@ jobs: # with: # repo-token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 env: REMINDER: > Hi @${{ github.event.issue.user.login }}! diff --git a/.github/workflows/linkify_bundles.yml b/.github/workflows/linkify_bundles.yml index 18bc21a07..63f09bdff 100644 --- a/.github/workflows/linkify_bundles.yml +++ b/.github/workflows/linkify_bundles.yml @@ -7,7 +7,7 @@ jobs: linkifyBundles: runs-on: ubuntu-latest steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/pr_automation.yml b/.github/workflows/pr_automation.yml index 9031376fe..c70eb68c5 100644 --- a/.github/workflows/pr_automation.yml +++ b/.github/workflows/pr_automation.yml @@ -12,7 +12,7 @@ jobs: with: repo-token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | From a93b4d397248dc406a75e634c1326fb1b8ddcb63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Nov 2023 17:16:58 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=91=B7=20Bump=20dessant/lock-threads?= =?UTF-8?q?=20from=204=20to=205=20(#4910)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dessant/lock-threads](https://github.com/dessant/lock-threads) from 4 to 5. - [Release notes](https://github.com/dessant/lock-threads/releases) - [Changelog](https://github.com/dessant/lock-threads/blob/main/CHANGELOG.md) - [Commits](https://github.com/dessant/lock-threads/compare/v4...v5) --- updated-dependencies: - dependency-name: dessant/lock-threads dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/cleanup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index e82f52fb9..5bd70ae26 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -10,7 +10,7 @@ jobs: name: 🔒 Lock issues & PRs closed over a year runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v4 + - uses: dessant/lock-threads@v5 with: github-token: ${{ github.token }} issue-comment: "" From 8bcebb7ed93eceb3d8189803b14acb6a51630e22 Mon Sep 17 00:00:00 2001 From: "evan.wurden" Date: Wed, 22 Nov 2023 10:19:18 -0600 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=9A=B8=20Add=20axis=20labels=20to=20m?= =?UTF-8?q?odel=20size=20dimensions=20(#4898)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4866 --- src/octoprint/static/js/app/viewmodels/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index 4afa0a393..e0f2c659e 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -1063,7 +1063,7 @@ $(function () { gettext("Model size") + ": " + _.sprintf( - "%(width).2fmm × %(depth).2fmm × %(height).2fmm", + "%(width).2fmm (X) × %(depth).2fmm (Y) × %(height).2fmm (Z)", dimensions ); output += "
"; From 3fae2952b179ab3fdd69272d3ba1790bd44980a2 Mon Sep 17 00:00:00 2001 From: Credomane Evonguard Date: Wed, 22 Nov 2023 10:22:29 -0600 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=9A=B8=20Add=20APIKey=20details=20to?= =?UTF-8?q?=20user=20settings=20so=20QRCode=20can=20be=20viewed.=20(#4895)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4894 --- .../plugins/appkeys/templates/appkeys_usersettings.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/plugins/appkeys/templates/appkeys_usersettings.jinja2 b/src/octoprint/plugins/appkeys/templates/appkeys_usersettings.jinja2 index 5c0930efb..3f127c54f 100644 --- a/src/octoprint/plugins/appkeys/templates/appkeys_usersettings.jinja2 +++ b/src/octoprint/plugins/appkeys/templates/appkeys_usersettings.jinja2 @@ -14,7 +14,7 @@
{{ _('API Key') }}: - +  |