New python package: tensorpotential

Hi all,

I would like to contribute the python package tensorpotential to nixpkgs. Upstream: GitHub - ICAMS/grace-tensorpotential: GRACE models and gracemaker (as implemented in TensorPotential package).

This is the expression I wrote, which successfully builds the module using nixpkgs 25.05:

{
  lib,
  fetchFromGitHub,
  buildPythonPackage,
  pythonOlder,
  setuptools,
}:

buildPythonPackage rec {
  pname = "tensorpotential";
  version = "0.5.1";
  format = "setuptools";

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "ICAMS";
    repo = "grace-tensorpotential";
    rev = "0.5.1";
    hash = "sha256-nVIHW2aiV79Ul07lqt/juGc8oPYJUeb7TLtqMyOQjGs=";
  };

  meta = with lib; {
    description = "GRACE models and gracemaker (as implemented in TensorPotential package)";
    homepage = "https://github.com/ICAMS/grace-tensorpotential";
    changelog = "https://github.com/ICAMS/grace-tensorpotential/releases/tag/${version}";
    license = with licenses; [ gpl2Only ];
    maintainers = with maintainers; [ sh4k0 ];
  };
}

Before proceeding in submitting a merge request, I could use some advice from more experienced packagers in reviewing my derivation. Most importantly, the original license of the code (ASL, Academic Software License) is not available in lib.licenses (it has been changed to gpl2Only in the above expression, just to get it to evaluate). How should I proceed?

Submit the pull request, you’ll get more feedback at that time.

Main things I see are you should use tag = version; instead of rev = "0.5.1"; and use pyproject = true; instead of format = "pyproject";

The disabled is overkill too as python 3.9 isn’t even in nixpkgs anyway.

2 Likes