v6.6.2
Highlights
pyne exited with an error on every fresh install of 6.6.1. Typer 0.26 removed Click from its
dependencies, so a new pip install pynesys-pynecore[all] no longer pulled Click in — while the
CLI still imported it at module level:
$ pyne --help
You need to install click to run Pyne CLI. Please run `pip install click`.
Installing Click by hand was not a fix either: from 0.26 on, Typer vendors a reduced fork of Click
in which the Option, Group and Choice classes do not exist at all, and its parser rejects
externally built click.Option instances — so plugin-injected CLI flags failed with
AttributeError: 'Context' object has no attribute '_param_default_explicit'.
Click is now gone from PyneCore entirely.
Fixes
CLI works without Click
The module-level Click import and its SystemExit guard are removed from the CLI, and the command
tree is walked through Typer's own TyperGroup instead of Click groups. pyne and every
subcommand now run on Typer alone.
Verified against Typer 0.19.2 with Click installed, and against Typer 0.26 and 0.27 without it.
Changes
Plugin CLI parameter hooks no longer use Click objects
CLIPlugin.cli_params() now returns a list of CLIOption specs instead of click.Parameter
objects. A plugin describes the flag and PyneCore builds the parser object for the installed Typer
version, so plugins never touch a parser class:
from pynecore.core.plugin import CLIPlugin, CLIOption
class FooPlugin(CLIPlugin):
@staticmethod
def cli_params(command_name: str) -> list[CLIOption]:
if command_name == "run":
return [
CLIOption(
("--verbose", "-V"),
is_flag=True,
default=False,
help="Enable verbose output",
),
]
return []A single option string can be passed directly; pass a tuple when the option also has a short form.
Besides is_flag, default and help, a spec accepts type (any single-argument converter such
as int or pathlib.Path), choices, metavar, required, multiple, hidden, envvar and
rich_help_panel — the last of which was not available on injected parameters before.
The cli() hook, which returns a plain Typer app for plugin subcommands, is unaffected.
Typer floor
The cli and all extras now require typer>=0.16, the first release exposing the choice type
needed to build injected options without Click.
Packaging metadata
The Reddit link was removed from the project URLs.