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 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/orchestrate/__init__.py b/yakut/cmd/orchestrate/__init__.py index 8abe465..9da656d 100644 --- a/yakut/cmd/orchestrate/__init__.py +++ b/yakut/cmd/orchestrate/__init__.py @@ -6,6 +6,7 @@ import sys import signal import logging +from pathlib import Path from typing import Any import click import yakut @@ -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=(Path.cwd(), *purser.paths), # Current directory takes precedence. + ) res = exec_file(ctx, file, {}, gate=lambda: sig_num == 0) return res if res != 0 else -sig_num 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", 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)) 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(