Skip to content

Commit

Permalink
seamless editable package in nix dev shell
Browse files Browse the repository at this point in the history
  • Loading branch information
urbas committed Dec 1, 2024
1 parent 5bc0320 commit 8b9e24e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
7 changes: 0 additions & 7 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
use flake
nix profile wipe-history --profile "$(direnv_layout_dir)/flake-profile" --older-than 14d

if [[ -n "${DEV_INSTALL_EDITABLE:-}" ]]; then
install_dir=$(mktemp -d)
PIP_DISABLE_PIP_VERSION_CHECK=1 pip install -e . --prefix $install_dir
export PATH=$install_dir/bin:$PATH
export PYTHONPATH=.:$PYTHONPATH
fi
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
];
};

editablePkg = pkg.overrideAttrs (oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [
(python3.pkgs.mkPythonEditablePackage {
pname = pyproject.project.name;
inherit (pyproject.project) scripts version;
root = "$PWD";
})
];
});

in {
packages.default = pkg;
devShells.default = mkShell {
Expand All @@ -47,7 +57,7 @@
twine
types-pyyaml
];
inputsFrom = [ pkg ];
inputsFrom = [ editablePkg ];
};
});
}
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ lint.ignore = [
"INP", # implicit-namespace-packagepydocstyle
"ISC001", # Implicitly concatenated string literals on one line
"S101", # Use of `assert` detected
"PT005", # fixture with leading `_` returns a value
"PLR2004", # magic value in comparison
"TRY400", # use logging.exception
]
Expand Down

0 comments on commit 8b9e24e

Please sign in to comment.