From f4682c9070a7f0b4a0dbc27c315432c94aeb39dd Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 14 Jun 2024 17:35:23 -0500 Subject: [PATCH 01/14] fix: fallback to `importlib_metadata` on older python --- rattail_tempmon/_version.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rattail_tempmon/_version.py b/rattail_tempmon/_version.py index 71aa2b6..7135faa 100644 --- a/rattail_tempmon/_version.py +++ b/rattail_tempmon/_version.py @@ -1,6 +1,9 @@ # -*- coding: utf-8; -*- -from importlib.metadata import version +try: + from importlib.metadata import version +except ImportError: + from importlib_metadata import version __version__ = version('rattail-tempmon') From be4d6bfe4dd69eaaac63b7911235501ca94e5f69 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 14 Jun 2024 17:37:04 -0500 Subject: [PATCH 02/14] =?UTF-8?q?bump:=20version=200.4.0=20=E2=86=92=200.4?= =?UTF-8?q?.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12f84c2..8c1a4a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-tempmon will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.4.1 (2024-06-14) + +### Fix + +- fallback to `importlib_metadata` on older python + ## v0.4.0 (2024-06-10) ### Feat diff --git a/pyproject.toml b/pyproject.toml index a0d9937..30161b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-tempmon" -version = "0.4.0" +version = "0.4.1" description = "Retail Software Framework - Temperature monitoring add-on" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 625736253451683d13d132a6874a3d98cccf4a07 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Jul 2024 12:20:48 -0500 Subject: [PATCH 03/14] fix: remove legacy command definitions --- pyproject.toml | 8 --- rattail_tempmon/commands.py | 102 +----------------------------------- 2 files changed, 1 insertion(+), 109 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 30161b3..1d08843 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,14 +39,6 @@ Changelog = "https://kallithea.rattailproject.org/rattail-project/rattail-tempmo tempmon = "rattail_tempmon.config:TempmonConfigExtension" -[project.entry-points."rattail.subcommands"] -export-hotcooler = "rattail_tempmon.commands:ExportHotCooler" -purge-tempmon = "rattail_tempmon.commands:PurgeTempmon" -tempmon-client = "rattail_tempmon.commands:TempmonClient" -tempmon-problems = "rattail_tempmon.commands:TempmonProblems" -tempmon-server = "rattail_tempmon.commands:TempmonServer" - - [project.entry-points."rattail.typer_imports"] rattail_tempmon = "rattail_tempmon.commands" diff --git a/rattail_tempmon/commands.py b/rattail_tempmon/commands.py index fd7227b..29291f1 100644 --- a/rattail_tempmon/commands.py +++ b/rattail_tempmon/commands.py @@ -32,7 +32,7 @@ from pathlib import Path import typer from typing_extensions import Annotated -from rattail.commands import rattail_typer, Subcommand, ImportSubcommand +from rattail.commands import rattail_typer from rattail.commands.typer import importer_command, typer_get_runas_user from rattail.commands.importing import ImportCommandHandler @@ -156,33 +156,6 @@ def tempmon_server( daemon.stop() -class ExportHotCooler(ImportSubcommand): - """ - Export data from Rattail-Tempmon to HotCooler - """ - name = 'export-hotcooler' - description = __doc__.strip() - handler_spec = 'rattail_tempmon.hotcooler.importing.tempmon:FromTempmonToHotCooler' - - -class PurgeTempmon(Subcommand): - """ - Purge stale data from Tempmon database - """ - name = 'purge-tempmon' - description = __doc__.strip() - - def add_parser_args(self, parser): - parser.add_argument('--keep', metavar='DAYS', required=True, type=int, - help="Number of days for which data should be kept.") - parser.add_argument('--dry-run', action='store_true', - help="Go through the full motions and allow logging etc. to " - "occur, but rollback (abort) the transaction at the end.") - - def run(self, args): - do_purge(self.config, args.keep, dry_run=args.dry_run, progress=self.progress) - - def do_purge(config, keep_days, dry_run=False, progress=None): from rattail_tempmon.db import Session, model from rattail.db.util import finalize_session @@ -205,76 +178,3 @@ def do_purge(config, keep_days, dry_run=False, progress=None): message="Purging stale readings") log.info("deleted %s stale readings", len(readings)) finalize_session(session, dry_run=dry_run) - - -class TempmonClient(Subcommand): - """ - Manage the tempmon-client daemon - """ - name = 'tempmon-client' - description = __doc__.strip() - - def add_parser_args(self, parser): - subparsers = parser.add_subparsers(title='subcommands') - - start = subparsers.add_parser('start', help="Start daemon") - start.set_defaults(subcommand='start') - stop = subparsers.add_parser('stop', help="Stop daemon") - stop.set_defaults(subcommand='stop') - - parser.add_argument('-p', '--pidfile', - help="Path to PID file.", metavar='PATH') - parser.add_argument('-D', '--daemonize', action='store_true', - help="Daemonize when starting.") - - def run(self, args): - from rattail_tempmon.client import make_daemon - - daemon = make_daemon(self.config, args.pidfile) - if args.subcommand == 'start': - daemon.start(args.daemonize) - elif args.subcommand == 'stop': - daemon.stop() - - -class TempmonServer(Subcommand): - """ - Manage the tempmon-server daemon - """ - name = 'tempmon-server' - description = __doc__.strip() - - def add_parser_args(self, parser): - subparsers = parser.add_subparsers(title='subcommands') - - start = subparsers.add_parser('start', help="Start daemon") - start.set_defaults(subcommand='start') - stop = subparsers.add_parser('stop', help="Stop daemon") - stop.set_defaults(subcommand='stop') - - parser.add_argument('-p', '--pidfile', - help="Path to PID file.", metavar='PATH') - parser.add_argument('-D', '--daemonize', action='store_true', - help="Daemonize when starting.") - - def run(self, args): - from rattail_tempmon.server import make_daemon - - daemon = make_daemon(self.config, args.pidfile) - if args.subcommand == 'start': - daemon.start(args.daemonize) - elif args.subcommand == 'stop': - daemon.stop() - - -class TempmonProblems(Subcommand): - """ - Email report(s) of various Tempmon data problems - """ - name = 'tempmon-problems' - description = __doc__.strip() - - def run(self, args): - from rattail_tempmon import problems - - problems.disabled_probes(self.config, progress=self.progress) From ff0af6732a77b1e78a32d537954d265a93f7abb1 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Jul 2024 14:11:57 -0500 Subject: [PATCH 04/14] =?UTF-8?q?bump:=20version=200.4.1=20=E2=86=92=200.4?= =?UTF-8?q?.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c1a4a7..9b9a381 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-tempmon will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.4.2 (2024-07-01) + +### Fix + +- remove legacy command definitions + ## v0.4.1 (2024-06-14) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 1d08843..68af181 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-tempmon" -version = "0.4.1" +version = "0.4.2" description = "Retail Software Framework - Temperature monitoring add-on" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From f36759dc48f73ca9d0dc94afa9ce56da99388a16 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Jul 2024 16:40:46 -0500 Subject: [PATCH 05/14] fix: remove references, dependency for `six` package --- pyproject.toml | 1 - rattail_tempmon/server.py | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 68af181..3965cc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,6 @@ classifiers = [ ] dependencies = [ "rattail[db]", - "six", "sqlsoup", ] diff --git a/rattail_tempmon/server.py b/rattail_tempmon/server.py index f5ef640..a54614a 100644 --- a/rattail_tempmon/server.py +++ b/rattail_tempmon/server.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -24,13 +24,10 @@ Tempmon server daemon """ -from __future__ import unicode_literals, absolute_import - import time import datetime import logging -import six import humanize from sqlalchemy import orm from sqlalchemy.exc import OperationalError @@ -91,7 +88,7 @@ class TempmonServerDaemon(Daemon): # first time after DB stop. but in the case of DB stop, # subsequent errors will instead match the second test if error.connection_invalidated or ( - 'could not connect to server: Connection refused' in six.text_type(error)): + 'could not connect to server: Connection refused' in str(error)): # only suppress logging for 3 failures, after that we let them go # TODO: should make the max attempts configurable @@ -99,7 +96,7 @@ class TempmonServerDaemon(Daemon): log_error = False log.debug("database connection failure #%s: %s", self.failed_checks, - six.text_type(error)) + str(error)) # send error email unless we're suppressing it for now if log_error: From fe0840d3e02abe6d12ddb4117f249b49df8c65cf Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Jul 2024 23:22:07 -0500 Subject: [PATCH 06/14] =?UTF-8?q?bump:=20version=200.4.2=20=E2=86=92=200.4?= =?UTF-8?q?.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b9a381..2b8e853 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-tempmon will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.4.3 (2024-07-01) + +### Fix + +- remove references, dependency for `six` package + ## v0.4.2 (2024-07-01) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 3965cc5..715f355 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-tempmon" -version = "0.4.2" +version = "0.4.3" description = "Retail Software Framework - Temperature monitoring add-on" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 56d7a48e45190f579ab996f41e8cf18bf7594ce6 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 2 Jul 2024 00:27:59 -0500 Subject: [PATCH 07/14] fix: avoid deprecated function for engine config --- rattail_tempmon/config.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rattail_tempmon/config.py b/rattail_tempmon/config.py index 1c30d30..17034fc 100644 --- a/rattail_tempmon/config.py +++ b/rattail_tempmon/config.py @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8; -*- ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2017 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -24,10 +24,9 @@ Tempmon config extension """ -from __future__ import unicode_literals, absolute_import +from wuttjamaican.db import get_engines from rattail.config import ConfigExtension -from rattail.db.config import get_engines from rattail_tempmon.db import Session From 55c84c6efeeace82d2b5b603da0eeac8c83e2a7b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 2 Jul 2024 00:28:18 -0500 Subject: [PATCH 08/14] =?UTF-8?q?bump:=20version=200.4.3=20=E2=86=92=200.4?= =?UTF-8?q?.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b8e853..a885e10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-tempmon will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.4.4 (2024-07-02) + +### Fix + +- avoid deprecated function for engine config + ## v0.4.3 (2024-07-01) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 715f355..1b2f077 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-tempmon" -version = "0.4.3" +version = "0.4.4" description = "Retail Software Framework - Temperature monitoring add-on" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 8021ac818eed3457818e2f7762f926b4b086dc76 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 2 Jul 2024 01:22:37 -0500 Subject: [PATCH 09/14] fix: fix signature for calls to `get_engines()` --- rattail_tempmon/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rattail_tempmon/config.py b/rattail_tempmon/config.py index 17034fc..32ef48f 100644 --- a/rattail_tempmon/config.py +++ b/rattail_tempmon/config.py @@ -52,10 +52,10 @@ class TempmonConfigExtension(ConfigExtension): def configure(self, config): # tempmon - config.tempmon_engines = get_engines(config, section='rattail_tempmon.db') + config.tempmon_engines = get_engines(config, 'rattail_tempmon.db') config.tempmon_engine = config.tempmon_engines.get('default') Session.configure(bind=config.tempmon_engine) # hotcooler - config.hotcooler_engines = get_engines(config, section='hotcooler.db') + config.hotcooler_engines = get_engines(config, 'hotcooler.db') config.hotcooler_engine = config.hotcooler_engines.get('default') From 7fe5e9aea636d444c4cf45e7c3e595027b45e71a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 2 Jul 2024 01:23:02 -0500 Subject: [PATCH 10/14] =?UTF-8?q?bump:=20version=200.4.4=20=E2=86=92=200.4?= =?UTF-8?q?.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a885e10..09ca81c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-tempmon will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.4.5 (2024-07-02) + +### Fix + +- fix signature for calls to `get_engines()` + ## v0.4.4 (2024-07-02) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 1b2f077..2728bb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-tempmon" -version = "0.4.4" +version = "0.4.5" description = "Retail Software Framework - Temperature monitoring add-on" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From fa4cb5dc9a62ee2e2d71a6ec8d8067583b6fb5bb Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 16 Aug 2024 10:10:13 -0500 Subject: [PATCH 11/14] fix: avoid deprecated base class for config extension --- rattail_tempmon/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rattail_tempmon/config.py b/rattail_tempmon/config.py index 32ef48f..a5f1333 100644 --- a/rattail_tempmon/config.py +++ b/rattail_tempmon/config.py @@ -25,12 +25,12 @@ Tempmon config extension """ from wuttjamaican.db import get_engines +from wuttjamaican.conf import WuttaConfigExtension -from rattail.config import ConfigExtension from rattail_tempmon.db import Session -class TempmonConfigExtension(ConfigExtension): +class TempmonConfigExtension(WuttaConfigExtension): """ Config extension for tempmon; adds tempmon DB engine/Session etc. Expects something like this in your config: From 949c9ee5a1f6b75d4bfdf828c449e3bd51ae55e0 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 19 Aug 2024 08:44:10 -0500 Subject: [PATCH 12/14] =?UTF-8?q?bump:=20version=200.4.5=20=E2=86=92=200.4?= =?UTF-8?q?.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09ca81c..a249452 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-tempmon will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.4.6 (2024-08-19) + +### Fix + +- avoid deprecated base class for config extension + ## v0.4.5 (2024-07-02) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 2728bb2..3914b4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-tempmon" -version = "0.4.5" +version = "0.4.6" description = "Retail Software Framework - Temperature monitoring add-on" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 07dda66bae075a8a4d5551d2413ace3ef7a514f0 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 13 Sep 2024 18:22:48 -0500 Subject: [PATCH 13/14] docs: use markdown for readme file --- README.rst => README.md | 8 +++----- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) rename README.rst => README.md (64%) diff --git a/README.rst b/README.md similarity index 64% rename from README.rst rename to README.md index 39651c1..979c915 100644 --- a/README.rst +++ b/README.md @@ -1,6 +1,5 @@ -rattail-tempmon -=============== +# rattail-tempmon Rattail is a retail software framework, released under the GNU General Public License. @@ -8,6 +7,5 @@ License. This is the ``rattail-tempmon`` package, which provides a database schema, and client/server daemons for recording and processing temperature data. -Please see Rattail's `home page`_ for more information. - -.. _home page: https://rattailproject.org/ +Please see Rattail's [home page](https://rattailproject.org/) for more +information. diff --git a/pyproject.toml b/pyproject.toml index 3914b4d..21cd013 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" name = "rattail-tempmon" version = "0.4.6" description = "Retail Software Framework - Temperature monitoring add-on" -readme = "README.rst" +readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] license = {text = "GNU GPL v3+"} classifiers = [ From f56cb41e6914b97f999fc2505065e8f04f379f60 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 14 Sep 2024 12:12:40 -0500 Subject: [PATCH 14/14] docs: update project links, kallithea -> forgejo --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 21cd013..0e694fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,8 +30,8 @@ dependencies = [ [project.urls] Homepage = "https://rattailproject.org" -Repository = "https://kallithea.rattailproject.org/rattail-project/rattail-tempmon" -Changelog = "https://kallithea.rattailproject.org/rattail-project/rattail-tempmon/files/master/CHANGES.rst" +Repository = "https://forgejo.wuttaproject.org/rattail/rattail-tempmon" +Changelog = "https://forgejo.wuttaproject.org/rattail/rattail-tempmon/src/branch/master/CHANGELOG.md" [project.entry-points."rattail.config.extensions"]