Commit Graph

26 Commits

Author SHA1 Message Date
Fabio Manganiello 59c693d6a0
[#394] All `manifest.yaml` converted to `manifest.json`.
YAML isn't part of the Python standard library, while JSON is.

If we want `setup.py` to dynamically parse the available integration
manifest files in order to populate the extra dependencies, then it's
better to rely on a JSON format for manifest files - the parser is part
of the standard library and it doesn't require the user to install
`pyyaml` before `platypush`.
2024-05-17 02:21:57 +02:00
Fabio Manganiello 3d2ee5d6bb
Replaced some new typing `|` notations with `Union`.
continuous-integration/drone/push Build is passing Details
The `|` notation breaks on Python < 3.10.
2024-01-07 00:52:24 +01:00
Fabio Manganiello edd92b8467
Fix: Ensure that components cache keys are ordered before dumping to file.
continuous-integration/drone/push Build is passing Details
Reason: The CI/CD automation regenerates the cache file, and commits
the changes if it differs from the previous version.

The only way to ensure semantic equivalence is to sort the keys upon
dump.
2024-01-06 22:50:34 +01:00
Fabio Manganiello 6e1ab92298
New components cache management.
continuous-integration/drone/push Build is passing Details
The cache is no longer generated at runtime when the application runs -
which may take quite a while, especially on fresh installations.

A `components.json.gz` file is instead generated by the CI/CD process on
every commit to the main branch, and distributed with the package.

The application will read this file when the `inspect` plugin is first
initialized.

This also means that we can no longer cache the `install_cmds`, as they
change depending on the target OS. A new
`application.get_install_commands` action has now been made available to
the UI, so it can get the correct installation commands at runtime.
2024-01-06 22:21:59 +01:00
Fabio Manganiello ef885e096f
Added `inspect.get_pkg_managers` internal action.
It will be used by the UI to put together the installation commands.
2024-01-06 03:02:31 +01:00
Fabio Manganiello c7acc03c8f
[`inspect`] Added `get_enabled_plugins` and `get_enabled_backends` actions. 2023-10-18 22:10:32 +02:00
Fabio Manganiello 53bdcb9604
A major rewrite of the `inspect` plugin.
- The `inspect` plugin and the Sphinx inspection extensions now use the
  same underlying logic.

- Moved all the common inspection logic under
  `platypush.common.reflection`.

- Faster scanning of the available integrations and components through a
  pool of threads.

- Added `doc_url` parameters.

- Migrated events and responses metadata scanning logic.

- Now expanding some custom Sphinx tag instead of returning errors when
  running outside of the Sphinx context - it includes `:class:`,
  `:meth:` and `.. schema::`.
2023-10-09 01:33:45 +02:00
Fabio Manganiello 3e8d6bb01e Removed `typing-extensions` dependency.
continuous-integration/drone/push Build is failing Details
The package isn't present on older versions of Debian.
2023-09-18 14:05:39 +02:00
Fabio Manganiello 2e004c1a1e
`get_all_plugins` should use `Message.Encoder` for encoding the response.
continuous-integration/drone/push Build is passing Details
Some plugin information may include enums, tuples and other types that
aren't serializable by the default JSON serializer.
2023-09-17 02:11:52 +02:00
Fabio Manganiello 1cb686bdab
Updated the `inspect` plugin to the new manifest utils interface. 2023-08-19 13:31:48 +02:00
Fabio Manganiello 98e9abde18
Extended manifest files with Python system packages (if available).
continuous-integration/drone/push Build is passing Details
- If a Python optional dependency is available as a system package on
  the target system, try and install it that route rather than pip. It's
  usually faster and it decreases the risk of breaking system packages.

- Added support for apk dependencies in manifest files. This brings the
  number of distros officially supported by all the extensions to four:

  - Alpine
  - Arch
  - Debian
  - Ubuntu
2023-08-16 22:43:51 +02:00
Fabio Manganiello 4062ddbcf0
More improvements to the `inspect` plugin.
continuous-integration/drone/push Build is passing Details
- Support for distinct `type` field on constructor and method arguments.

- Added `has_varargs` field.

- Added `required` field.

- Better logic for parsing arguments `default` values.
2023-08-08 20:47:27 +02:00
Fabio Manganiello 9beb0a7af3
Skip `:type:` annotations from docstring args documentation. 2023-08-08 20:47:27 +02:00
Fabio Manganiello 2a30f060b4
Parse the arguments list from `obj_type.__init__.__doc__` too. 2023-08-08 20:47:27 +02:00
Fabio Manganiello 5e5403287e
The `inspect` plugin should not fail hard if the cache couldn't be loaded.
This can happen for many reasons - not only if the cache file is not
accessible, but also if the structure/signature of some pickled objects
has changed. In that case, we should invalidate the current cache and
re-initialize it instead of failing.
2023-06-28 01:33:12 +02:00
Fabio Manganiello a7aabd7c52
Fixed handling of `:meth:` docstring annotations with relative paths. 2023-05-22 16:32:30 +02:00
Fabio Manganiello d7405ad05d
Added multiple parsers for the entities referenced in docstrings.
The `inspect` plugin can now detect references to plugins, backends,
events, responses and schemas in docstrings and replace them either with
links to the documentation or auto-generated examples.
2023-05-22 02:20:58 +02:00
Fabio Manganiello b91c1eba6d
Parse `:return:` definitions from action docstrings too. 2023-05-21 03:05:19 +02:00
Fabio Manganiello 27d4a20418
Use reflection to infer the arguments of a Python user procedure 2023-05-17 17:17:59 +02:00
Fabio Manganiello 61ea3d79e4
Large refactor for the `inspect` plugin.
More common logic has been extracted and all the methods and classes
have been documented and black'd.
2023-05-17 00:05:22 +02:00
Fabio Manganiello 8447f9a854
Improved rendering of actions/arguments documentation.
The frontend now calls `utils.rst_to_html` to render the docstrings as
HTML instead of dumping them as raw text.

Also, actions and arguments are now cached to improve performance.
2023-05-14 15:06:34 +02:00
Fabio Manganiello 3c83e7f412
A faster implementation for the `inspect.get_*` methods.
Plugin/backend lookup is now done by inspecting the manifest files
instead of searching all the subpackages.
2023-05-13 13:44:46 +02:00
Fabio Manganiello 41233138ff
Blackened `inspect` module and extracted model defs to adjacent module. 2023-05-09 21:58:02 +02:00
Fabio Manganiello fdf6d8fb4e
Better auto-generated documentation and fixed docstring warnings 2022-03-03 20:26:25 +01:00
Fabio Manganiello 1914322fda
FIX: get_plugin methods should never swallow errors in case of failed initialization 2022-02-07 01:47:38 +01:00
Fabio Manganiello 3bfc5b83ef Moved to manifest files for describing plugins and backends and their dependencies 2021-09-16 17:53:40 +02:00