From 010bb2f82772921b140277919611d04cef7ee341 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Fri, 2 May 2025 12:04:58 -0700 Subject: [PATCH] python3Package.parfive: build from source --- .../python-modules/parfive/default.nix | 51 ++++++++++++------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/pkgs/development/python-modules/parfive/default.nix b/pkgs/development/python-modules/parfive/default.nix index 4751f655974d..58cea24e1438 100644 --- a/pkgs/development/python-modules/parfive/default.nix +++ b/pkgs/development/python-modules/parfive/default.nix @@ -1,39 +1,50 @@ { lib, - aiofiles, - aioftp, - aiohttp, buildPythonPackage, - fetchPypi, + fetchFromGitHub, + + # build-system + setuptools-scm, + + # dependencies + aiofiles, + aiohttp, + + # optional dependencies + aioftp, + + # tests pytest-asyncio, pytest-localserver, pytest-socket, pytestCheckHook, - pythonOlder, - setuptools-scm, tqdm, }: buildPythonPackage rec { pname = "parfive"; version = "2.1.0"; - format = "setuptools"; - disabled = pythonOlder "3.7"; - - src = fetchPypi { - inherit pname version; - hash = "sha256-zWy0GSQhMHMM9B1M9vKE6/UPGnHObJUI4EZ+yY8X3I4="; + src = fetchFromGitHub { + owner = "Cadair"; + repo = "parfive"; + tag = "v${version}"; + hash = "sha256-fzyXKw+/aWlnE09CCHqak8MVIk/kcjXkFyV1EKw2cjA="; }; - buildInputs = [ setuptools-scm ]; + pyproject = true; - propagatedBuildInputs = [ - aioftp + build-system = [ setuptools-scm ]; + + dependencies = [ aiohttp tqdm ]; + optional-dependencies = { + ftp = [ aioftp ]; + }; + nativeCheckInputs = [ aiofiles pytest-asyncio @@ -49,13 +60,17 @@ buildPythonPackage rec { "test_ftp_http" ]; + # Tests require local network access + __darwinAllowLocalNetworking = true; + pythonImportsCheck = [ "parfive" ]; - meta = with lib; { + meta = { description = "HTTP and FTP parallel file downloader"; mainProgram = "parfive"; homepage = "https://parfive.readthedocs.io/"; - license = licenses.mit; - maintainers = [ ]; + changelog = "https://github.com/Cadair/parfive/releases/tag/v${version}"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.sarahec ]; }; }