mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-02 13:00:23 +00:00
Broken by e094ca39fc.
Upstream patch is not yet merged, so vendor a reduced version of it
(since much of it is not needed).
93 lines
2.1 KiB
Nix
93 lines
2.1 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
pythonAtLeast,
|
|
|
|
# build-system
|
|
hatchling,
|
|
|
|
# dependencies
|
|
docstring-parser,
|
|
typeguard,
|
|
typing-extensions,
|
|
|
|
# tests
|
|
attrs,
|
|
ml-collections,
|
|
msgspec,
|
|
omegaconf,
|
|
pydantic,
|
|
pytestCheckHook,
|
|
shtab,
|
|
universal-pathlib,
|
|
}:
|
|
|
|
buildPythonPackage (finalAttrs: {
|
|
pname = "tyro";
|
|
version = "1.0.15";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "brentyi";
|
|
repo = "tyro";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-mnYVinyys21BjHRhwOLjc3n8mShH2+krEK0dK0VBWp4=";
|
|
};
|
|
|
|
patches = [
|
|
./fix-shtab-1.9.patch # reduced version of https://github.com/brentyi/tyro/pull/488
|
|
];
|
|
|
|
build-system = [ hatchling ];
|
|
|
|
dependencies = [
|
|
docstring-parser
|
|
typeguard
|
|
typing-extensions
|
|
];
|
|
|
|
# Upstream's neural-network integration tests are optional and skipped when
|
|
# flax/torch are unavailable, so keep the lightweight dev extras only.
|
|
nativeCheckInputs = [
|
|
attrs
|
|
ml-collections
|
|
msgspec
|
|
omegaconf
|
|
pydantic
|
|
pytestCheckHook
|
|
shtab
|
|
universal-pathlib
|
|
];
|
|
|
|
disabledTests =
|
|
lib.optionals (pythonAtLeast "3.13") [
|
|
# The bash path-completion functional test still returns no file
|
|
# completions in the Nix build environment.
|
|
"test_bash_path_completion_marker"
|
|
]
|
|
++ lib.optionals (pythonAtLeast "3.14") [
|
|
# Upstream checks that the literal substring `bc` never appears in the
|
|
# help text, but under Nix the `python -m pytest` runner path can include
|
|
# that substring in the store hash used for `sys.argv[0]`.
|
|
"test_suppress_subcommand"
|
|
];
|
|
|
|
# Keep argparse help output on a single line where possible so the
|
|
# literal-output tests do not fail due to terminal line wrapping.
|
|
preCheck = ''
|
|
export COLUMNS=200
|
|
export LINES=200
|
|
'';
|
|
|
|
pythonImportsCheck = [ "tyro" ];
|
|
|
|
meta = {
|
|
description = "CLI interfaces & config objects, from types";
|
|
homepage = "https://github.com/brentyi/tyro";
|
|
changelog = "https://github.com/brentyi/tyro/releases/tag/${finalAttrs.src.tag}";
|
|
license = lib.licenses.mit;
|
|
maintainers = with lib.maintainers; [ hoh ];
|
|
};
|
|
})
|