From 7a0e39111d4af4f9041d0b2159a0412b154cf99a Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 6 May 2022 14:38:17 +0200 Subject: [PATCH 1/3] FIX: A feed entry may not necessarily have an `id` attribute --- platypush/plugins/rss/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platypush/plugins/rss/__init__.py b/platypush/plugins/rss/__init__.py index dad6b147..6a64ec39 100644 --- a/platypush/plugins/rss/__init__.py +++ b/platypush/plugins/rss/__init__.py @@ -102,7 +102,7 @@ class RssPlugin(RunnablePlugin): { 'feed_url': url, 'feed_title': getattr(feed.feed, 'title', None), - 'id': entry.id, + 'id': getattr(entry, 'id', None), 'url': entry.link, 'published': datetime.datetime.fromtimestamp(time.mktime(entry.published_parsed)), 'title': entry.title, From 2e2169544dc311d860868a6c03d52288866b9c3f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 23 May 2022 00:09:23 +0200 Subject: [PATCH 2/3] Added Matrix chat badge and instructions for installation on Arch Linux --- README.md | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f1312d93..9f16e698 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Platypush [![pip version](https://img.shields.io/pypi/v/platypush.svg?style=flat)](https://pypi.python.org/pypi/platypush/) [![License](https://img.shields.io/github/license/BlackLight/platypush.svg)](https://git.platypush.tech/platypush/platypush/-/blob/master/LICENSE.txt) [![Last Commit](https://img.shields.io/github/last-commit/BlackLight/platypush.svg)](https://git.platypush.tech/platypush/platypush/-/commits/master/) +[![Join chat on Matrix](https://img.shields.io/matrix/:platypush?server_fqdn=matrix.platypush.tech)](https://matrix.to/#/#platypush:matrix.platypush.tech) [![Contributions](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://git.platypush.tech/platypush/platypush/-/blob/master/CONTRIBUTING.md) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/BlackLight/platypush.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/BlackLight/platypush/context:python) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/BlackLight/platypush.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/BlackLight/platypush/context:javascript) @@ -23,6 +24,9 @@ Platypush * [The web interface](#the-web-interface) - [Installation](#installation) * [System installation](#system-installation) + + [Install through `pip`](#install-through-pip) + + [Install through a system package manager](#install-through-a-system-package-manager) + + [Install from sources](#install-from-sources) * [Installing the dependencies for your extensions](#installing-the-dependencies-for-your-extensions) + [Install via `extras` name](#install-via-extras-name) + [Install via `manifest.yaml`](#install-via-manifestyaml) @@ -440,15 +444,33 @@ Platypush uses Redis to deliver and store requests and temporary messages: [sudo] systemctl start redis ``` -To install the core platform: - -- The `pip` way: +#### Install through `pip` ```shell [sudo] pip3 install platypush ``` -- The sources way: +#### Install through a system package manager + +Note: currently only Arch Linux and derived distributions are supported. + +You can either install the +[`platypush`](https://aur.archlinux.org/packages/platypush) package (for the +latest stable version) or the +[`platypush-git`](https://aur.archlinux.org/packages/platypush-git) package +(for the latest git version) through your favourite AUR package manager. For +example, using `yay`: + +```shell +yay platypush +# Or +yay platypush-git +``` + +The Arch Linux packages on AUR are automatically updated upon new git commits +or tags. + +#### Install from sources ```shell git clone https://git.platypush.tech/platypush/platypush.git From 239025290d36b32c0288fe5f4b7e5e95165a4e58 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 25 May 2022 10:11:06 +0200 Subject: [PATCH 3/3] --redis-queue argument should be a string --- platypush/__init__.py | 106 ++++++++++++++++++++++++++++-------------- 1 file changed, 72 insertions(+), 34 deletions(-) diff --git a/platypush/__init__.py b/platypush/__init__.py index 4c1d2cf1..01180c66 100644 --- a/platypush/__init__.py +++ b/platypush/__init__.py @@ -29,7 +29,7 @@ logger = logging.getLogger('platypush') class Daemon: - """ Main class for the Platypush daemon """ + """Main class for the Platypush daemon""" # Configuration file (default: either ~/.config/platypush/config.yaml or # /etc/platypush/config.yaml @@ -51,8 +51,15 @@ class Daemon: # number of executions retries before a request fails n_tries = 2 - def __init__(self, config_file=None, pidfile=None, requests_to_process=None, - no_capture_stdout=False, no_capture_stderr=False, redis_queue=None): + def __init__( + self, + config_file=None, + pidfile=None, + requests_to_process=None, + no_capture_stdout=False, + no_capture_stderr=False, + redis_queue=None, + ): """ Constructor Params: @@ -80,8 +87,11 @@ class Daemon: logging.basicConfig(**Config.get('logging')) redis_conf = Config.get('backend.redis') or {} - self.bus = RedisBus(redis_queue=self.redis_queue, on_message=self.on_message(), - **redis_conf.get('redis_args', {})) + self.bus = RedisBus( + redis_queue=self.redis_queue, + on_message=self.on_message(), + **redis_conf.get('redis_args', {}) + ) self.no_capture_stdout = no_capture_stdout self.no_capture_stderr = no_capture_stderr @@ -98,33 +108,59 @@ class Daemon: args -- Your sys.argv[1:] [List of strings] """ parser = argparse.ArgumentParser() - parser.add_argument('--config', '-c', dest='config', required=False, - default=None, help=cls.config_file.__doc__) - parser.add_argument('--pidfile', '-P', dest='pidfile', required=False, - default=None, help="File where platypush will " + - "store its PID, useful if you're planning to " + - "integrate it in a service") - parser.add_argument('--no-capture-stdout', dest='no_capture_stdout', - required=False, action='store_true', - help="Set this flag if you have max stack depth " + - "exceeded errors so stdout won't be captured by " + - "the logging system") - parser.add_argument('--no-capture-stderr', dest='no_capture_stderr', - required=False, action='store_true', - help="Set this flag if you have max stack depth " + - "exceeded errors so stderr won't be captured by " + - "the logging system") - parser.add_argument('--redis-queue', dest='redis_queue', - required=False, action='store_true', - default=cls._default_redis_queue, - help="Name of the Redis queue to be used to internally deliver messages " - "(default: platypush/bus)") + parser.add_argument( + '--config', + '-c', + dest='config', + required=False, + default=None, + help=cls.config_file.__doc__, + ) + parser.add_argument( + '--pidfile', + '-P', + dest='pidfile', + required=False, + default=None, + help="File where platypush will " + + "store its PID, useful if you're planning to " + + "integrate it in a service", + ) + parser.add_argument( + '--no-capture-stdout', + dest='no_capture_stdout', + required=False, + action='store_true', + help="Set this flag if you have max stack depth " + + "exceeded errors so stdout won't be captured by " + + "the logging system", + ) + parser.add_argument( + '--no-capture-stderr', + dest='no_capture_stderr', + required=False, + action='store_true', + help="Set this flag if you have max stack depth " + + "exceeded errors so stderr won't be captured by " + + "the logging system", + ) + parser.add_argument( + '--redis-queue', + dest='redis_queue', + required=False, + default=cls._default_redis_queue, + help="Name of the Redis queue to be used to internally deliver messages " + "(default: platypush/bus)", + ) opts, args = parser.parse_known_args(args) - return cls(config_file=opts.config, pidfile=opts.pidfile, - no_capture_stdout=opts.no_capture_stdout, - no_capture_stderr=opts.no_capture_stderr, - redis_queue=opts.redis_queue) + return cls( + config_file=opts.config, + pidfile=opts.pidfile, + no_capture_stdout=opts.no_capture_stdout, + no_capture_stderr=opts.no_capture_stderr, + redis_queue=opts.redis_queue, + ) def on_message(self): """ @@ -145,8 +181,10 @@ class Daemon: logger.info('Dropped unauthorized request: {}'.format(msg)) self.processed_requests += 1 - if self.requests_to_process \ - and self.processed_requests >= self.requests_to_process: + if ( + self.requests_to_process + and self.processed_requests >= self.requests_to_process + ): self.stop_app() elif isinstance(msg, Response): logger.info('Received response: {}'.format(msg)) @@ -158,7 +196,7 @@ class Daemon: return _f def stop_app(self): - """ Stops the backends and the bus """ + """Stops the backends and the bus""" from .plugins import RunnablePlugin for backend in self.backends.values(): @@ -173,7 +211,7 @@ class Daemon: self.cron_scheduler.stop() def run(self): - """ Start the daemon """ + """Start the daemon""" if not self.no_capture_stdout: sys.stdout = Logger(logger.info) if not self.no_capture_stderr: