diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b16e89c93..dd0784bec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,7 @@ name: Build on: push: + pull_request: [opened, sychronize, reopened] release: types: [published, prereleased] workflow_dispatch: diff --git a/.gitignore b/.gitignore index 4aa025b88..930e41f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ pypy .eggs .mypy_cache .pytest_cache +.python-version .tox venv* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 61de0f8d3..63aed2508 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -287,9 +287,10 @@ See [How to open the Javascript Console in different browsers](https://webmaster ## Setting up a development environment -See [the corresponding chapter in the documentation](http://docs.octoprint.org/en/master/development/index.html#setting-up-a-development-environment). +See [the corresponding chapter in the documentation](https://docs.octoprint.org/en/master/development/environment.html). This also includes information on how to run the test suite and how to build -the documentation. +the documentation, the bundled virtual printer plugin and OctoPrint's versioning +and branching strategy. ## Pull requests @@ -297,7 +298,8 @@ the documentation. consider if it wouldn't be better suited for a plugin.** As a general rule of thumb, any feature that is only of interest to a small sub group should be moved into a plugin. If the current plugin system doesn't allow you to - implement your feature as a plugin, create a "Brainstorming" ticket to get + implement your feature as a plugin, please get in touch on the + [forums](https://community.octoprint.org/c/development) to get the discussion going on how best to solve *this* in OctoPrint's plugin system - maybe that's the actual PR you have been waiting for to contribute :) 2. If you plan to make **any large or otherwise disruptive changes to the @@ -335,7 +337,7 @@ the documentation. from experiments). 8. Ensure your changes **pass the existing unit tests**. PRs that break those cannot be accepted. You can run the unit tests locally (after - [initial development environment setup with "develop" dependencies](http://docs.octoprint.org/en/master/development/index.html#setting-up-a-development-environment)) + [initial development environment setup with "develop" dependencies](https://docs.octoprint.org/en/master/development/environment.html)) by running ``` @@ -376,86 +378,13 @@ Template to use for Pull Request descriptions: #### Further notes ``` +## How is OctoPrint versioned? + +See [the corresponding chapter in the documentation](https://docs.octoprint.org/en/master/development/versioning.html). + ## What do the branches mean? -There are three main branches in OctoPrint: - - * `master`: The master branch always contains the current stable release plus any changes - since made to *documentation*, *CI related tests* or *Github meta files*. OctoPrint's actual - code will only be modified on new releases. Will have a version number following - the scheme `..` (e.g. `1.5.1`). - * `maintenance`: Improvements and fixes of the current release that make up - the next release go here. More or less continuously updated. You can consider - this a preview of the next release version. It should be very stable at all - times. Anything you spot in here helps tremendously with getting a rock solid - next stable release, so if you want to help out development, running the - `maintenance` branch and reporting back anything you find is a very good way - to do that. Will usually have a version number following the scheme - `..<0>.dev` for an OctoPrint version of `..` - (e.g. `1.5.0.dev114`). - * `devel`: Ongoing development of what will go into the next big - release (MAJOR version number increases) will happen on this branch. Usually - kept stable, sometimes stuff can break though. Backwards incompatible changes will - be encountered here. Can be considered the "bleeding edge". Will usually have a version - number following the scheme `.<0>.0.dev` for a current - OctoPrint version of `..` (e.g. `2.0.0.dev123`). - -There are couple more RC and staging branches that see regular use: - - * `staging/hotfix`: Any preparation for potential hotfix releases takes place here. - Version number follows the scheme `..` (e.g. `1.5.1`) for a current release - of `..`. - * `rc/maintenance`: This branch is reserved for future releases that have graduated from - the `maintenance` branch and are now being pushed on the "Maintenance" - pre release channel for further testing. Version number follows the scheme - `..rc` (e.g. `1.5.0rc1`). - * `staging/maintenance`: Any preparation for potential follow-up RCs takes place here. - Version number follows the scheme `..rc.dev` (e.g. - `1.5.0rc2.dev3`) for a current Maintenance RC of `..`. - * `rc/devel`: This branch is reserved for future releases that have graduated from - the `devel` branch and are now being pushed on the "Devel" pre release channel - for further testing. Version number follows the scheme `.0.0rc` (e.g. `2.0.0rc1`) - for a current stable OctoPrint version of `..`. - * `staging/devel`: Any preparation for potential follow-up Devel RCs takes place - here. Version number follows the scheme `.0.0rc.dev` (e.g. - `2.0.0rc2.dev12`) for a current Devel RC of `.0.0rc`. - -Additionally, from time to time you might see other branches pop up in the repository. -Those usually have one of the following prefixes: - - * `hotfix/...`: Hotfixes under development that are to be merged into the `staging/hotfix` - and later the `master` branch. - * `fix/...`: Fixes under development that are to be merged into the `maintenance` - and `devel` branches. - * `improve/...`: Improvements under development that are to be merged into the - `maintenance` and `devel` branches. - * `dev/...` or `feature/...`: New functionality under development that is to be merged - into the `devel` branch. - -There is also the `gh-pages` branch, which holds OctoPrint's web page, and a few -older development branches that are slowly being migrated or deleted. - -## How OctoPrint is versioned - -OctoPrint follows the [semantic versioning scheme](http://semver.org/) of **MAJOR.MINOR.PATCH**. - -The **PATCH** version number will increase in case of hotfix releases [3]. -Releases that only change the patch number indicate that they only contain bug fixes, and usually -only hotfixes at that. Example: 1.5.0 to 1.5.1. - -The **MINOR** version number increases with releases that add new functionality while maintaining -backwards compatibility. Example: 1.4.x to 1.5.0. - -Finally, the **MAJOR** version number increases if there are breaking API changes that concern any of the -documented interfaces (REST API, plugin interfaces, ...). Example: 1.x.y to 2.0.0. - -OctoPrint's version numbers are automatically generated using [versioneer](https://github.com/warner/python-versioneer) -and depend on the selected git branch, nearest git tag and commits. The generated version number -should always be [PEP440](https://www.python.org/dev/peps/pep-0440/) compatible. Unless a git tag -is used for version number determination, the version number will also contain the git hash within -the local version identifier to allow for an exact determination of the active code base -(e.g. `1.2.9.dev68+g46c7a9c`). Additionally, instances with active uncommitted changes will contain -`.dirty` in the local version identifier. +See [the corresponding chapter in the documentation](https://docs.octoprint.org/en/master/development/branches.html). ## History @@ -485,6 +414,7 @@ the local version identifier to allow for an exact determination of the active c * 2018-10-18: Allow PRs against `maintenance` branch for improvements and small new features, suggest getting in touch on the forum for larger changes * 2020-08-10: Update versioning scheme and PR instructions + * 2020-09-23: Move branch & versioning into development docs ## Footnotes * [1] - If you are wondering why, the problem is that anything that you add @@ -496,7 +426,3 @@ the local version identifier to allow for an exact determination of the active c it now would make the history and especially `git blame` completely unusable, so for now we'll have to deal with it (this decision might be revisited in the future). - * [3] - Up until 1.4.2, the PATCH version segment was the one increasing most often - due to OctoPrint's maintenance releases but with 1.5.0 this will *fully* adhere - to the concepts in semantic versioning mandating only bug fixes in patch releases. - Maintenance releases will henceforth increase the MINOR segment. diff --git a/docs/bundledplugins/action_command_notification.rst b/docs/bundledplugins/action_command_notification.rst index aff4d75be..fb3b50277 100644 --- a/docs/bundledplugins/action_command_notification.rst +++ b/docs/bundledplugins/action_command_notification.rst @@ -3,7 +3,9 @@ Action Command Notification support =================================== -The OctoPrint Action Command Notification Support Plugin comes bundled with OctoPrint (starting with 1.4.1). +.. versionadded:: 1.4.1 + +The OctoPrint Action Command Notification Support Plugin comes bundled with OctoPrint. It allows firmware to trigger notifications users with the ``PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW`` permission using :ref:`action commands ` about relevant events. These notifications will be shown diff --git a/docs/bundledplugins/action_command_prompt.rst b/docs/bundledplugins/action_command_prompt.rst index adb8635e4..b4e09d623 100644 --- a/docs/bundledplugins/action_command_prompt.rst +++ b/docs/bundledplugins/action_command_prompt.rst @@ -3,7 +3,9 @@ Action Command Prompt support ============================= -The OctoPrint Action Command Prompt Support Plugin comes bundled with OctoPrint (starting with 1.3.9). +.. versionadded:: 1.3.9 + +The OctoPrint Action Command Prompt Support Plugin comes bundled with OctoPrint. It allows firmware to trigger dialog prompts for logged in users using :ref:`action commands `, e.g. to wait for user acknowledgement or allow the user to choose between options, and also to close the dialog again diff --git a/docs/bundledplugins/announcements.rst b/docs/bundledplugins/announcements.rst index 44dfe63e1..c8104efae 100644 --- a/docs/bundledplugins/announcements.rst +++ b/docs/bundledplugins/announcements.rst @@ -3,7 +3,9 @@ Announcement Plugin =================== -The OctoPrint Announcement Plugin comes bundled with OctoPrint (starting with 1.2.11). +.. versionadded:: 1.2.11 + +The OctoPrint Announcement Plugin comes bundled with OctoPrint. It displays announcements fetched from OctoPrint's websites, such as important updates, release announcements, new plugins and similar. Through some manual configuration via ``config.yaml`` it also allows adding additional channels diff --git a/docs/bundledplugins/appkeys.rst b/docs/bundledplugins/appkeys.rst index 10db23fd5..89bdceec1 100644 --- a/docs/bundledplugins/appkeys.rst +++ b/docs/bundledplugins/appkeys.rst @@ -3,7 +3,9 @@ Application Keys Plugin ======================= -The OctoPrint Application Keys Plugin comes bundled with OctoPrint (starting with version 1.3.10). +.. versionadded:: 1.3.10 + +The OctoPrint Application Keys Plugin comes bundled with OctoPrint. It implements a workflow for third party apps or clients to obtain an application specific API key from OctoPrint to interact with it on a user's behalf, via confirmation of the user through OctoPrint's web interface. Existing keys can be managed diff --git a/docs/bundledplugins/backup.rst b/docs/bundledplugins/backup.rst index db05745df..1d5f78097 100644 --- a/docs/bundledplugins/backup.rst +++ b/docs/bundledplugins/backup.rst @@ -3,6 +3,8 @@ Backup Plugin ============= +.. versionadded:: 1.3.10 + The OctoPrint Backup Plugin comes bundled with OctoPrint (starting with 1.3.10). It allows the creation and restoration of backups of OctoPrint's settings, data and installed plugins [#]_. @@ -74,6 +76,8 @@ plugin_backup_backup_created * ``path``: the path to the backup * ``excludes``: the list of parts excluded from the backup + .. versionadded:: 1.5.0 + .. _sec-bundledplugins-backup-hooks: Hooks @@ -86,6 +90,8 @@ octoprint.plugin.backup.additional_excludes .. py:function:: additional_excludes_hook(excludes, *args, **kwargs) + .. versionadded:: 1.5.0 + Use this to provide additional paths on your plugin's data folder to exclude from the backup. Your handler also get a list of currently excluded sub paths in the base folder, so you can react to them. E.g. exclude things in your data folder that relate to uploaded GCODE files if `uploads` is excluded, or exclude things that relate diff --git a/docs/bundledplugins/discovery.rst b/docs/bundledplugins/discovery.rst index 52314cb5f..36f9911e0 100644 --- a/docs/bundledplugins/discovery.rst +++ b/docs/bundledplugins/discovery.rst @@ -3,7 +3,9 @@ Discovery Plugin ================ -The OctoPrint Discovery Plugin comes bundled with OctoPrint (starting with 1.2.0). +.. versionadded:: 1.2.0 + +The OctoPrint Discovery Plugin comes bundled with OctoPrint. It allows discovery of the OctoPrint instances via SSDP/UPNP. If `pybonjour `_ is installed OctoPrint diff --git a/docs/bundledplugins/errortracking.rst b/docs/bundledplugins/errortracking.rst index f87e7e8b2..71f423430 100644 --- a/docs/bundledplugins/errortracking.rst +++ b/docs/bundledplugins/errortracking.rst @@ -3,6 +3,8 @@ Error Tracking Plugin ===================== +.. versionadded:: 1.3.11 + The Error Tracking plugin will cause any logged exceptions in the server and the browser interface to be sent to OctoPrint's `Sentry instance `_. diff --git a/docs/bundledplugins/file_check.rst b/docs/bundledplugins/file_check.rst index 814066697..7be2b3baf 100644 --- a/docs/bundledplugins/file_check.rst +++ b/docs/bundledplugins/file_check.rst @@ -3,5 +3,7 @@ File Check ========== +.. versionadded:: 1.4.1 + The file check plugin - while considered bundled with OctoPrint - is a separate project on its own release cycle and documented on `its Github repository `_. diff --git a/docs/bundledplugins/firmware_check.rst b/docs/bundledplugins/firmware_check.rst index c7e95facc..e73a3b9ab 100644 --- a/docs/bundledplugins/firmware_check.rst +++ b/docs/bundledplugins/firmware_check.rst @@ -3,5 +3,9 @@ Firmware Check ============== +.. versionadded:: 1.3.7 + The firmware check plugin - while considered bundled with OctoPrint - is a separate project on its own release cycle and documented on `its Github repository `_. + +It was formerly called "Printer Safety Check" and directly bundled with OctoPrint. diff --git a/docs/bundledplugins/gcodeviewer.rst b/docs/bundledplugins/gcodeviewer.rst index 2531f7533..704d04213 100644 --- a/docs/bundledplugins/gcodeviewer.rst +++ b/docs/bundledplugins/gcodeviewer.rst @@ -3,6 +3,8 @@ GCode Viewer Plugin =================== +.. versionchanged:: 1.4.1 + The GCode Viewer plugin provides a GCode viewer based on `Alex Ustyantsev's work `_. .. _fig-bundledplugins-gcodeviewer-example: diff --git a/docs/bundledplugins/logging.rst b/docs/bundledplugins/logging.rst index d06d7915c..86d925fb6 100644 --- a/docs/bundledplugins/logging.rst +++ b/docs/bundledplugins/logging.rst @@ -3,9 +3,9 @@ Logging ======= -The OctoPrint Logging plugin comes bundled with OctoPrint starting with version 1.3.7. +.. versionadded:: 1.3.7 -It implements the log management functionality that was formerly part of the core application and adds features to +The OctoPrint Logging plugin implements the log management functionality that was formerly part of the core application and adds features to configure logging levels for sub modules through the included settings dialog. .. _fig-bundledplugins-logging-settings: diff --git a/docs/bundledplugins/pluginmanager.rst b/docs/bundledplugins/pluginmanager.rst index 2ec1babbb..82eb6f393 100644 --- a/docs/bundledplugins/pluginmanager.rst +++ b/docs/bundledplugins/pluginmanager.rst @@ -3,8 +3,9 @@ Plugin Manager ============== -The OctoPrint Plugin Manager comes bundled with OctoPrint starting with -version 1.2.0. +.. versionadded:: 1.2.0 + +The OctoPrint Plugin Manager comes bundled with OctoPrint. It allows management of installed plugins (listing, enabling, disabling and uninstalling) and installing new plugins from the official diff --git a/docs/bundledplugins/softwareupdate.rst b/docs/bundledplugins/softwareupdate.rst index 0106839e5..ee0cef0d8 100644 --- a/docs/bundledplugins/softwareupdate.rst +++ b/docs/bundledplugins/softwareupdate.rst @@ -3,10 +3,14 @@ Software Update Plugin ====================== +.. versionadded:: 1.2.0 + The Software Update Plugin allows receiving notifications about new releases of OctoPrint or installed plugins which registered with it and -- if properly configured -- also applying the found updates. +It comes bundled with OctoPrint. + .. _sec-bundledplugins-softwareupdate-firststeps: First Steps @@ -163,6 +167,7 @@ types are currently recognized: field in Github release data - release will only be included if the values match. Defaults to being unset, in which case the ``branch`` will be matched. + .. versionadded:: 1.2.16 * ``stable_branch``: Stable channel definition, optional. Structure: * ``branch``: Branch associated with the channel, acts as ID * ``name``: Human readable name of the release channel @@ -170,11 +175,13 @@ types are currently recognized: field in Github release data - release will only be included if the values match. Defaults to being unset, in which case the ``branch`` will be matched. + .. versionadded:: 1.2.16 * ``prerelease_channel``: Release channel to limit updates to. If set only those releases will be included if their ``target_comittish`` matches the ones associated with the release channel identified by this, either included in ``prerelease_channels`` or the ``stable_channel``. Only taken into account if ``prerelease`` is ``true``. + .. versionadded:: 1.2.16 * ``release_compare``: Method to use to compare between current version information and release versions on Github. One of ``python`` (version comparison using ``pkg_resources.parse_version``, newer version detected @@ -208,6 +215,8 @@ types are currently recognized: ``api_user`` to be set. **Important**: Never use your actual Bitbucket login password. Generate a new app password. App passwords are user specific on Bitbucket. + .. versionadded:: 1.3.5 + * ``git_commit``: Checks a local git repository for new commits on its configured remote. Additional config parameters: @@ -219,6 +228,8 @@ types are currently recognized: * ``package``: (mandatory) Name of the package which to check. + .. versionadded:: 1.4.0 + * ``httpheader``: Checks an HTTP header on a defined URL for changes. This can be used for easy checks against things like ``ETag`` or ``Last-Modified`` headers. Additional config parameters: @@ -230,12 +241,16 @@ types are currently recognized: * ``header_prefix``: Prefix to use for the obtained value in the version display. If not provided ``header_name`` will be used. If set to an empty string, no prefix will be added. + .. versionadded:: 1.4.1 + * ``jsondata``: Checks the provided JSON endpoint for changes. The JSON endpoint must return an object with the property ``version``, which should contain the latest version, e.g. ``{"version":"1.2.3"}``. Additional config parameters: * ``jsondata``: (mandatory) URL from which to fetch the JSON data + .. versionadded:: 1.4.1 + * ``command_line``: Uses a provided script to determine whether an update is available. Additional config parameters: @@ -258,12 +273,16 @@ types are currently recognized: * ``current_version``: Version to report for both local and remote version. + .. versionadded:: 1.3.7 + * ``never_current``: Always reports that an update is necessary. Useful for debugging software update mechanisms during development. Additional config parameters: * ``local_version``: Current local version. Defaults to ``1.0.0``. * ``remote_version``: Remote version to offer update to. Defaults to ``1.0.1``. + .. versionadded:: 1.3.7 + .. _sec-bundledplugins-softwareupdate-configuration-updatemethods: Update methods @@ -309,6 +328,8 @@ supported: a countdown in the meantime. Useful for debugging software update mechanisms during development. + .. versionadded:: 1.3.7 + .. note:: To allow default configurations for multiple update methods, if more than one of diff --git a/docs/bundledplugins/tracking.rst b/docs/bundledplugins/tracking.rst index 4864deb6f..8c29a3bac 100644 --- a/docs/bundledplugins/tracking.rst +++ b/docs/bundledplugins/tracking.rst @@ -3,6 +3,8 @@ Anonymous Usage Tracking Plugin =============================== +.. versionadded:: 1.3.10 + The Anonymous Usage Tracking plugin provides valuable insights into how many instances running what versions of OctoPrint are out there, whether they are successfully completing print jobs and various other metrics. diff --git a/docs/bundledplugins/virtual_printer.rst b/docs/bundledplugins/virtual_printer.rst index e4ec0c48e..bc1ba147a 100644 --- a/docs/bundledplugins/virtual_printer.rst +++ b/docs/bundledplugins/virtual_printer.rst @@ -3,6 +3,8 @@ Virtual Printer =============== +.. versionchanged:: 1.4.1 + The Virtual Printer plugin provides a virtual printer to connect to during development. It is able to simulate various firmware quirks, communication issues and can be heavily configured through ``config.yaml``. See :ref:`the development documentation on details and usage `. diff --git a/docs/development/branches.rst b/docs/development/branches.rst new file mode 100644 index 000000000..d2fef6255 --- /dev/null +++ b/docs/development/branches.rst @@ -0,0 +1,75 @@ +.. _sec-development-branches: + +OctoPrint's branching model +=========================== + +There are three main branches in OctoPrint: + +``master`` + The master branch always contains the current stable release plus any changes + since made to *documentation*, *CI related tests* or *Github meta files*. OctoPrint's actual + code will only be modified on new releases. Will have a version number following + the scheme ``..`` (e.g. ``1.5.1``). +``maintenance`` + Improvements and fixes of the current release that make up + the next release go here. More or less continuously updated. You can consider + this a preview of the next release version. It should be very stable at all + times. Anything you spot in here helps tremendously with getting a rock solid + next stable release, so if you want to help out development, running the + ``maintenance`` branch and reporting back anything you find is a very good way + to do that. Will usually have a version number following the scheme + ``..<0>.dev`` for an OctoPrint version of ``..`` + (e.g. ``1.5.0.dev114``). +``devel`` + Ongoing development of what will go into the next big + release (MAJOR version number increases) will happen on this branch. Usually + kept stable, sometimes stuff can break though. Backwards incompatible changes will + be encountered here. Can be considered the "bleeding edge". Will usually have a version + number following the scheme ``.<0>.0.dev`` for a current + OctoPrint version of ``..`` (e.g. ``2.0.0.dev123``). + +There are couple more RC and staging branches that see regular use: + +``staging/hotfix`` + Any preparation for potential hotfix releases takes place here. + Version number follows the scheme ``..`` (e.g. ``1.5.1``) for a current release + of ``..``. +``rc/maintenance`` + This branch is reserved for future releases that have graduated from + the ``maintenance`` branch and are now being pushed on the "Maintenance" + pre release channel for further testing. Version number follows the scheme + ``..rc`` (e.g. ``1.5.0rc1``). +``staging/maintenance`` + Any preparation for potential follow-up RCs takes place here. + Version number follows the scheme ``..rc.dev`` (e.g. + ``1.5.0rc2.dev3``) for a current Maintenance RC of ``..``. +``rc/devel`` + This branch is reserved for future releases that have graduated from + the ``devel`` branch and are now being pushed on the "Devel" pre release channel + for further testing. Version number follows the scheme ``.0.0rc`` (e.g. ``2.0.0rc1``) + for a current stable OctoPrint version of ``..``. +``staging/devel`` + Any preparation for potential follow-up Devel RCs takes place + here. Version number follows the scheme ``.0.0rc.dev`` (e.g. + ``2.0.0rc2.dev12``) for a current Devel RC of ``.0.0rc``. + +Additionally, from time to time you might see other branches pop up in the repository. +Those usually have one of the following prefixes: + +``hotfix/...`` + Hotfixes under development that are to be merged into the ``staging/hotfix`` + and later the ``master`` branch. +``fix/...`` + Fixes under development that are to be merged into the ``maintenance`` + and ``devel`` branches. +``improve/...`` + Improvements under development that are to be merged into the + ``maintenance`` and ``devel`` branches. +``dev/...`` or ``feature/...`` + New functionality under development that is to be merged + into the ``devel`` branch. + +There are also a few older development branches that are slowly being migrated or deleted. + +All these branches and branch patterns are set up to automatically get a correct :ref:`version number ` +generated through versioneer and thus should also be adhered to during development. diff --git a/docs/development/index.rst b/docs/development/index.rst index d8e330da9..249434d25 100644 --- a/docs/development/index.rst +++ b/docs/development/index.rst @@ -7,6 +7,11 @@ Development .. toctree:: :maxdepth: 3 + versioning.rst + branches.rst environment.rst virtual_printer.rst - profiling.rst + request-profiling.rst + +If you are interested in contributing code to OctoPrint, first of all: Thank you! Please make sure to read the +`Contribution Guidelines `_! diff --git a/docs/development/versioning.rst b/docs/development/versioning.rst new file mode 100644 index 000000000..2d9dab4c4 --- /dev/null +++ b/docs/development/versioning.rst @@ -0,0 +1,31 @@ +.. _sec-development-versions: + +OctoPrint's versioning strategy +=============================== + +OctoPrint's version numbers follow `PEP440 `_, with a version format of +**MAJOR.MINOR.PATCH** following the contract of `semantic versioning `_. + +The **PATCH** version number will increase in case of hotfix releases [#f1]_. +Releases that only change the patch number indicate that they only contain bug fixes, and usually +only hotfixes at that. Example: ``1.5.0`` to ``1.5.1``. + +The **MINOR** version number increases with releases that add new functionality while maintaining +backwards compatibility on the documented APIs (both internal and external). Example: ``1.4.x`` to ``1.5.0``. + +Finally, the **MAJOR** version number increases if there are breaking API changes that concern any of the +documented interfaces (REST API, plugin interfaces, ...). Example: ``1.x.y`` to ``2.0.0``. + +OctoPrint's version numbers are automatically generated using a customized version of +`versioneer `_ and depend on the selected git branch, nearest +git tag and commits. Unless a git tag is used for version number determination, the version number will +also contain the git hash within the local version identifier to allow for an exact determination of the +active code base (e.g. ``1.2.9.dev68+g46c7a9c``). Additionally, instances with active uncommitted changes +will contain ``.dirty`` in the local version identifier. + +.. rubric:: Footnotes + +.. [#f1] Up until 1.4.2, the PATCH version segment was the one increasing most often + due to OctoPrint's maintenance releases but with 1.5.0 this will *fully* adhere + to the concepts in semantic versioning mandating only bug fixes in patch releases. + Maintenance releases will henceforth increase the MINOR segment. diff --git a/docs/events/index.rst b/docs/events/index.rst index fe24e847f..1054ba2c2 100644 --- a/docs/events/index.rst +++ b/docs/events/index.rst @@ -109,6 +109,9 @@ ClientOpened **Note:** Name changed in version 1.1.0 + .. versionchanged:: 1.1.0 + .. versionchanged:: 1.4.0 + ClientAuthed A client has authenticated a user session on the push socket. @@ -118,6 +121,8 @@ ClientAuthed valid login session. * ``username``: the name of the user who authed. On the push socket only available with a valid login session. + .. versionadded:: 1.4.0 + ClientClosed A client has disconnected from the push socket. @@ -133,12 +138,16 @@ UserLoggedIn * ``username``: the name of the user who logged in + .. versionadded:: 1.4.0 + UserLoggedOut A user logged out. On the push socket only available with a valid login session with admin rights. Payload: * ``username``: the name of the user who logged out + .. versionadded:: 1.4.0 + ConnectivityChanged The server's internet connectivity changed @@ -147,6 +156,8 @@ ConnectivityChanged * ``old``: Old connectivity value (true for online, false for offline) * ``new``: New connectivity value (true for online, false for offline) + .. versionadded:: 1.3.5 + .. _sec-events-available_events-printer_commmunication: Printer communication @@ -155,6 +166,8 @@ Printer communication Connecting The server is attempting to connect to the printer. + .. versionadded:: 1.3.0 + Connected The server has connected to the printer. @@ -168,6 +181,8 @@ Disconnecting event might not always be sent when the server and printer get disconnected from each other. Do not depend on this for critical life cycle management. + .. versionadded:: 1.3.0 + Disconnected The server has disconnected from the printer @@ -191,6 +206,8 @@ PrinterStateChanged :func:`~octoprint.printer.PrinterInterface.get_state_id` for possible values. * ``state_string``: Text representation of the new state. + .. versionadded:: 1.3.0 + .. _sec-events-available_events-file_handling: File handling @@ -211,6 +228,8 @@ Upload * ``file``: the file's path within its storage location. To be removed in 1.4.0. + .. versionchanged:: 1.4.0 + FileAdded A file has been added to a storage. @@ -226,6 +245,8 @@ FileAdded A copied file triggers this for its new path. A moved file first triggers ``FileRemoved`` for its original path and then ``FileAdded`` for the new one. + .. versionadded:: 1.3.3 + FileRemoved A file has been removed from a storage. @@ -240,6 +261,8 @@ FileRemoved A moved file first triggers ``FileRemoved`` for its original path and then ``FileAdded`` for the new one. + .. versionadded:: 1.3.3 + FolderAdded A folder has been added to a storage. @@ -253,6 +276,8 @@ FolderAdded A copied folder triggers this for its new path. A moved folder first triggers ``FolderRemoved`` for its original path and then ``FolderAdded`` for the new one. + .. versionadded:: 1.3.3 + FolderRemoved A folder has been removed from a storage. @@ -265,6 +290,8 @@ FolderRemoved A moved folder first triggers ``FolderRemoved`` for its original path and then ``FolderAdded`` for the new one. + .. versionadded:: 1.3.3 + UpdatedFiles A file list was modified. @@ -279,6 +306,7 @@ UpdatedFiles reasons of backwards compatibility and will also be sent on modification of ``printables``. It will however be removed with 1.4.0. + .. versionchanged:: 1.4.0 MetadataAnalysisStarted The metadata analysis of a file has started. @@ -293,6 +321,8 @@ MetadataAnalysisStarted * ``file``: the file's path within its storage location. To be removed in 1.4.0. + .. versionchanged:: 1.4.0 + MetadataAnalysisFinished The metadata analysis of a file has finished. @@ -307,6 +337,8 @@ MetadataAnalysisFinished * ``file``: the file's path within its storage location. To be removed in 1.4.0. + .. versionchanged:: 1.4.0 + FileSelected A file has been selected for printing. @@ -321,6 +353,8 @@ FileSelected * ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0. * ``filename``: the file's name. To be removed in 1.4.0. + .. versionchanged:: 1.4.0 + FileDeselected No file is selected any more for printing. @@ -334,6 +368,8 @@ TransferStarted **Note:** Name changed in version 1.1.0 + .. versionchanged:: 1.1.0 + TransferDone A file transfer to the printer's SD has finished. @@ -365,6 +401,8 @@ PrintStarted * ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0. * ``filename``: the file's name. To be removed in 1.4.0. + .. versionchanged:: 1.4.0 + PrintFailed A print failed. @@ -383,6 +421,8 @@ PrintFailed * ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0. * ``filename``: the file's name. To be removed in 1.4.0. + .. versionchanged:: 1.4.0 + PrintDone A print completed successfully. @@ -400,6 +440,8 @@ PrintDone * ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0. * ``filename``: the file's name. To be removed in 1.4.0. + .. versionchanged:: 1.4.0 + PrintCancelling The print is about to be cancelled. @@ -413,6 +455,8 @@ PrintCancelling * ``user``: the user who cancelled the print job (if available) * ``firmwareError``: the firmware error that caused cancelling the print job, if any + .. versionadded:: 1.3.7 + PrintCancelled The print has been cancelled. @@ -443,6 +487,8 @@ PrintCancelled * ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0. * ``filename``: the file's name. To be removed in 1.4.0. + .. versionchanged:: 1.4.0 + PrintPaused The print has been paused. @@ -472,6 +518,8 @@ PrintPaused * ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0. * ``filename``: the file's name. To be removed in 1.4.0. + .. versionchanged:: 1.4.0 + PrintResumed The print has been resumed. @@ -489,6 +537,8 @@ PrintResumed * ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0. * ``filename``: the file's name. To be removed in 1.4.0. + .. versionchanged:: 1.4.0 + .. _sec-events-available_events-gcode_processing: GCODE processing @@ -543,6 +593,8 @@ PositionUpdate * ``t``: last tool selected *through OctoPrint* * ``f``: last feedrate for move commands ``G0``, ``G1`` or ``G28`` sent *through OctoPrint* + .. versionadded:: 1.3.0 + ToolChange A tool change command was sent to the printer. The payload contains the former current tool index and the new current tool index. @@ -552,6 +604,8 @@ ToolChange * ``old``: old tool index * ``new``: new tool index + .. versionadded:: 1.3.5 + .. _sec-events-available_events-timelapses: Timelapses @@ -577,6 +631,8 @@ CaptureFailed * ``file``: the name of the image file that should have been saved * ``error``: the error that was caught + .. versionadded:: 1.3.0 + MovieRendering The timelapse movie has started rendering. @@ -669,6 +725,8 @@ SlicingProfileAdded * ``slicer``: the slicer for which the profile was added * ``profile``: the profile that was added + .. versionadded:: 1.2.12 + SlicingProfileModified A slicing profile was modified. @@ -677,6 +735,8 @@ SlicingProfileModified * ``slicer``: the slicer for which the profile was modified * ``profile``: the profile that was modified + .. versionadded:: 1.2.12 + SlicingProfileDeleted A slicing profile was deleted. @@ -685,6 +745,8 @@ SlicingProfileDeleted * ``slicer``: the slicer for which the profile was deleted * ``profile``: the profile that was deleted + .. versionadded:: 1.2.12 + .. _sec-events-available_events-settings: Settings @@ -696,6 +758,8 @@ SettingsUpdated This event may also be triggered if calling code of :py:class:`octoprint.settings.Settings.save` or :py:class:`octoprint.plugin.PluginSettings.save` sets the ``trigger_event`` parameter to ``True``. + .. versionadded:: 1.2.0 + .. _sec-events-available_events-printer_profile: Printer Profile @@ -707,3 +771,6 @@ PrinterProfileModified Payload: * ``identifier``: the identifier of the modified printer profile + + .. versionadded:: 1.3.12 + diff --git a/docs/features/accesscontrol.rst b/docs/features/accesscontrol.rst index e3f8f03fd..9647d31f9 100644 --- a/docs/features/accesscontrol.rst +++ b/docs/features/accesscontrol.rst @@ -3,6 +3,8 @@ Access Control ============== +.. versionchanged:: 1.4.0 + OctoPrint's bundled access control feature allows granular permission control over which users or user groups are allowed to access which parts of OctoPrint. diff --git a/docs/features/action_commands.rst b/docs/features/action_commands.rst index fe9dde4f8..6e5f8830a 100644 --- a/docs/features/action_commands.rst +++ b/docs/features/action_commands.rst @@ -25,6 +25,8 @@ start When this command is received from the printer, a job is currently selected and *not* active, OctoPrint will start it just like if the "Start"/"Restart" button had been clicked. + .. versionadded:: 1.5.0 + cancel When this command is received from the printer, OctoPrint will cancel a current print job just like if the "Cancel" button had been clicked. diff --git a/docs/features/atcommands.rst b/docs/features/atcommands.rst index a8ead05d2..03d4b863f 100644 --- a/docs/features/atcommands.rst +++ b/docs/features/atcommands.rst @@ -3,6 +3,8 @@ @ Commands ========== +.. versionadded:: 1.3.7 + @ commands (also known as host commands elsewhere) are special commands you may include in GCODE files streamed through OctoPrint to your printer or send as part of GCODE scripts, through the Terminal Tab, the API or plugins. Contrary to other commands they will never be sent to the printer but instead trigger functions inside OctoPrint. diff --git a/docs/features/plugins.rst b/docs/features/plugins.rst index 8e8e26765..f8db01c3d 100644 --- a/docs/features/plugins.rst +++ b/docs/features/plugins.rst @@ -4,6 +4,8 @@ Plugins ******* +.. versionadded:: 1.2.0 + Starting with OctoPrint 1.2.0, there's now a plugin system in place which allows to individually extend OctoPrint's functionality. diff --git a/docs/features/safemode.rst b/docs/features/safemode.rst index 45ec3651c..625b5811e 100644 --- a/docs/features/safemode.rst +++ b/docs/features/safemode.rst @@ -4,6 +4,9 @@ Safe mode ********* +.. versionadded:: 1.3.0 +.. versionchanged:: 1.3.13 + With the advent of support for plugins in OctoPrint, it quickly became apparent that some of the bugs reported on OctoPrint's bug tracker were actually bugs with installed third party plugins or language packs instead of OctoPrint itself. diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index ca1e0e37b..5863c034b 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -207,6 +207,8 @@ octoprint.access.permissions .. py:function:: additional_permissions_hook(*args, **kwargs) + .. versionadded:: 1.4.0 + Return a list of additional permissions to register in the system on behalf of the plugin. Use this to add granular permissions to your plugin which can be configured for users and user groups in the general access control settings of OctoPrint. @@ -261,6 +263,8 @@ octoprint.access.users.factory .. py:function:: user_manager_factory_hook(components, settings, *args, **kwargs) + .. versionadded:: 1.4.0 + Return a :class:`~octoprint.access.users.UserManager` instance to use as global user manager object. This will be called only once during initial server startup. @@ -295,6 +299,8 @@ octoprint.accesscontrol.keyvalidator .. py:function:: acl_keyvalidator_hook(apikey, *args, **kwargs) + .. versionadded:: 1.3.6 + Via this hook plugins may validate their own customized API keys to be used to access OctoPrint's API. ``apikey`` will be the API key as read from the request headers. @@ -326,6 +332,8 @@ octoprint.cli.commands .. py:function:: cli_commands_hook(cli_group, pass_octoprint_ctx, *args, **kwargs) + .. versionadded:: 1.3.0 + By providing a handler for this hook plugins may register commands on OctoPrint's command line interface (CLI). Handlers are expected to return a list of callables annotated as `Click commands `_ to register with the @@ -449,6 +457,8 @@ octoprint.comm.protocol.firmware.info .. py:function:: firmware_info_hook(comm_instance, firmware_name, firmware_data, *args, **kwargs) + .. versionadded:: 1.3.9 + Be notified of firmware information received from the printer following an ``M115``. Hook handlers may use this to react/adjust behaviour based on reported firmware data. OctoPrint parses the received @@ -482,6 +492,8 @@ octoprint.comm.protocol.firmware.capabilities .. py:function:: firmware_capability_hook(comm_instance, capability, enabled, already_defined, *args, **kwargs) + .. versionadded:: 1.3.9 + Be notified of capability report entries received from the printer. Hook handlers may use this to react to custom firmware capabilities. OctoPrint parses the received capability @@ -509,6 +521,8 @@ octoprint.comm.protocol.action .. py:function:: protocol_action_hook(comm_instance, line, action, name='', params='', *args, **kwargs) + .. versionadded:: 1.2.0 + React to a :ref:`action command ` received from the printer. Hook handlers may use this to react to custom firmware messages. OctoPrint parses the received action @@ -553,6 +567,8 @@ This describes actually two hooks: .. py:function:: protocol_atcommandphase_hook(comm_instance, phase, command, parameters, tags=None, *args, **kwargs) + .. versionadded:: 1.3.7 + Trigger on :ref:`@ commands ` as they progress through the ``queuing`` and ``sending`` phases of the comm layer. See :ref:`the gcode phase hook ` for a detailed description of each of these phases. @@ -601,6 +617,8 @@ This actually describes four hooks: .. py:function:: protocol_gcodephase_hook(comm_instance, phase, cmd, cmd_type, gcode, subcode=None, tags=None, *args, **kwargs) + .. versionadded:: 1.2.0 + Pre- and postprocess commands as they progress through the various phases of being sent to the printer. The phases are the following: @@ -754,6 +772,8 @@ octoprint.comm.protocol.gcode.received .. py:function:: gcode_received_hook(comm_instance, line, *args, **kwargs) + .. versionadded:: 1.3.0 + Get the returned lines sent by the printer. Handlers should return the received line or in any case, the modified version of it. If the handler returns None, processing will be aborted and the communication layer will get an empty string as the received line. Note that Python functions will also automatically return ``None`` if an empty @@ -787,6 +807,8 @@ octoprint.comm.protocol.gcode.error .. py:function:: gcode_error_hook(comm_instance, error_message, *args, **kwargs) + .. versionadded:: 1.3.7 + Get the messages of any errors messages sent by the printer, with the leading ``Error:`` or ``!!`` already stripped. Handlers should return True if they handled that error internally and it should not be processed by the system further. Normal processing of these kinds of errors - depending on the configuration of error @@ -824,6 +846,9 @@ octoprint.comm.protocol.scripts .. py:function:: protocol_scripts_hook(comm_instance, script_type, script_name, *args, **kwargs) + .. versionadded:: 1.2.0 + .. versionchanged:: 1.3.7 + Return a prefix to prepend, postfix to append, and optionally a dictionary of variables to provide to the script ``script_name`` of type ``type``. Handlers should make sure to only proceed with returning additional scripts if the ``script_type`` and ``script_name`` match handled scripts. If not, None should be returned directly. @@ -868,6 +893,8 @@ octoprint.comm.protocol.temperatures.received .. py:function:: protocol_temperatures_received_hook(comm_instance, parsed_temperatures, *args, **kwargs) + .. versionadded:: 1.3.6 + Get the parsed temperatures returned by the printer, allowing handlers to modify them prior to handing them off to the system. Handlers are expected to either return ``parsed_temperatures`` as-is or a modified copy thereof. @@ -901,6 +928,8 @@ octoprint.comm.transport.serial.additional_port_names .. py:function:: additional_port_names_hook(candidates, *args, **kwargs) + .. versionadded:: 1.4.1 + Return additional port names (not glob patterns!) to use as a serial connection to the printer. Expected to be ``list`` of ``string``s. @@ -920,6 +949,8 @@ octoprint.comm.transport.serial.factory .. py:function:: serial_factory_hook(comm_instance, port, baudrate, read_timeout, *args, **kwargs) + .. versionadded:: 1.2.0 + Return a serial object to use as serial connection to the printer. If a handler cannot create a serial object for the specified ``port`` (and ``baudrate``), it should just return ``None``. @@ -996,6 +1027,8 @@ octoprint.events.register_custom_events .. py:function:: register_custom_events_hook(*args, **kwargs) + .. versionadded:: 1.3.11 + Return a list of custom :ref:`events ` to register in the system for your plugin. Should return a list of strings which represent the custom events. Their name on the `octoprint.events.Events` object @@ -1024,6 +1057,8 @@ octoprint.filemanager.analysis.factory .. py:function:: analysis_queue_factory_hook(*args, **kwargs) + .. versionadded:: 1.3.9 + Return additional (or replacement) analysis queue factories used for analysing uploaded files. Should return a dictionary to merge with the existing dictionary of factories, mapping from extension tree leaf @@ -1062,6 +1097,8 @@ octoprint.filemanager.extension_tree .. py:function:: file_extension_hook(*args, **kwargs) + .. versionadded:: 1.2.0 + Return additional entries for the tree of accepted file extensions for uploading/handling by the file manager. Should return a dictionary to merge with the existing extension tree, adding additional extension groups to @@ -1098,6 +1135,8 @@ octoprint.filemanager.preprocessor .. py:function:: file_preprocessor_hook(path, file_object, links=None, printer_profile=None, allow_overwrite=False, *args, **kwargs) + .. versionadded:: 1.2.0 + Replace the ``file_object`` used for saving added files to storage by calling :func:`~octoprint.filemanager.util.AbstractFileWrapper.save`. ``path`` will be the future path of the file on the storage. The file's name is accessible via @@ -1130,6 +1169,8 @@ octoprint.filemanager.preprocessor octoprint.plugin.backup.additional_excludes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. versionadded:: 1.5.0 + See :ref:`here `. .. _sec-plugins-hook-plugin-loginui-theming: @@ -1137,6 +1178,8 @@ See :ref:`here `. octoprint.plugin.loginui.theming ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. versionadded:: 1.4.0 + See :ref:`here `. .. _sec-plugins-hook-plugin-pluginmanager-reconnect: @@ -1144,6 +1187,8 @@ See :ref:`here `. octoprint.plugin.pluginmanager.reconnect_hooks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. versionadded:: 1.4.0 + See :ref:`here `. .. _sec-plugins-hook-plugin-softwareupdate-check_config: @@ -1151,8 +1196,39 @@ See :ref:`here `. octoprint.plugin.softwareupdate.check_config ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. versionadded:: 1.2.0 + See :ref:`here `. +.. _sec-plugins-hooks-plugin-printer-additional_state_data + +octoprint.printer.additional_state_data +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. py:function:: additional_state_data_hook(initial=False, *args, **kwargs) + + .. versionadded:: 1.5.0 + + Use this to inject additional data into the data structure returned from the printer backend to the frontend + on the push socket or other registered :ref:`~octoprint.printer.PrinterCallback`s. Anything you return here + will be located beneath ``plugins.`` in the resulting initial and current data push structure. + + The ``initial`` parameter will be ``True`` if this the additional update sent to the callback. Your handler should + return a ``dict``, or ``None`` if nothing should be included. + + .. warning:: + + Make sure to not perform any computationally expensive or otherwise long running actions within these handlers as + you could stall the whole state monitor and thus updates being pushed to the frontend. + + This includes I/O of any kind. + + Cache your data! + + :param boolean initial: True if this is the initial update, False otherwise + :return: Additional data to include + :rtype: dict + .. _sec-plugins-hook-printer-factory: octoprint.printer.factory @@ -1160,6 +1236,8 @@ octoprint.printer.factory .. py:function:: printer_factory_hook(components, *args, **kwargs) + .. versionadded:: 1.3.0 + Return a :class:`~octoprint.printer.PrinterInstance` instance to use as global printer object. This will be called only once during initial server startup. @@ -1191,6 +1269,8 @@ octoprint.printer.estimation.factory .. py:function:: print_time_estimator_factory(*args, **kwargs) + .. versionadded:: 1.3.9 + Return a :class:`~octoprint.printer.estimation.PrintTimeEstimator` subclass (or factory) to use for print time estimation. This will be called on each start of a print or streaming job with a single parameter ``job_type`` denoting the type of job that was just started: ``local`` meaning a print of a local file through the serial connection, @@ -1237,6 +1317,8 @@ octoprint.printer.sdcardupload .. py:function:: sd_card_upload_hook(printer, filename, path, start_callback, success_callback, failure_callback, *args, **kwargs) + .. versionadded:: 1.3.11 + Via this hook plugins can change the way files are being uploaded to the sd card of the printer. Implementations **must** call the provided ``start_callback`` on start of the file transfer and either the ``success_callback`` @@ -1322,6 +1404,8 @@ octoprint.server.api.after_request .. py:function:: after_request_handlers_hook(*args, **kwargs) + .. versionadded:: 1.3.10 + Allows adding additional after-request-handlers to API endpoints defined by OctoPrint itself and installed plugins. Your plugin might need this to further restrict access to API methods. @@ -1337,6 +1421,8 @@ octoprint.server.api.before_request .. py:function:: after_request_handlers_hook(*args, **kwargs) + .. versionadded:: 1.3.10 + Allows adding additional before-request-handlers to API endpoints defined by OctoPrint itself and installed plugins. Your plugin might need this to further restrict access to API methods. @@ -1352,6 +1438,8 @@ octoprint.server.http.access_validator .. py:function:: access_validator_hook(request, *args, **kwargs) + .. versionadded:: 1.3.10 + Allows adding additional access validators to the default tornado routers. Your plugin might need to this to restrict acccess to downloads and webcam snapshots further. @@ -1367,6 +1455,8 @@ octoprint.server.http.bodysize .. py:function:: server_bodysize_hook(current_max_body_sizes, *args, **kwargs) + .. versionadded:: 1.2.0 + Allows extending the list of custom maximum body sizes on the web server per path and HTTP method with custom entries from plugins. @@ -1409,6 +1499,8 @@ octoprint.server.http.routes .. py:function:: server_route_hook(server_routes, *args, **kwargs) + .. versionadded:: 1.2.0 + Allows extending the list of routes registered on the web server. This is interesting for plugins which want to provide their own download URLs which will then be delivered statically @@ -1476,6 +1568,8 @@ octoprint.server.sockjs.authed .. py:function:: socket_authed_hook(socket, user, *args, **kwargs): + .. versionadded:: 1.3.10 + Allows plugins to be notified that a user got authenticated or deauthenticated on the socket (e.g. due to logout). :param object socket: the socket object which is about to be registered @@ -1488,6 +1582,8 @@ octoprint.server.sockjs.register .. py:function:: socket_registration_hook(socket, user, *args, **kwargs): + .. versionadded:: 1.3.10 + Allows plugins to prevent a new :ref:`push socket client ` to be registered to the system. Handlers should return either ``True`` or ``False``. ``True`` signals to proceed with normal registration. ``False`` @@ -1507,6 +1603,8 @@ octoprint.server.sockjs.emit .. py:function:: socket_emit_hook(socket, user, message, payload, *args, **kwargs): + .. versionadded:: 1.3.10 + Allows plugins to prevent any messages to be emitted on an existing :ref:`push connection `. Handlers should return either ``True`` to allow the message to be emitted, or ``False`` to prevent it. @@ -1527,6 +1625,8 @@ octoprint.timelapse.extensions .. py:function:: timelapse_extension_hook(*args, **kwargs) + .. versionadded:: 1.3.10 + Allows extending the set of supported file extensions for timelapse files. Handlers must return a list of additional file extensions. @@ -1553,6 +1653,8 @@ octoprint.ui.web.templatetypes .. py:function:: templatetype_hook(template_sorting, template_rules, *args, **kwargs) + .. versionadded:: 1.2.0 + Allows extending the set of supported template types in the web interface. This is interesting for plugins which want to offer other plugins to hook into their own offered UIs. Handlers must return a list of additional template specifications in form of 3-tuples. @@ -1671,6 +1773,8 @@ This actually describes two hooks: .. py:function:: ui_theming_hook(*args, **kwargs) + .. versionadded:: 1.5.0 + Support theming of the login or recovery dialog, just in case the core UI is themed as well. Use to return a list of additional CSS file URLs to inject into the dialog HTML. @@ -1700,6 +1804,8 @@ octoprint.timelapse.capture.pre .. py:function:: capture_pre_hook(filename) + .. versionadded:: 1.4.0 + Perform specific actions prior to capturing a timelapse frame. ``filename`` will be the future path of the frame to be saved. @@ -1715,6 +1821,8 @@ octoprint.timelapse.capture.post .. py:function:: capture_post_hook(filename, success) + .. versionadded:: 1.4.0 + Perform specific actions after capturing a timelapse frame. ``filename`` will be the path of the frame that should have been saved. diff --git a/src/octoprint/cli/client.py b/src/octoprint/cli/client.py index 01e316319..3dca034a1 100644 --- a/src/octoprint/cli/client.py +++ b/src/octoprint/cli/client.py @@ -216,28 +216,32 @@ def delete(ctx, path, timeout): @click.pass_context def listen(ctx): def on_connect(ws): - click.echo(">>> Connected!") + click.echo("--- Connected!") def on_close(ws): - click.echo(">>> Connection closed!") + click.echo("--- Connection closed!") def on_error(ws, error): click.echo("!!! Error: {}".format(error)) + def on_sent(ws, data): + click.echo(">>> {}".format(json.dumps(data))) + def on_heartbeat(ws): click.echo("<3") def on_message(ws, message_type, message_payload): - click.echo("Message: {}, Payload: {}".format(message_type, json.dumps(message_payload))) + click.echo("<<< {}, Payload: {}".format(message_type, json.dumps(message_payload))) socket = ctx.obj.client.create_socket(on_connect=on_connect, on_close=on_close, on_error=on_error, + on_sent=on_sent, on_heartbeat=on_heartbeat, on_message=on_message) - click.echo(">>> Waiting for client to exit") + click.echo("--- Waiting for client to exit") try: socket.wait() finally: - click.echo(">>> Goodbye...") + click.echo("--- Goodbye...") diff --git a/src/octoprint/plugin/__init__.py b/src/octoprint/plugin/__init__.py index 69ff0c79d..57df7f92f 100644 --- a/src/octoprint/plugin/__init__.py +++ b/src/octoprint/plugin/__init__.py @@ -318,6 +318,27 @@ class PluginSettings(object): :type force: boolean :param trigger_event: Trigger the ``SettingsUpdated`` :ref:`event ` on save. :type trigger_event: boolean + + .. method:: add_overlay(overlay, at_end=False, key=None) + + Adds a new config overlay for the plugin's settings. Will return the overlay's key in the map. + + :param overlay: Overlay dict to add + :type overlay: dict + :param at_end: Whether to add overlay at end or start (default) of config hierarchy + :type at_end: boolean + :param key: Key to use to identify overlay. If not set one will be built based on the overlay's hash + :type key: str + :rtype: str + + .. method:: remove_overlay(key) + + Removes an overlay from the settings based on its key. Return ``True`` if the overlay could be found and was + removed, ``False`` otherwise. + + :param key: The key of the overlay to remove + :type key: str + :rtype: boolean """ def __init__(self, settings, plugin_key, defaults=None, get_preprocessors=None, set_preprocessors=None): @@ -368,17 +389,25 @@ class PluginSettings(object): kwargs.update(preprocessors=self.set_preprocessors) return kwargs + def wrap_overlay(args): + result = list(args) + overlay = result[0] + result[0] = dict(plugins={plugin_key: overlay}) + return result + self.access_methods = dict( - has =("has", prefix_path_in_args, add_getter_kwargs), - get =("get", prefix_path_in_args, add_getter_kwargs), - get_int =("getInt", prefix_path_in_args, add_getter_kwargs), - get_float =("getFloat", prefix_path_in_args, add_getter_kwargs), - get_boolean=("getBoolean", prefix_path_in_args, add_getter_kwargs), - set =("set", prefix_path_in_args, add_setter_kwargs), - set_int =("setInt", prefix_path_in_args, add_setter_kwargs), - set_float =("setFloat", prefix_path_in_args, add_setter_kwargs), - set_boolean=("setBoolean", prefix_path_in_args, add_setter_kwargs), - remove =("remove", prefix_path_in_args, lambda x: x) + has = ("has", prefix_path_in_args, add_getter_kwargs), + get = ("get", prefix_path_in_args, add_getter_kwargs), + get_int = ("getInt", prefix_path_in_args, add_getter_kwargs), + get_float = ("getFloat", prefix_path_in_args, add_getter_kwargs), + get_boolean = ("getBoolean", prefix_path_in_args, add_getter_kwargs), + set = ("set", prefix_path_in_args, add_setter_kwargs), + set_int = ("setInt", prefix_path_in_args, add_setter_kwargs), + set_float = ("setFloat", prefix_path_in_args, add_setter_kwargs), + set_boolean = ("setBoolean", prefix_path_in_args, add_setter_kwargs), + remove = ("remove", prefix_path_in_args, lambda x: x), + add_overlay = ("add_overlay", wrap_overlay, lambda x: x), + remove_overlay = ("remove_overlay", lambda x: x, lambda x: x) ) self.deprecated_access_methods = dict( getInt ="get_int", diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index a2a4bf356..f1bc7765b 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -130,6 +130,9 @@ class ReloadNeedingPlugin(Plugin): class EnvironmentDetectionPlugin(OctoPrintPlugin, RestartNeedingPlugin): + """ + .. versionadded:: 1.3.6 + """ def get_additional_environment(self): pass @@ -342,6 +345,8 @@ class TemplatePlugin(OctoPrintPlugin, ReloadNeedingPlugin): callback and returning ``false`` there if it is detected that the user hasn't yet filled in the wizard step. + .. versionadded:: 1.3.0 + About Plugins may define additional panels into OctoPrint's "About" dialog. Note that with the current implementation further about dialog panels will be sorted alphabetically by their name and sorted after the predefined ones. @@ -353,6 +358,8 @@ class TemplatePlugin(OctoPrintPlugin, ReloadNeedingPlugin): wrapped div and the link in the navigation will have the additional classes and styles applied as defined via the configuration supplied through :func:`get_template_configs`. + .. versionadded:: 1.3.0 + Generic Plugins may also inject arbitrary templates into the page of the web interface itself, e.g. in order to add overlays or dialogs to be called from within the plugin's JavaScript code. @@ -638,6 +645,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): server startup (basically eager caching instead of lazily waiting for the first request). See below for details on this. + + .. versionadded:: 1.3.0 """ # noinspection PyMethodMayBeStatic,PyUnusedLocal @@ -761,6 +770,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): list, tuple: A list or tuple of strings to use in the cache key. Will be joined by OctoPrint using ``:`` as separator and appended to the existing ``ui:::`` cache key. Ignored if ``None`` is returned. + + .. versionadded:: 1.3.0 """ return None @@ -774,6 +785,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): Returns: list: A list of paths to additional files whose modification to track for (in)validating the cache. Ignored if ``None`` is returned. + + ..versionadded:: 1.3.0 """ return None @@ -787,6 +800,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): Returns: list: A list of paths representing the only files whose modification to track for (in)validating the cache. Ignored if ``None`` is returned. + + ..versionadded:: 1.3.0 """ return None @@ -798,6 +813,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): Returns: str: An alternatively calculated ETag value. Ignored if ``None`` is returned (default). + + ..versionadded:: 1.3.0 """ return None @@ -814,6 +831,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): Returns: (list): A list of additional fields for the ETag generation, or None + + ..versionadded:: 1.3.0 """ return default_additional @@ -825,6 +844,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): Returns: int: An alternatively calculated LastModified value. Ignored if ``None`` is returned (default). + + ..versionadded:: 1.3.0 """ return None @@ -849,6 +870,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): Returns: dict: Additional data to persist in the preemptive cache configuration. + + ..versionadded:: 1.3.0 """ return None @@ -865,6 +888,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): Returns: dict: Additional request data to persist in the preemptive cache configuration and to use for request environment construction. + + ..versionadded:: 1.3.0 """ return None @@ -879,6 +904,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): Returns: bool: Whether to suppress a record (True) or not (False, default) + + ..versionadded:: 1.3.0 """ return False @@ -899,6 +926,8 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): (callable) A filter function accepting the ``template_type`` and ``template_key`` of a template and returning ``True`` to keep it and ``False`` to filter it out. If ``None`` is returned, no filtering will take place. + + ..versionadded:: 1.3.0 """ return default_template_filter @@ -1313,6 +1342,8 @@ class BlueprintPlugin(OctoPrintPlugin, RestartNeedingPlugin): See `the documentation for flask.Blueprint.errorhandler `_ and `the documentation for flask.Flask.errorhandler `_ for more information. + + ..versionadded:: 1.3.0 """ from collections import defaultdict def decorator(f): @@ -1669,6 +1700,8 @@ class SettingsPlugin(OctoPrintPlugin): # another=dict(admin_only=dict(path="path"), # field="field"), # path=dict(to=dict(never=dict(return=None)))) + + ..versionadded:: 1.2.17 """ return dict() @@ -1756,6 +1789,8 @@ class SettingsPlugin(OctoPrintPlugin): The default implementation just minimizes the data persisted on disk to only contain the differences to the defaults (in case the current data was persisted with an older version of OctoPrint that still duplicated default data). + + ..versionadded:: 1.3.0 """ import octoprint.util from octoprint.settings import NoSuchSettingsPath @@ -1895,6 +1930,8 @@ class SlicerPlugin(OctoPrintPlugin): For the extension tree format, take a look at the docs of the :ref:`octoprint.filemanager.extension_tree hook `. Returns: (dict) a dictionary containing a valid extension subtree. + + ..versionadded:: 1.3.11 """ from octoprint.filemanager import ContentTypeMapping return dict(model=dict(stl=ContentTypeMapping(["stl"], "application/sla"))) @@ -1909,6 +1946,8 @@ class SlicerPlugin(OctoPrintPlugin): Arguments: profile_path (str): The base folder where OctoPrint stores this slicer plugin's profiles + + ..versionadded:: 1.3.7 """ try: @@ -1930,6 +1969,9 @@ class SlicerPlugin(OctoPrintPlugin): # noinspection PyMethodMayBeStatic def get_slicer_profiles_lastmodified(self, profile_path): + """ + ..versionadded:: 1.3.0 + """ import os try: from os import scandir diff --git a/src/octoprint/plugins/action_command_notification/templates/action_command_notification_settings.jinja2 b/src/octoprint/plugins/action_command_notification/templates/action_command_notification_settings.jinja2 index 64f676176..a5d079b9b 100644 --- a/src/octoprint/plugins/action_command_notification/templates/action_command_notification_settings.jinja2 +++ b/src/octoprint/plugins/action_command_notification/templates/action_command_notification_settings.jinja2 @@ -1,6 +1,6 @@

{{ _('Action Command Notification Settings') }}

-
+