From e4ac408ffd7134eea41053392e0934abc1e48fa9 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Fri, 24 Feb 2023 21:10:04 +0200 Subject: [PATCH 1/6] Fix https://github.com/OpenCyphal/yakut/issues/61 --- yakut/param/formatter.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/yakut/param/formatter.py b/yakut/param/formatter.py index d569d83..f47ce50 100644 --- a/yakut/param/formatter.py +++ b/yakut/param/formatter.py @@ -109,7 +109,20 @@ def _make_json_formatter(_hints: FormatterHints) -> Formatter: # - simplejson supports Decimal. import simplejson as json # type: ignore - return lambda data: cast(str, json.dumps(data, ensure_ascii=False, separators=(",", ":"))) + _NEWLINE + # Remove ignore_nan=True when this change makes its way into PlotJuggler: + # https://github.com/nlohmann/json/issues/3799#issuecomment-1444268644 + return ( + lambda data: cast( + str, + json.dumps( + data, + ensure_ascii=False, + separators=(",", ":"), + ignore_nan=True, + ), + ) + + _NEWLINE + ) def _insert_format_specifier( From 50818a830dcb70e0c076faa568730e9a9e84a339 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Fri, 24 Feb 2023 21:10:32 +0200 Subject: [PATCH 2/6] Bump the version number --- yakut/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yakut/VERSION b/yakut/VERSION index 26acbf0..54d1a4f 100644 --- a/yakut/VERSION +++ b/yakut/VERSION @@ -1 +1 @@ -0.12.2 +0.13.0 From 30136e3cf9405c51ff040f7760575d7c52c980cc Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Fri, 24 Feb 2023 21:13:55 +0200 Subject: [PATCH 3/6] Fix https://github.com/OpenCyphal/yakut/issues/68 --- yakut/main.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/yakut/main.py b/yakut/main.py index 2360a6e..30c3252 100644 --- a/yakut/main.py +++ b/yakut/main.py @@ -3,7 +3,6 @@ # Author: Pavel Kirienko from __future__ import annotations -import os import sys import asyncio import functools @@ -199,7 +198,6 @@ def _mk_aliases(item: Any) -> set[str]: help=f""" In order to use compiled DSDL namespaces, the directories that contain compilation outputs need to be specified using this option. -The current working directory does not need to be specified explicitly. Examples: @@ -242,7 +240,6 @@ def _click_main( """ _configure_logging(verbose) # This should be done in the first order to ensure that we log things correctly. - path = (os.getcwd(), *path) _logger.debug("Path: %r", path) for p in path: sys.path.append(str(p)) From 5519c83483c8816b64c565e653cca7a23ee7fd9a Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Fri, 24 Feb 2023 21:23:22 +0200 Subject: [PATCH 4/6] Close https://github.com/OpenCyphal/yakut/issues/57 --- yakut/cmd/call.py | 8 +++++--- yakut/cmd/subscribe/_cmd.py | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/yakut/cmd/call.py b/yakut/cmd/call.py index e251b2b..6b2dedd 100644 --- a/yakut/cmd/call.py +++ b/yakut/cmd/call.py @@ -58,9 +58,11 @@ def _validate_request_fields(ctx: click.Context, param: click.Parameter, value: @click.option( "--with-metadata/--no-metadata", "+M/-M", - default=False, - show_default=True, - help="When enabled, the response object is prepended with an extra field named `_meta_`.", + default=not sys.stdout.isatty(), + help=""" +When enabled, the response object is prepended with an extra field named `_meta_`. +Enabled by default unless stdout is a tty. +""", ) @yakut.pass_purser @yakut.asynchronous() diff --git a/yakut/cmd/subscribe/_cmd.py b/yakut/cmd/subscribe/_cmd.py index eb30190..b5f4321 100644 --- a/yakut/cmd/subscribe/_cmd.py +++ b/yakut/cmd/subscribe/_cmd.py @@ -124,9 +124,11 @@ def _handle_option_synchronizer_transfer_id(ctx: click.Context, _param: click.Pa @click.option( "--with-metadata/--no-metadata", "+M/-M", - default=False, - show_default=True, - help="When enabled, each message object is prepended with an extra field named `_meta_`.", + default=not sys.stdout.isatty(), + help=""" +When enabled, each message object is prepended with an extra field named `_meta_`. +Enabled by default unless stdout is a tty. +""", ) @click.option( "--count", From edf4b53edb1b27e601fde335cce82edd016c7540 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sat, 25 Feb 2023 00:31:00 +0200 Subject: [PATCH 5/6] Fix orc test --- yakut/cmd/orchestrate/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yakut/cmd/orchestrate/__init__.py b/yakut/cmd/orchestrate/__init__.py index 8abe465..7a3eb1a 100644 --- a/yakut/cmd/orchestrate/__init__.py +++ b/yakut/cmd/orchestrate/__init__.py @@ -3,6 +3,7 @@ # Author: Pavel Kirienko from __future__ import annotations +import os import sys import signal import logging @@ -288,7 +289,9 @@ def on_signal(s: int, _: Any) -> None: if not sys.platform.startswith("win"): signal.signal(signal.SIGHUP, on_signal) - ctx = Context(lookup_paths=purser.paths) + ctx = Context( + lookup_paths=(os.getcwd(), *purser.paths), # Current directory takes precedence. + ) res = exec_file(ctx, file, {}, gate=lambda: sig_num == 0) return res if res != 0 else -sig_num From 5b0d6e4ec4598558618aeb1fa9f291b3d0beea1e Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sat, 25 Feb 2023 01:11:40 +0200 Subject: [PATCH 6/6] Fix the orc --- yakut/cmd/orchestrate/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yakut/cmd/orchestrate/__init__.py b/yakut/cmd/orchestrate/__init__.py index 7a3eb1a..9da656d 100644 --- a/yakut/cmd/orchestrate/__init__.py +++ b/yakut/cmd/orchestrate/__init__.py @@ -3,10 +3,10 @@ # Author: Pavel Kirienko from __future__ import annotations -import os import sys import signal import logging +from pathlib import Path from typing import Any import click import yakut @@ -290,7 +290,7 @@ def on_signal(s: int, _: Any) -> None: signal.signal(signal.SIGHUP, on_signal) ctx = Context( - lookup_paths=(os.getcwd(), *purser.paths), # Current directory takes precedence. + lookup_paths=(Path.cwd(), *purser.paths), # Current directory takes precedence. ) res = exec_file(ctx, file, {}, gate=lambda: sig_num == 0)