diff options
| author | Maxim Cournoyer <maxim@guixotic.coop> | 2025-09-17 08:37:54 +0900 |
|---|---|---|
| committer | Andreas Enge <andreas@enge.fr> | 2026-02-21 10:14:47 +0100 |
| commit | 66223335337899dc0ad5ed371d9fd0445795a2a6 (patch) | |
| tree | a66adad916e3f76dcf0a25448e48cad82a228cd9 /gnu/packages/python-check.scm | |
| parent | 64e6ae11b745196d7ac13383787aeb217e075718 (diff) | |
gnu: Add ruff.
* gnu/packages/python-check.scm (ruff): New variable.
* gnu/packages/rust-crates.scm (lookup-cargo-inputs): Add ruff.
Change-Id: I8200569fdcccdc110391910174fee26d56743aaf
Diffstat (limited to 'gnu/packages/python-check.scm')
| -rw-r--r-- | gnu/packages/python-check.scm | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm index 1d89b7d4146..b3edf6ce767 100644 --- a/gnu/packages/python-check.scm +++ b/gnu/packages/python-check.scm | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com> | 8 | ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com> |
| 9 | ;;; Copyright © 2018-2020 Tobias Geerinckx-Rice <me@tobias.gr> | 9 | ;;; Copyright © 2018-2020 Tobias Geerinckx-Rice <me@tobias.gr> |
| 10 | ;;; Copyright © 2019-2025 Ricardo Wurmus <rekado@elephly.net> | 10 | ;;; Copyright © 2019-2025 Ricardo Wurmus <rekado@elephly.net> |
| 11 | ;;; Copyright © 2019-2024 Maxim Cournoyer <maxim@guixotic.coop> | 11 | ;;; Copyright © 2019-2025 Maxim Cournoyer <maxim@guixotic.coop> |
| 12 | ;;; Copyright © 2019, 2021, 2025 Hartmut Goebel <h.goebel@crazy-compilers.com> | 12 | ;;; Copyright © 2019, 2021, 2025 Hartmut Goebel <h.goebel@crazy-compilers.com> |
| 13 | ;;; Copyright © 2020, 2022 Julien Lepiller <julien@lepiller.eu> | 13 | ;;; Copyright © 2020, 2022 Julien Lepiller <julien@lepiller.eu> |
| 14 | ;;; Copyright © 2020 Matthew James Kraai <kraai@ftbfs.org> | 14 | ;;; Copyright © 2020 Matthew James Kraai <kraai@ftbfs.org> |
| @@ -67,15 +67,18 @@ | |||
| 67 | #:use-module (gnu packages cmake) | 67 | #:use-module (gnu packages cmake) |
| 68 | #:use-module (gnu packages nss) | 68 | #:use-module (gnu packages nss) |
| 69 | #:use-module (gnu packages check) | 69 | #:use-module (gnu packages check) |
| 70 | #:use-module (gnu packages compression) | ||
| 70 | #:use-module (gnu packages databases) | 71 | #:use-module (gnu packages databases) |
| 71 | #:use-module (gnu packages django) | 72 | #:use-module (gnu packages django) |
| 72 | #:use-module (gnu packages docker) | 73 | #:use-module (gnu packages docker) |
| 74 | #:use-module (gnu packages jemalloc) | ||
| 73 | #:use-module (gnu packages jupyter) | 75 | #:use-module (gnu packages jupyter) |
| 74 | #:use-module (gnu packages maths) | 76 | #:use-module (gnu packages maths) |
| 75 | #:use-module (gnu packages mpi) | 77 | #:use-module (gnu packages mpi) |
| 76 | #:use-module (gnu packages ninja) | 78 | #:use-module (gnu packages ninja) |
| 77 | #:use-module (gnu packages openstack) | 79 | #:use-module (gnu packages openstack) |
| 78 | #:use-module (gnu packages perl) | 80 | #:use-module (gnu packages perl) |
| 81 | #:use-module (gnu packages pkg-config) | ||
| 79 | #:use-module (gnu packages python-build) | 82 | #:use-module (gnu packages python-build) |
| 80 | #:use-module (gnu packages python-science) | 83 | #:use-module (gnu packages python-science) |
| 81 | #:use-module (gnu packages python-web) | 84 | #:use-module (gnu packages python-web) |
| @@ -89,6 +92,7 @@ | |||
| 89 | #:use-module (gnu packages xdisorg) | 92 | #:use-module (gnu packages xdisorg) |
| 90 | #:use-module (gnu packages xorg) | 93 | #:use-module (gnu packages xorg) |
| 91 | #:use-module ((guix licenses) #:prefix license:) | 94 | #:use-module ((guix licenses) #:prefix license:) |
| 95 | #:use-module (guix build-system cargo) | ||
| 92 | #:use-module (guix build-system pyproject) | 96 | #:use-module (guix build-system pyproject) |
| 93 | #:use-module (guix build-system python) | 97 | #:use-module (guix build-system python) |
| 94 | #:use-module (guix deprecation) | 98 | #:use-module (guix deprecation) |
| @@ -5148,3 +5152,63 @@ unused.") | |||
| 5148 | (description | 5152 | (description |
| 5149 | "This package provides match data structures and types in test code.") | 5153 | "This package provides match data structures and types in test code.") |
| 5150 | (license license:bsd-2))) | 5154 | (license license:bsd-2))) |
| 5155 | |||
| 5156 | (define-public ruff | ||
| 5157 | (package | ||
| 5158 | (name "ruff") | ||
| 5159 | (version "0.13.1") | ||
| 5160 | (source | ||
| 5161 | (origin | ||
| 5162 | (method git-fetch) | ||
| 5163 | (uri (git-reference | ||
| 5164 | (url "https://github.com/astral-sh/ruff") | ||
| 5165 | (commit version))) | ||
| 5166 | (file-name (git-file-name name version)) | ||
| 5167 | (sha256 | ||
| 5168 | (base32 | ||
| 5169 | "1svf9kgzbl20wbz77kzbhxaisb5cz3i28hycmkgsinn6jaj44b3l")))) | ||
| 5170 | (build-system cargo-build-system) | ||
| 5171 | (arguments | ||
| 5172 | (list | ||
| 5173 | #:cargo-install-paths ''("crates/ruff") | ||
| 5174 | #:install-source? #f | ||
| 5175 | #:phases | ||
| 5176 | #~(modify-phases %standard-phases | ||
| 5177 | (add-after 'unpack 'use-guix-vendored-dependencies | ||
| 5178 | (lambda _ | ||
| 5179 | (substitute* '("Cargo.toml" "fuzz/Cargo.toml") | ||
| 5180 | (("git = \"[^\"]+\", ") | ||
| 5181 | "") | ||
| 5182 | (("rev = \"[^\"]+\"") | ||
| 5183 | "version = \"*\"")))) | ||
| 5184 | (add-after 'patch-generated-file-shebangs 'adjust-shebangs-for-tests | ||
| 5185 | (lambda _ | ||
| 5186 | ;; Because of the Guix shebangs patching phases, the | ||
| 5187 | ;; path_new_exe003_py_expects test fails to match its expected | ||
| 5188 | ;; FHS shebang. Adjust it. | ||
| 5189 | (substitute* "crates/ruff_linter/resources/test/fixtures\ | ||
| 5190 | /flake8_executable/EXE003.py" | ||
| 5191 | (("#!/gnu/.*bash") | ||
| 5192 | "#!/usr/bin/bash")))) | ||
| 5193 | (add-before 'build 'override-jemalloc | ||
| 5194 | (lambda* (#:key inputs #:allow-other-keys) ;Copied from uv | ||
| 5195 | (let ((jemalloc (assoc-ref inputs "jemalloc"))) | ||
| 5196 | ;; This flag is needed when not using the bundled jemalloc. | ||
| 5197 | ;; https://github.com/tikv/jemallocator/issues/19 | ||
| 5198 | (setenv | ||
| 5199 | "CARGO_FEATURE_UNPREFIXED_MALLOC_ON_SUPPORTED_PLATFORMS" "1") | ||
| 5200 | (setenv "JEMALLOC_OVERRIDE" | ||
| 5201 | (string-append jemalloc "/lib/libjemalloc.so")))))))) | ||
| 5202 | (native-inputs (list pkg-config)) | ||
| 5203 | (inputs | ||
| 5204 | (cons* jemalloc | ||
| 5205 | `(,zstd "lib") | ||
| 5206 | (cargo-inputs 'ruff))) | ||
| 5207 | (home-page "https://docs.astral.sh/ruff") | ||
| 5208 | (synopsis "Extremely fast Python linter and code formatter") | ||
| 5209 | (description "Ruff aims to be orders of magnitude faster than alternative | ||
| 5210 | tools while integrating more functionality behind a single, common interface. | ||
| 5211 | Ruff can be used to replace Flake8 (plus dozens of plugins), Black, isort, | ||
| 5212 | pydocstyle, pyupgrade, autoflake, and more, all while executing tens or | ||
| 5213 | hundreds of times faster than any individual tool.") | ||
| 5214 | (license license:expat))) | ||
