From 7dd7c50ed3e9b7344a8e3b5b7f95b9a853e30c23 Mon Sep 17 00:00:00 2001 From: Douglas Wilson Date: Wed, 15 Jan 2025 08:20:43 +0000 Subject: [PATCH] "INP" --- devenv.nix | 21 ++++++++++++++------- python/hugr_qir/__init__.py | 0 python/hugr_qir/tests/__init__.py | 0 ruff.toml | 3 +-- 4 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 python/hugr_qir/__init__.py create mode 100644 python/hugr_qir/tests/__init__.py diff --git a/devenv.nix b/devenv.nix index c1f03b7..66bdfa0 100644 --- a/devenv.nix +++ b/devenv.nix @@ -2,14 +2,17 @@ cfg = config.hugr-qir; libllvm = pkgs."llvmPackages_${cfg.llvmVersion}".libllvm; in { + # set these options in devenv.local.nix options.hugr-qir = { llvmVersion = lib.mkOption { type = lib.types.str; default = "14"; }; + patch-ruff = lib.mkEnableOption "patch-ruff"; }; - config = { + config = lib.mkMerge [{ packages = [ + pkgs.pre-commit # These are required for hugr-llvm to be able to link to llvm. pkgs.libffi pkgs.libxml2 @@ -22,11 +25,6 @@ in { # ''; # https://devenv.sh/tasks/ - # tasks = { - # "myproj:setup".exec = "mytool build"; - # "devenv:enterShell".after = [ "myproj:setup" ]; - # }; - env = { "LLVM_SYS_${cfg.llvmVersion}0_PREFIX" = "${libllvm.dev}"; }; @@ -46,5 +44,14 @@ in { }; }; }; - }; + } (lib.mkIf cfg.patch-ruff { + tasks = { + # Patch ruff to make it runnable + "venv:patchelf" = { + exec = "${lib.getExe pkgs.patchelf} --set-interpreter ${pkgs.stdenv.cc.bintools.dynamicLinker} $VIRTUAL_ENV/bin/ruff"; + after = [ "devenv:python:virtualenv" ]; # Runs after this + before = [ "devenv:enterShell" ]; # Runs before this + }; + }; + })]; } diff --git a/python/hugr_qir/__init__.py b/python/hugr_qir/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python/hugr_qir/tests/__init__.py b/python/hugr_qir/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ruff.toml b/ruff.toml index 9220dc2..fd930fb 100644 --- a/ruff.toml +++ b/ruff.toml @@ -27,7 +27,7 @@ lint.select = [ "G", # flake8-logging-format "I", # isort "ICN", # flake8-import-conventions - # "INP", # flake8-no-pep420 + "INP", # flake8-no-pep420 "INT", # flake8-gettext "ISC", # flake8-implicit-str-concat "LOG", # flake8-logging @@ -63,4 +63,3 @@ convention = "google" [lint.per-file-ignores] "guppy_examples/*" = ["INP"] -