feature/flupdt #1
14
.poetry-git-overlay.nix
Normal file
14
.poetry-git-overlay.nix
Normal file
@ -0,0 +1,14 @@
|
||||
{ pkgs }:
|
||||
final: prev: {
|
||||
|
||||
rad-development-python = prev.rad-development-python.overridePythonAttrs (
|
||||
_: {
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/RAD-Development/rad-development-python";
|
||||
rev = "f919535e1eb39b78f77c3c2b8ccee9244fd7fc92";
|
||||
sha256 = "0vba1d184ks4r78d9z252paxpfwvwq4h9fvhmsavby1rr2dr1976";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
}
|
@ -34,5 +34,6 @@ Until `rad_development_python` (`rdp`) is in PyPI, we use the below steps to
|
||||
update the lock file when there is an update to `rdp`.
|
||||
|
||||
1. Run `poetry lock` to update the poetry reference to GitHub
|
||||
1. Run `poetry2nix lock` to update the overlay which Poetry2Nix uses
|
||||
1. Run `poetry2nix lock --out .poetry-git-overlay.nix` to update the overlay
|
||||
which Poetry2Nix uses
|
||||
1. Run `nix flake check` to verify that all is building as expected
|
||||
|
@ -22,14 +22,15 @@ in
|
||||
# The pattern of files to run on (default: "" (all))
|
||||
# see also https://pre-commit.com/#hooks-files
|
||||
files = "\\.nix$";
|
||||
# exclude = [".poetry-git-overlay.nix"];
|
||||
};
|
||||
## static analysis checks for nix
|
||||
nil.enable = true;
|
||||
statix.enable = true;
|
||||
deadnix = {
|
||||
enable = true;
|
||||
# exclude = [".poetry-git-overlay.nix"];
|
||||
settings = {
|
||||
exclude = [ "poetry-git-overlay.nix" ];
|
||||
noUnderscore = true; # ignore variables starting with underscore
|
||||
# ignore lambda patterns (useful for passing args from ({}@args)
|
||||
# to other functions)
|
||||
|
@ -61,7 +61,7 @@
|
||||
};
|
||||
|
||||
overlay = pkgs.lib.composeExtensions pyOverrides (
|
||||
import ./poetry-git-overlay.nix { inherit pkgs; }
|
||||
import ./.poetry-git-overlay.nix { inherit pkgs; }
|
||||
);
|
||||
overrides = pkgs.poetry2nix.overrides.withDefaults overlay;
|
||||
|
||||
|
@ -1,39 +1 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""common."""
|
||||
|
||||
import logging
|
||||
import sys
|
||||
from subprocess import PIPE, Popen
|
||||
|
||||
|
||||
def configure_logger(level: str = "INFO") -> None:
|
||||
"""Configure the logger.
|
||||
|
||||
Args:
|
||||
level (str, optional): The logging level. Defaults to "INFO".
|
||||
"""
|
||||
logging.basicConfig(
|
||||
level=level,
|
||||
datefmt="%Y-%m-%dT%H:%M:%S%z",
|
||||
format="%(asctime)s %(levelname)s %(filename)s:%(lineno)d - %(message)s",
|
||||
handlers=[logging.StreamHandler(sys.stdout)],
|
||||
)
|
||||
|
||||
|
||||
def bash_wrapper(command: str, path: str = ".") -> tuple[str, str, int]:
|
||||
"""Execute a bash command and capture the output.
|
||||
|
||||
Args:
|
||||
command (str): The bash command to be executed.
|
||||
path (str): The current working directory, '.' by default
|
||||
|
||||
Returns:
|
||||
Tuple[str, int]: A tuple containing the output of the command (stdout) as a string,
|
||||
the error output (stderr) as a string (optional), and the return code as an integer.
|
||||
"""
|
||||
# This is a acceptable risk
|
||||
process = Popen(command.split(), stdout=PIPE, stderr=PIPE, cwd=path) # noqa: S603
|
||||
output, error = process.communicate()
|
||||
|
||||
return output.decode(), error.decode(), process.returncode
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
import logging
|
||||
from typing import Optional
|
||||
from flupdt.common import bash_wrapper
|
||||
from rad_development_python import bash_wrapper
|
||||
ahuston-0 marked this conversation as resolved
Outdated
|
||||
import re
|
||||
|
||||
drv_re = re.compile(r".*(/nix/store/.*\.drv).*")
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
from flupdt.common import bash_wrapper
|
||||
from rad_development_python import bash_wrapper
|
||||
import shutil
|
||||
import logging
|
||||
import re
|
||||
|
@ -3,7 +3,6 @@
|
||||
from flupdt.flake_show import get_derivations
|
||||
from flupdt.cli import parse_inputs
|
||||
from flupdt.flake_eval import evaluate_output
|
||||
from flupdt.common import configure_logger
|
||||
import logging
|
||||
import rad_development_python as rd
|
||||
ahuston-0 marked this conversation as resolved
Outdated
ahuston-0
commented
should be common.py should be common.py
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
{ pkgs }:
|
||||
final: prev: {
|
||||
|
||||
rad-development-python = prev.rad-development-python.overridePythonAttrs (_: {
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/RAD-Development/rad-development-python";
|
||||
rev = "4ee897ab983234eda6f12dfcfd822bffab01f740";
|
||||
sha256 = "1hxdqnjrznx0c07qn5cdx7p7f7sz2ysydx5l82w0r7rdadj69ik2";
|
||||
};
|
||||
});
|
||||
|
||||
}
|
2
poetry.lock
generated
2
poetry.lock
generated
@ -852,7 +852,7 @@ poetry = "^1.8.3"
|
||||
type = "git"
|
||||
url = "https://github.com/RAD-Development/rad-development-python"
|
||||
reference = "feature/nix"
|
||||
resolved_reference = "4ee897ab983234eda6f12dfcfd822bffab01f740"
|
||||
resolved_reference = "f919535e1eb39b78f77c3c2b8ccee9244fd7fc92"
|
||||
|
||||
[[package]]
|
||||
name = "rapidfuzz"
|
||||
|
Loading…
x
Reference in New Issue
Block a user
this should be common.py