{
  lib,
  buildPythonApplication,
  fetchFromGitHub,
  setuptools,
  pyxdg,
  torf,
  coverage,
  flake8,
  isort,
  pytest,
  pytest-cov,
  ruff,
  tox,
}:

buildPythonApplication rec {
  pname = "torf-cli";
  version = "5.2.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "rndusr";
    repo = "torf-cli";
    rev = "v${version}";
    hash = "sha256-ipF82mZq7iXsQOWD7w2b0dYDFOSZ7jjiqYAlp9SL4QU=";
  };

  build-system = [
    setuptools
  ];

  dependencies = [
    pyxdg
    torf
  ];

  optional-dependencies = {
    dev = [
      coverage
      flake8
      isort
      pytest
      pytest-cov
      ruff
      tox
    ];
  };

  pythonImportsCheck = [
    "torf_cli"
  ];

  meta = {
    description = "CLI tool for creating, reading and editing torrent files";
    homepage = "https://github.com/rndusr/torf-cli";
    changelog = "https://github.com/rndusr/torf-cli/blob/${src.rev}/CHANGELOG";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ ];
    mainProgram = "torf-cli";
  };
}
