Skip to content

Commit

Permalink
ruff: migrate dependency to python-modules
Browse files Browse the repository at this point in the history
  • Loading branch information
baloo committed Oct 23, 2024
1 parent fb0dd29 commit 244a995
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 23 deletions.
1 change: 0 additions & 1 deletion nixos/lib/test-driver/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
, netpbm
, qemu_test
, socat
, ruff
, tesseract4
, vde2
, extraPythonPackages ? (_ : [])
Expand Down
3 changes: 1 addition & 2 deletions nixos/modules/image/repart-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
, runCommand
, python3
, black
, ruff
, mypy
, systemd
, fakeroot
Expand Down Expand Up @@ -62,7 +61,7 @@ let
amendRepartDefinitions = runCommand "amend-repart-definitions.py"
{
# TODO: ruff does not splice properly in nativeBuildInputs
depsBuildBuild = [ ruff ];
depsBuildBuild = [ python3.pkgs.ruff ];
nativeBuildInputs = [ python3 black mypy ];
} ''
install ${./amend-repart-definitions.py} $out
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/mu/music-assistant/update-providers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ jinja2 mashumaro orjson aiofiles packaging ])" -p pyright ruff isort
#!nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ jinja2 mashumaro orjson aiofiles packaging ruff ])" -p pyright isort
import asyncio
import json
import os.path
Expand Down
13 changes: 5 additions & 8 deletions pkgs/by-name/nb/nbqa/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
python3,
fetchFromGitHub,

# optional-dependencies
ruff,

# tests
versionCheckHook,
}:
Expand All @@ -27,8 +24,9 @@ let
setuptools
];

optional-dependencies.toolchain =
(with python3.pkgs; [
optional-dependencies.toolchain = (
with python3.pkgs;
[
black
blacken-docs
flake8
Expand All @@ -37,10 +35,9 @@ let
mypy
pylint
pyupgrade
])
++ [
ruff
];
]
);

dependencies = with python3.pkgs; [
autopep8
Expand Down
11 changes: 6 additions & 5 deletions pkgs/by-name/op/openapi-python-client/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
python3Packages,
fetchFromGitHub,
installShellFiles,
ruff,
testers,
openapi-python-client,
}:
Expand Down Expand Up @@ -35,8 +34,9 @@ python3Packages.buildPythonApplication rec {
hatchling
];

dependencies =
(with python3Packages; [
dependencies = (
with python3Packages;
[
attrs
httpx
jinja2
Expand All @@ -46,8 +46,9 @@ python3Packages.buildPythonApplication rec {
shellingham
typer
typing-extensions
])
++ [ ruff ];
ruff
]
);

# ruff is not packaged as a python module in nixpkgs
pythonRemoveDeps = [ "ruff" ];
Expand Down
5 changes: 1 addition & 4 deletions pkgs/by-name/ru/ruff-lsp/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
python3Packages,
fetchFromGitHub,

# nativeCheckInputs
ruff,

# tests
versionCheckHook,

Expand Down Expand Up @@ -50,7 +47,7 @@ python3Packages.buildPythonApplication rec {

makeWrapperArgs = [
# prefer ruff from user's PATH, that's usually desired behavior
"--suffix PATH : ${lib.makeBinPath [ ruff ]}"
"--suffix PATH : ${lib.makeBinPath [ python3Packages.ruff ]}"

# Unset ambient PYTHONPATH in the wrapper, so ruff-lsp only ever runs with
# its own, isolated set of dependencies. This works because the correct
Expand Down
2 changes: 1 addition & 1 deletion pkgs/servers/home-assistant/update-component-packages.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ packaging rich ])" -p pyright ruff isort
#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ packaging rich ruff ])" -p pyright isort
#
# This script downloads Home Assistant's source tarball.
# Inside the homeassistant/components directory, each integration has an associated manifest.json,
Expand Down
2 changes: 1 addition & 1 deletion pkgs/servers/home-assistant/update.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=channel:nixpkgs-unstable -i python3 -p "python3.withPackages (ps: with ps; [ aiohttp packaging ])" -p git nurl pyright ruff isort
#!nix-shell -I nixpkgs=channel:nixpkgs-unstable -i python3 -p "python3.withPackages (ps: with ps; [ aiohttp packaging ruff ])" -p git nurl pyright isort

import asyncio
import json
Expand Down

0 comments on commit 244a995

Please sign in to comment.