Commit graph

3217 commits

Author SHA1 Message Date
2c37596478
Updated UI files 2023-10-19 19:52:50 +02:00
dependabot[bot]
569db13a9b
Bump @babel/traverse in /platypush/backend/http/webapp
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.8 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-19 11:30:24 +00:00
4c6d966038 [Doc fix] Fixed indent in the documentation of the application.install action. 2023-10-19 12:13:08 +02:00
7eaf8dbdc0
[Automatic] Updated UI files 2023-10-18 22:53:48 +00:00
38c5172316
[UI] Show the connected/disconnected status in the Nav icon. 2023-10-19 00:33:17 +02:00
f3c5c2fdfa
[Extensions UI] Added RestartButton to the Install tab.
It should be possible to easily restart the service after installing the
dependencies for a new integration.
2023-10-18 23:52:49 +02:00
b724e80ee2
[Settings UI] Added Stop and Restart application buttons. 2023-10-18 23:45:46 +02:00
2a76a6baa6
[Extensions UI] Added current config to extension panel.
If an extension is configured and enabled, then the UI will now include
a tick next to its name and the currently loaded configuration in the
`Configuration` tab.
2023-10-18 22:51:30 +02:00
f0255549c8
[utils] Added utils.to_yaml action. 2023-10-18 22:50:52 +02:00
c7acc03c8f
[inspect] Added get_enabled_plugins and get_enabled_backends actions. 2023-10-18 22:10:32 +02:00
c05d887551
[application] Added application.install action.
It can be used to programmatically install extensions.
2023-10-18 19:33:00 +02:00
e2e349a2ad
[Automatic] Updated UI files 2023-10-18 01:01:06 +00:00
922297bf58
[Extensions UI] Support for initializing an extension from URL. 2023-10-18 03:00:54 +02:00
137855b4fc
[Entities UI] Fixed collapse toggling logic. 2023-10-18 03:00:54 +02:00
26b912fae4
[Execute UI]
- If an action is passed over the URL, then initialize the UI with it.

- Added link from the actions back to their plugins.
2023-10-18 03:00:54 +02:00
e5d84242bb
[Extensions UI] Action URLs now point to the Execute panel. 2023-10-18 03:00:53 +02:00
6f01c35a0f
[UI] Added utilities to get and set args on the URL fragment. 2023-10-18 03:00:53 +02:00
a30c07fbb5
[Execute UI] Make sure that the list of arguments doesn't overflow. 2023-10-18 03:00:53 +02:00
0c54c8f885
[UI] Refresh the loaded panel when the URL fragment changes. 2023-10-18 03:00:53 +02:00
6289eb47ab
[Extensions UI] Added Actions and Events sections to Doc. 2023-10-18 03:00:53 +02:00
6383030e96
[Extensions UI] Added notifications in case of install errors. 2023-10-18 03:00:52 +02:00
3107df5eba
[UI Nav] Moved Extensions panel from the plugins list to the footer. 2023-10-18 03:00:52 +02:00
81e99a0e22
[shell] Better buffering for the output sent to websockets. 2023-10-18 03:00:52 +02:00
a652bd9df8
[Extensions UI] Install extensions deps from the UI.
- Added `Install` button
- Added interactive output panel
2023-10-18 03:00:52 +02:00
033317e0a7
[Extensions UI] Passing config_file to the configuration tab. 2023-10-18 03:00:51 +02:00
66cba233e5
[config] Added config.get_config_file action. 2023-10-18 03:00:51 +02:00
20a2203e7e
[Shell plugin] Added support for async output over websockets. 2023-10-18 03:00:51 +02:00
2806e943c3
[Extensions UI] Added Install tab. 2023-10-18 03:00:51 +02:00
e40a74f11c
Added install_cmds to the JSON representation of a manifest. 2023-10-18 03:00:50 +02:00
9769520e88
[UI] Use .min.css file for the Highlight.js styles. 2023-10-18 03:00:50 +02:00
3366732fa8
[UI] Expand Tab width on mobile. 2023-10-18 03:00:50 +02:00
12f7b190b9
[Automatic] Updated UI files 2023-10-16 00:30:42 +00:00
99e98f70f4
[Integrations UI] Added configuration tab. 2023-10-16 02:30:30 +02:00
b19725c72c
[Automatic] Updated UI files 2023-10-15 23:18:08 +00:00
398d64c53f
[Integrations UI] Added new Integrations panel. 2023-10-16 01:16:10 +02:00
0055acad9d
[UI] Fixed Autocomplete behaviour on empty filter. 2023-10-16 01:12:56 +02:00
c88a9da3e6
[UI] Refactored layout classes. 2023-10-16 01:12:05 +02:00
d1afb88b80
[Reflection] Expand RST extensions from object docstrings too. 2023-10-16 00:21:49 +02:00
0fe1c2768b
[Fix] Some minor docstring indentation fixes. 2023-10-16 00:20:39 +02:00
e242b2134e
[Automatic] Updated UI files 2023-10-14 12:38:25 +00:00
3cfd72b649
[UI Nav] Ensure that entities and execute tabs are always on top. 2023-10-14 14:38:08 +02:00
6d53a3f80f
[Automatic] Updated UI files 2023-10-14 12:09:13 +00:00
a3643c285e
[UI] A friendlier representation of an integration's name. 2023-10-14 14:02:17 +02:00
0aecb50590
[Entities UI] Don't hide variables with null values.
Otherwise, the `variables` panel will still appear, but empty, and
offering no way of actually removing or resetting those variables.
2023-10-14 14:02:17 +02:00
01c7d230f1
[Entities UI] Added Expand/Collapse and Hide actions to groups.
Also, replaced all the deprecated `::v-deep` SCSS notations with
`:deep`.
2023-10-14 14:02:17 +02:00
dbe19042bc
[Automatic] Updated UI files 2023-10-13 21:13:00 +00:00
891e05a219
[Execute UI] Added syntax highlight to JSON and shell snippets. 2023-10-13 23:12:04 +02:00
8b9ac59167
parse_numpy should also catch AttributeError. 2023-10-12 03:24:03 +02:00
12f38281e1
[Automatic] Updated UI files 2023-10-12 00:58:53 +00:00
e382ad7650 Invert @ensure_initialized and @action annotations.
Otherwise, we won't be able to access the wrapped function from the
inspection logic.
2023-10-12 00:57:31 +00:00
0a13b4605e
[Execute panel] Procedures merged into actions.
Plus, a last big refactor/redesign for the panel's components.
2023-10-12 02:49:51 +02:00
e760f8e23a
[Execute panel] Introduced a common Response component. 2023-10-11 16:57:04 +02:00
b47e729012
[Execute panel] Added cURL snippet modal. 2023-10-11 16:38:38 +02:00
fc21e9740b
[Execute panel] Better rendering of responses and errors. 2023-10-11 15:28:49 +02:00
21820bb185
Big refactor of the Execute panel. 2023-10-11 14:31:46 +02:00
1b6e9b4df9
Fixed a broken docstring reference. 2023-10-10 22:18:36 +02:00
ff07623803
Auto-focus the first parameter after selecting an action. 2023-10-10 21:31:14 +02:00
07f0535504
Migrated Execute panel to the new Autocomplete widget. 2023-10-10 21:13:54 +02:00
a717235453
Added autofocus support to Autocomplete element. 2023-10-10 20:51:09 +02:00
923eb7cadb
Autocomplete is now its own component. 2023-10-10 18:42:41 +02:00
f6bf9438b9
Several improvements for the Execute panel. 2023-10-10 01:45:35 +02:00
434855ffdd
A better logic to process relative references in docstrings. 2023-10-10 01:35:37 +02:00
5726c6985f
Added utility function to get the defining class of a method. 2023-10-10 01:35:01 +02:00
2af304f478
Replaced radio buttons on the Execute panel with buttons. 2023-10-10 00:40:20 +02:00
84efef710e
Added Tabs and Tab UI elements. 2023-10-10 00:39:27 +02:00
0c818d3fe0
.. schema:: JSON arguments should be comma-separated. 2023-10-10 00:38:23 +02:00
b225b056b0
ParseContext should also process kwonlyargs. 2023-10-10 00:37:08 +02:00
52e353dc14
Expose the wrapped function in @action.
Added a `wrapped` "hidden" parameter to the function returned by the
`@action` decorator.

We need this to access the underlying decorated function when e.g. we
need to access its specs or decorators.
2023-10-09 22:35:08 +02:00
1e93af86f4
Fixed some broken docstring references. 2023-10-09 01:33:45 +02:00
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
9acd71944c
Skip numpy types serialization errors on Message.Encoder. 2023-10-09 01:33:45 +02:00
e5a5ac5ffb
Added doc_url parameter to integration metadata. 2023-10-09 01:33:45 +02:00
d872835093
New API to check if a table class exists before defining it.
- Check if it's part of the metadata through a function call rather than
  checking `Base.metadata` in every single module.

- Make it possible to override them (mostly for doc generation logic
  that needs to be able to import those classes).

- Make it possible to extend them.
2023-10-09 01:33:44 +02:00
608844ca0c
[WIP] Large refactor of the inspection plugin and models. 2023-10-09 01:33:44 +02:00
841643f3ff
Added cachedir to configuration. 2023-10-09 01:33:44 +02:00
40557f5d5d
Replaced one more occurrence of <type> | None syntax. 2023-10-09 01:33:44 +02:00
4da3c13976
First WIP commit for the new Integrations panel. 2023-10-09 01:33:44 +02:00
4d52fd35b9
Skip None responses in the RSS plugin. 2023-10-04 22:08:11 +02:00
40d3ad1150
Removed <type> | None type hints.
They break on Python < 3.10.
2023-10-03 01:15:13 +02:00
3086dd86fc
LINT+Black+stability fixes for some plugins that hadn't been touched in a while.
- media.mplayer
- media.omxplayer
- media.vlc
- music.mpd
- music.snapcast
2023-10-01 22:55:06 +02:00
2aefc4e5c8
Several improvements for the Google integrations.
1. Improved documentation. Every plugin now reports the exact steps to
   get the integration up and running with the right API scopes.

2. All Google plugins now have a standard process to get (and reuse) the
   client secret. Except for PubSub, Translate and Maps (which have
   their own flows), all the Google plugins now read the client secrets
   from `<WORKDIR>/credentials/google/client_secret.json` by default.

3. Black/LINT for some of those plugins, which hadn't been touched in a
   while.

4. The interface to pass API scopes is now leaner. It's now possible to
   pass a scope directly as e.g. `calendar.readonly` rather than
   `https://www.googleapis.com/auth/calendar.readonly`.

5. Improved the logic to retrieve the right scope tokens file. If e.g.
   an integration requires the role `A`, and a credentials file exists
   for the roles `A` and `B`, then this file will be used rather than
   prompting the user to authenticate again.
2023-10-01 15:37:20 +02:00
5ca3757834
A more readable configuration for the calendar plugin.
The old type configuration
(`platypush.plugins.calendar.name.CalendarNamePlugin`) is a bit clunky.

Instead, since the type will always be a plugin, we should encourage
the use of `calendar.name` directly to identify the type.
2023-10-01 01:09:15 +02:00
966a6ce29e
httplib2 should be an explicit dependency for Google integrations.
Plus, some misc LINT/Black chores.
2023-10-01 00:52:59 +02:00
a7bb81553c
Regex fix. 2023-09-30 15:11:09 +02:00
9e489bb5cf
Propagate the default/required properties of a parameter upon merge. 2023-09-30 14:57:11 +02:00
1732bfa82c
Fixed _default_docstring regex. 2023-09-30 14:36:08 +02:00
532f5479b3
Added full YAML example for chat.irc configuration. 2023-09-30 14:34:54 +02:00
ecffbf29bf
Skip vararg/varkw parameters from the config snippet. 2023-09-30 13:53:33 +02:00
4f5ccda353
Better documentation for the calendar plugin. 2023-09-30 13:31:41 +02:00
c82f7bbfbe
Ignore the default docstring text for __init__.
If no docstring is specified for a constructor, Python usually pre-fills
a standard text - "Initialize self. See help(type(self))".

We don't need this default text in our plugins documentation.
2023-09-30 13:29:49 +02:00
15d06fa5c2
Improved docstring parser logic. 2023-09-30 12:35:31 +02:00
343972b520
New IntegrationMetadata generic util class.
This object is in charge of parsing all the metadata of a
plugin/backend.
2023-09-30 02:28:20 +02:00
905d6632e0
Misc documentation improvements. 2023-09-29 18:09:15 +02:00
0a3ec4b9f1
Merge branch 'master' into 311/auto-generate-deps-docs 2023-09-28 01:25:29 +02:00
b76f141b61
Catch response write errors in the MQTT callback.
If the client that forwarded the request is no longer available (either
because an exception or a timeout was raised) then its I/O buffer and
event loop may be closed.

In this case, the response callback should handle and report the
exception, and still set the event, so that any other threads waiting
for the response can move on.
2023-09-27 11:23:55 +02:00
ca7f042ccc
We shouldn't call dateutil.parser if t has already been deserialized to a datetime. 2023-09-27 11:20:10 +02:00
c311987741
Removed typing.Final from some of the most commonly used modules.
`typing.Final` is not defined on Python < 3.8.
2023-09-26 23:50:10 +02:00
9298f52443
Moved BluetoothPlugin to __init__.py.
This is for consistency with other plugins, that all have their main
plugin class definition inside of `__init__.py`.
2023-09-24 19:21:53 +02:00
c3337ccc6c
[#311] Docs deps autogen sphinx plugin.
Added an `add_dependencies` plugin to the Sphinx build process that
parses the manifest files of the scanned backends and plugins and
automatically generates the documentation for the required dependencies
and triggered events.

This means that those dependencies are no longer required to be listed
in the docstring of the class itself.

Also in this commit:

- Black/LINT for some integrations that hadn't been touched in a long
  time.

- Deleted some leftovers from previous refactors (deprecated
  `backend.mqtt`, `backend.zwave.mqtt`, `backend.http.request.rss`).

- Deleted deprecated `inotify` backend - replaced by `file.monitor` (see
  #289).
2023-09-24 17:00:08 +02:00
059f7a4b11 Merge branch 'master' into 316/rpm-support 2023-09-23 16:21:48 +02:00
2b981f6b68
Added python-croniter dependency to Fedora.
Plus, some clean up of the variables on .drone.yaml.
2023-09-23 16:20:28 +02:00
b797add90d
Modify shebang header for Mercury JS script.
The RPM build process wants an absolute path.
2023-09-23 16:16:13 +02:00
a872d6f554
Added Fedora to the available Docker base images. 2023-09-22 19:02:13 +02:00
79e24461cb
Coalesce to empty list if zigbee.mqtt.devices returns null. 2023-09-22 17:00:53 +02:00
55965e962c
Store the Philips Hue bridge configuration under our workdir.
By default, the `phue` library will store the file containing the token
and the bridge configuration under `~/.python_hue`.

That's outside of our application folder, and it can't easily be copied
around or added to Docker volumes.

We should instead have it under `<WORKDIR>/light.hue/config.json`, in
line with what the other plugins do, and if `~/.python_hue` is available
but `<WORKDIR>/light.hue/config.json` isn't then we should copy the
legacy file to the new one.
2023-09-22 16:58:44 +02:00
761f2768cb
[#316] Added RPM dependencies. 2023-09-21 23:20:06 +02:00
453b6becae
FIX: We shouldn't expand cfgfile if it's empty. 2023-09-21 01:18:15 +02:00
bdbe263905
Added croniter to system dependencies.
The python-croniter package has now been added both to Arch's and
Debian's official repos, so we can install it via pacman or apt rather
than pip.
2023-09-21 01:07:49 +02:00
648b4224bb
[#285] Removed old covid19 backend.
Those endpoints aren't even working anymore.

Closes: #285
2023-09-21 00:26:35 +02:00
5d6d37785e
[#288] Removed legacy http.poll backend.
Closes: #288
2023-09-20 23:53:12 +02:00
7ba9a8930a
[#291] Removed deprecated light.hue backend.
Closes: #291
2023-09-20 23:46:40 +02:00
a6efaad26d
[#306] Removed Travis CI integration.
I've tried my best to keep it around, but the endpoints seem to be
broken, they no longer have a link to their API v3 documentation, and
the API Explorer that was supposed to be in the dashboard is gone.
2023-09-20 23:31:58 +02:00
3970470e17 Removed typing-inspect dependenccy 2023-09-18 14:25:50 +02:00
3e8d6bb01e Removed typing-extensions dependency.
The package isn't present on older versions of Debian.
2023-09-18 14:05:39 +02:00
07c88c9530
Added logic to prevent socket leakage from paho-mqtt upon client stop. 2023-09-17 23:43:56 +02:00
3f4168eb69
Support for new Quality enumeration constants on tidalapi. 2023-09-17 22:40:26 +02:00
c6cda86b1c
LINT/regex fix for ESP plugin. 2023-09-17 17:10:40 +02:00
4c4a33dc7c
Added Bluetooth example configuration to sample config.yaml. 2023-09-17 03:25:21 +02:00
46167a6c2a
Removed legacy zwave backend. 2023-09-17 02:46:24 +02:00
190cfa21b5
Fixed documentation references to some non-existing events. 2023-09-17 02:41:55 +02:00
0421325b26
Support to register/unregister custom handlers on the bus. 2023-09-17 02:29:11 +02:00
2e004c1a1e
get_all_plugins should use Message.Encoder for encoding the response.
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
fa2b84a269
Updated example configuration for mqtt and mqtt-based plugins. 2023-09-16 15:26:07 +02:00
2fcd623c51
Migrated zwave.mqtt integration.
Merged the zwave.mqtt plugin with the listener and removed the
leftovers of the legacy zwave plugin.
2023-09-16 03:58:19 +02:00
52cb1afb4b
Don't break words in entity value frames. 2023-09-16 02:58:17 +02:00
e947cb1e67
Updated web dist files 2023-09-15 16:22:40 +02:00
4223576016
We should always update the entities cache on addEntity.
Updating the entity cache only when we receive an event from a root
entity means that we lose events sent by individual child entities.
2023-09-15 00:45:38 +02:00
1020b63da7
All EntityMixin components should be allowed to emit loading events. 2023-09-15 00:34:29 +02:00
2c93049ee5
Catch all the exceptions in a plugin action wrapper.
The @action decorator should capture all the exceptions,
log them and return them on `Response.errors`.

This ensures that uncaught exceptions from plugin
actions won't unwind out of control, and also that they
are logged and treated consistently across all the
integrations.
2023-09-14 23:08:23 +02:00
ac72b2f7a8
Fixed management of state on zigbee.mqtt.
Before the merge of the plugin and the listener those components
used to have their own separate state, which led to inconsistencies.
2023-09-14 23:05:27 +02:00
5a514fdcce
Only support the run_topic logic on the MQTT plugin.
Plugins that extend `MqttPlugin` shouldn't run messages as
requests, even if the parent MQTT plugin is configured to
do so.
2023-09-14 01:09:03 +02:00
4cb5aa7acb
Prepend the class name to the string used to generate the MQTT client_id hash.
If we include the class name by default then we won't have to
explicitly modify the client_id in the implementation classes
in order to prevent clashes.
2023-09-14 01:06:53 +02:00
3104a59f44
Better processing of configuration file parameters.
- Do `abspath`+`expanduser` on the configuration file path before
  checking if it exists.

- If the path doesn't exist, but the user explicitly passed a
  configuration file, then copy/create the default configuration
  under the specified directory.
2023-09-14 00:24:52 +02:00
ddd8f1afdc
base_topic param in zigbee.mqtt renamed to topic_prefix.
This is for sake of consistency with other integrations (like
`zwave.mqtt`) that also use the same parameter name for the MQTT topic
prefix.
2023-09-07 21:32:56 +02:00
8ab7b6bebc
Removed deprecated zigbee.mqtt backend.
Closes: #322
2023-09-06 02:54:48 +02:00
3de510da68
Migrated zigbee.mqtt integration.
The plugin has been migrated to the new `mqtt` API and the legacy
listener that extended `MqttBackend` has been removed and merged into
the plugin.
2023-09-06 02:44:56 +02:00
33a1ef39e4
Refactored and merged backend.mqtt logic into mqtt plugin. 2023-09-06 02:43:45 +02:00
b746d0b402
Moved get_message_response to platypush.utils.
It is general-purpose enough to be used by all the integrations, not
only by the HTTP backend.
2023-09-05 13:03:30 +02:00
f1acff00e9
Put the join back on CommandStream.__exit__.
We want to give the process a bit of slack between the terminate and the
close, or we'll be guaranteed to get race conditions upon close.
2023-09-04 11:01:34 +02:00
b3c82fe0d1
More resilient termination logic for CommandStream. 2023-09-04 02:47:18 +02:00
c69f97c0a5
Updated default config.yaml.
The new configuration:

- Enables `backend.http` by default
- Removes the extra `config.auto.yaml` dependency
- Includes many more examples, lots of updates for existing examples,
  and extensive comments.
2023-09-04 02:22:46 +02:00
07c2eee890
Changed (fixed) default location for config dir if not existing.
Following some common UNIX conventions, if no configuration file is
specified and none exists under the default locations, then a new
configuration directory should be created under:

```
- if root: /etc/platypush
- else:
  - if XDG_CONFIG_HOME:
    - $XDG_CONFIG_HOME/platypush
  - else:
    - ~/.config/platypush
```
2023-09-04 02:19:13 +02:00
b6c0ff799b
Rewritten the http.webpage plugin. 2023-09-03 17:33:25 +02:00
669f2eb2d2
LINT/black for tts.mimic3 plugin. 2023-09-02 12:40:34 +02:00
snyk-bot
46c40f6fa6
fix: upgrade sass from 1.64.2 to 1.65.1
Snyk has created this PR to upgrade sass from 1.64.2 to 1.65.1.

See this package in npm:
https://www.npmjs.com/package/sass

See this project in Snyk:
https://app.snyk.io/org/blacklight/project/96bfd125-5816-4d9e-83c6-94d1569ab0f1?utm_source=github&utm_medium=referral&page=upgrade-pr
2023-09-01 23:15:47 +00:00
35416f3ee3
Some LINT on the old http.request.rss plugin. 2023-09-02 01:01:16 +02:00
9aaf2559fa
Added utils.is_root method. 2023-08-31 23:21:32 +02:00
e6b5abe909
Added SIGTERM handler for clean termination in Docker contexts. 2023-08-31 02:09:23 +02:00
4dd713ffd2
Refactored Platydock and Platyvenv.
The two scripts now share the same command interface, behaviour and base
class.

Also, Platydock now builds a Docker image instead of just printing a
Dockerfile, unless the `--print` option is passed.
2023-08-31 01:16:56 +02:00
429658e7c8
Refactored PackageManager classes.
Instead of having a custom `get_installed` callable field, with
replicated code for each package manager, the field has now been
promoted to a class method containing the common logic, and the
instances now expect a `list` field (base command to list the installed
packages using the specified package manager) and a `parse_list_line`
callback field (to extract the base package name given a raw line from
the command above).

Also, we shouldn't run the list command if we're running within a Docker
context - the host and container environments will be different.
2023-08-28 01:26:19 +02:00
86e5f74645
platyvenv should generate (and document) a run.sh helper script. 2023-08-27 23:20:03 +02:00
9e6430a9ac Clone git repo if platyvenv is not running from a srcdir 2023-08-23 20:02:04 +02:00
dafd65dc21
Added new platyvenv Python script. 2023-08-23 11:55:25 +02:00
f230fa79bb
to_pkg_install_commands should skip already installed sys packages. 2023-08-23 11:51:53 +02:00
449821673c
Added PackageManager.get_installed. 2023-08-23 10:50:29 +02:00
b10ccdb313
Added get_src_root utility function. 2023-08-23 02:53:31 +02:00
1ef0d804db
Added full_command argument to to_pip_install_commands.
This is useful if we just want to get the list of pip dependencies and
create our own pip command.
2023-08-23 02:19:54 +02:00
2bff4c9cf1
Exclude python-* system packages when installing in a venv. 2023-08-23 02:17:19 +02:00
cddf318fa7
Dependencies.from_config should include the base system deps. 2023-08-23 02:16:33 +02:00
8f39231d31
Added new utility methods to the Dependencies class. 2023-08-23 02:15:50 +02:00
ce68250b4d
Refactor/documentation round for platydock. 2023-08-22 02:49:05 +02:00
10c0e5fcad
Added default_os field to PackageManagers enum elements.
This is useful to determine which is the default set of scripts that
should be used by the installer depending on the detected installed
package manager.
2023-08-20 21:21:37 +02:00
2c46b6fe14
Added git a required manifest dependency when needed.
It is needed for packages that install pip packages via git.
2023-08-20 21:19:15 +02:00
a28dcb7a8d
Remove /var/cache/apk from container image after installation. 2023-08-20 14:19:04 +02:00
a6752ed034
Fixed wrong event path in a manifest file. 2023-08-20 14:08:22 +02:00
700b8e1d16
Added header and footer to generated Dockerfile. 2023-08-20 14:05:22 +02:00
a6f8021150
PackageManager has both install and uninstall. 2023-08-20 13:33:49 +02:00
5efcae64c1
Better Dockerfile logic to retrieve sources.
If the /install folder on the container doesn't contain a copy of the
source files, then the git repository will be cloned under that folder.

The user can specify via `-r/--ref` option which tag/branch/commit they
want to install.
2023-08-20 13:31:13 +02:00
28ba042810
If no configuration file is passed to platydock generate a minimal Dockerfile. 2023-08-20 03:36:34 +02:00
199ac5f0f7
New way of managing installation scripts and dependencies.
Created `platypush/install` folder that contains:

- Dockerfiles for the supported distros
- Lists of required base dependencies for the supported distros
- Install and run scripts
- Added Debian to supported base images
2023-08-20 02:28:10 +02:00
71c5291190
Refactored the interface of Platydock and manifest utils. 2023-08-19 22:46:37 +02:00
a99ffea37c
Fixed apt dependencies for mpd plugin. 2023-08-19 21:46:08 +02:00
980af16984
Rewritten platydock utility.
Platydock now will only print out a Dockerfile given a configuration
file.

No more maintaining the state of containers, storing separate workdirs
and configuration directories etc. - that introduced way too much
overhead over Docker.
2023-08-19 13:47:43 +02:00
9002f3034a
Tweaked package managers install command arguments. 2023-08-19 13:46:08 +02:00
69706eaabe
s/logger/_logger/ in the plugins module.
The `logger` name may clash with the context of an action, where
`logger` may have been set to something else.
2023-08-19 13:32:19 +02:00
1cb686bdab
Updated the inspect plugin to the new manifest utils interface. 2023-08-19 13:31:48 +02:00
043f303761
s/HttpBackend._DEFAULT_HTTP_PORT/HttpBackend.DEFAULT_HTTP_PORT/g 2023-08-19 13:30:51 +02:00
dd3a701a2e
Full rewrite of platypush.utils.manifest.
The new version encapsulates all the utility functions into three
classes - `Manifest`, `Manifests` and `Dependencies`.
2023-08-19 13:28:40 +02:00
a8255f3621
Pass the configuration file used by the application to the Alembic process.
The database settings could also be overridden in the configuration file
besides the command line.

We should therefore pass the path to the runtime configuration file, so
the Alembic process can initialize its configuration from the same file
and use the same settings.
2023-08-19 13:23:20 +02:00
1825b492b3
Replaced Config.workdir with Config.get_workdir().
Again, Python < 3.9 doesn't like class properties.
2023-08-19 13:21:24 +02:00
a8836f95f5
Support explicit workdir parameter override in Config constructor. 2023-08-19 13:15:29 +02:00
5bc82dfe64
s/Config._cfgfile/Config.config_file/g 2023-08-19 13:13:36 +02:00
181da63c89
Pass the database engine to the Alembic process as an extra argument.
If the path of the default database engine is overridden via `--workdir`
option then it won't be visible to the new `python` subprocess spawned
for Alembic.
2023-08-19 13:02:05 +02:00
c2b3ec8ce3
Fixed manifest files with outdated formats. 2023-08-19 12:54:33 +02:00
e463a52435
Use sys.executable rather than 'python' to launch the application. 2023-08-19 12:40:57 +02:00
0a5fc40dc5
Merge branch 'master' into 276/better-docker 2023-08-18 17:34:56 +02:00
2cab836bdf
Entity.columns class property replaced by Entity.get_columns method.
Again, Python < 3.9 doesn't like the combination of `@property` +
`@classmethod`.
2023-08-18 17:20:53 +02:00
a9cdff900e
_variable should be an external global function rather than a class property.
The combination of `@property` + `@classmethod` isn't supported on
Python < 3.9.
2023-08-18 16:16:47 +02:00
d0c89f88a8
Fixed parenthesised multi-with statement.
This syntax is not supported on Python < 3.9, and therefore it should be
broken down as a multi-line statement.
2023-08-18 16:10:31 +02:00
ca95490412
Added timeout parameter to requests.get in the rss plugin. 2023-08-18 15:53:30 +02:00
5dd7345c0b
Sync the latest parse timestamps in main instead of __init__ in rss.
We should load the latest timestamps from the db when the thread starts
instead of doing it in the constructor.

The constructor may be invoked when the entities engine hasn't been
initialized yet, and result in deadlocks.
2023-08-18 15:51:11 +02:00
ec64b0ef8b
Added --device_id command line option. 2023-08-17 23:16:24 +02:00
ac83b43f98
Support for custom key-value overrides on Config.init. 2023-08-17 22:03:39 +02:00
657b2cc87d
Create the default configuration file even if --config is supplied but the file doesn't exist. 2023-08-17 11:25:49 +02:00
24b04d9103
s/--config-file/--config/ option in Dockerfile. 2023-08-17 10:35:40 +02:00
bf7d060b81
Added @ensure_initialized decorator to actions in variable.
The `variable` plugin may break in the constructor the first time the
application is started.

That's because it tries to initialize the cache of stored variables, but
the local database hasn't yet been initialized.

That's because plugins are registered _before_ the entities engine is
initialized, as the entities engine assumes that it already has plugins
to scan for entities.

Therefore, the initialization of the `variable` plugin's cache should be
lazy (only done upon the first call to `get`/`set` etc.), in order to
prevent deadlock situations where the plugin waits for the engine to
start, but the engine will be initialized only after the plugin is
ready.

And the lazy initialization logic should also ensure that the entities
engine has been properly started (and emit a `TimeoutError` if that's
not the case), in order to prevent race conditions.
2023-08-17 02:47:30 +02:00
adfedfa2dd
s/TimeoutError/AssertionError/ if get_entities_engine times out. 2023-08-17 02:36:40 +02:00
ec2b8da983
Ignore Redis errors when a backend sends an unregister notify event.
When that happens, it's most likely that the application is already
stopping and the Redis service has already been terminated.
2023-08-17 01:49:41 +02:00
3bf068e0b2
The __main__ function should take no arguments.
setup.py won't pass any arguments to `main()`, so the default entry
point should get them itself from `sys.argv`.
2023-08-17 01:35:39 +02:00
98e9abde18
Extended manifest files with Python system packages (if available).
- 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