Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions pkgs/development/python-modules/click-option-group/default.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
{
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
setuptools,
click,
pytestCheckHook,
}:

buildPythonPackage rec {
pname = "click-option-group";
version = "0.5.6";
format = "setuptools";
disabled = pythonOlder "3.6";
pyproject = true;

src = fetchFromGitHub {
owner = "click-contrib";
repo = pname;
repo = "click-option-group";
Copy link
Contributor

@MattSturgeon MattSturgeon Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems unnecessary, since the variable happens to be the same.

Re-using pname via rec is not like using finalAttrs.pname, which would change when overridden. Getting the binding via rec is effectively constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-using pname in src.repo is discouraged AFAIK.
Hard-coding it is preferred as it prevents silent failures when the package is renamed.

Copy link
Contributor

@MattSturgeon MattSturgeon Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is discouraged to inherit it from finalAttrs, since that could cause issues when overriding the pname attr.

I can't see how inheriting via rec would ever lead to silent errors; you would get a 404 and/or hash mismatch if the repo argument became invalid.

Either way, not a big deal.

tag = "v${version}";
hash = "sha256-uR5rIZPPT6pRk/jJEy2rZciOXrHWVWN6BfGroQ3znas=";
};

propagatedBuildInputs = [ click ];
build-system = [
setuptools
];

dependencies = [ click ];

nativeCheckInputs = [ pytestCheckHook ];

disabledTests = [
# AssertionError (assert result.exception)
"test_missing_group_decl_first_api"
];

pythonImportsCheck = [ "click_option_group" ];

meta = with lib; {
meta = {
description = "Option groups missing in Click";
longDescription = ''
Option groups are convenient mechanism for logical structuring
Expand All @@ -36,7 +44,8 @@ buildPythonPackage rec {
functionality out of the box.
'';
homepage = "https://github.com/click-contrib/click-option-group";
license = licenses.bsd3;
maintainers = with maintainers; [ hexa ];
changelog = "https://github.com/click-contrib/click-option-group/releases/tag/v${version}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ hexa ];
};
}