Update python derivation template
- setuptools builds don't actually require specifying wheel, which can be seen in the example¹ in the setuptools documentation.
- migrate from
- nativeBuildInputs to build-system
- propagatedBuildInputs to dependencies
- passthru.optional-dependencies to optional-dependencies
- Expand pythonImportsCheck, so the item is on a new line.
[1] https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
The primary motivation is to save me many review remarks. I don't generally write rust, so feel free to improve the code.
The new pyproject lingo for the inputs has been introduced on master and will be part of NixOS 24.05.
old
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, wheel
, cryptography
, pycryptodome
}:
buildPythonPackage rec {
pname = "joserfc";
version = "0.9.0";
pyproject = true;
src = fetchFromGitHub {
owner = "authlib";
repo = "joserfc";
rev = version;
hash = "sha256-+NFCveMPzE0hSs2Qe20/MDHApXVtU3cR/GPFKPqfVV4=";
};
nativeBuildInputs = [
setuptools
wheel
];
propagatedBuildInputs = [
cryptography
];
passthru.optional-dependencies = {
drafts = [
pycryptodome
];
};
pythonImportsCheck = [ "joserfc" ];
meta = with lib; {
description = "Implementations of JOSE RFCs in Python";
homepage = "https://github.com/authlib/joserfc";
license = licenses.bsd3;
maintainers = with maintainers; [ ];
};
}
new
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, cryptography
, pycryptodome
}:
buildPythonPackage rec {
pname = "joserfc";
version = "0.9.0";
pyproject = true;
src = fetchFromGitHub {
owner = "authlib";
repo = "joserfc";
rev = version;
hash = "sha256-+NFCveMPzE0hSs2Qe20/MDHApXVtU3cR/GPFKPqfVV4=";
};
build-system = [
setuptools
];
dependencies = [
cryptography
];
optional-dependencies = {
drafts = [
pycryptodome
];
};
pythonImportsCheck = [
"joserfc"
];
meta = with lib; {
description = "Implementations of JOSE RFCs in Python";
homepage = "https://github.com/authlib/joserfc";
license = licenses.bsd3;
maintainers = with maintainers; [ ];
};
}
Friendly ping, two months in.
@figsoda ^^
Now with the lambda input style used by nixfmt:
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
cryptography,
pycryptodome,
}:
buildPythonPackage rec {
pname = "joserfc";
version = "0.9.0";
pyproject = true;
src = fetchFromGitHub {
owner = "authlib";
repo = "joserfc";
rev = version;
hash = "sha256-+NFCveMPzE0hSs2Qe20/MDHApXVtU3cR/GPFKPqfVV4=";
};
build-system = [
setuptools
];
dependencies = [
cryptography
];
optional-dependencies = {
drafts = [
pycryptodome
];
};
pythonImportsCheck = [
"joserfc"
];
meta = with lib; {
description = "Implementations of JOSE RFCs in Python";
homepage = "https://github.com/authlib/joserfc";
license = licenses.bsd3;
maintainers = with maintainers; [ ];
};
}
What is lambda input style ?
What is lambda input style ?
- lambda is another word for a function
- input is another way of saying parameters (arguments).
They're saying that nixfmt (RFC 166) renders the function parameters like this:
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
cryptography,
pycryptodome,
}:
Whereas the old formatting was this:
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, cryptography
, pycryptodome
}:
Interesting, thank you! TIL !