diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index b451fb93872..3f4e37ccf86 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2022 Vivien Kraus ;;; Copyright © 2021 Simon Tournier ;;; Copyright © 2022 Hartmut Goebel +;;; Copyright © 2024 Nicolas Graves ;;; ;;; This file is part of GNU Guix. ;;; @@ -68,6 +69,7 @@ #:use-module (guix upstream) #:use-module ((guix licenses) #:prefix license:) #:export (%pypi-base-url + pypi-ignored-inputs parse-requires.txt parse-wheel-metadata specification->requirement-name @@ -84,6 +86,18 @@ ;; Base URL of the PyPI API. (make-parameter "https://pypi.org/pypi/")) +(define pypi-ignored-inputs + ;; This list contains packages that are useful for development or quality + ;; testing, but that most of the time are not necessary to have as an input. + (list "argparse" "wheel" "import-metadata" ; native, backports + "nox" "tox" ; test wrapper for other environments + "codecov" "coverage" ; test coverage reporting + "black" "isort" "pycodestyle" "pep8" ; style + "check-manifest" "pyflakes" "flake8" "pylint" "mypy" ; style+lint + "coveralls" "twine" ; upload integration tools + "pytest-isort" "pytest-flake8" "pytest-cov" "pytest-black" ; variants + "pytest-pep8" "pytest-mypy" "pytest-pep8" "pre-commit")) ; + (define non-empty-string-or-false (match-lambda ("" #f) @@ -499,12 +513,12 @@ cannot determine package dependencies from source archive: ~a~%") "Given the SOURCE-URL and WHEEL-URL of an already downloaded ARCHIVE, return the corresponding list of records." (define (requirements->upstream-inputs deps type) - (filter-map (match-lambda - ("argparse" #f) - (name (upstream-input - (name name) - (downstream-name (python->package-name name)) - (type type)))) + (filter-map (lambda (name) + (and (not (member name pypi-ignored-inputs)) + (upstream-input + (name name) + (downstream-name (python->package-name name)) + (type type)))) (sort deps string-ci) + pypi-ignored-inputs)))) (map (lambda (input) (make-warning package diff --git a/tests/import/pypi.scm b/tests/import/pypi.scm index 59d0bfc2104..8da15edcd98 100644 --- a/tests/import/pypi.scm +++ b/tests/import/pypi.scm @@ -97,6 +97,7 @@ bar != 2 [test] pytest (>=2.5.0) +pytest-cov # read but ignored ") ;; Beaker contains only optional dependencies. @@ -258,7 +259,7 @@ files specified by SPECS. Return its file name." (map specification->requirement-name test-specifications)) (test-equal "parse-requires.txt" - (list '("foo" "bar") '("pytest")) + (list '("foo" "bar") '("pytest" "pytest-cov")) (mock ((ice-9 ports) call-with-input-file call-with-input-string) (parse-requires.txt test-requires.txt)))