-
-
Notifications
You must be signed in to change notification settings - Fork 202
Implement kadet input type cache #1319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -264,19 +268,10 @@ def build_parser(): | |||
compile_parser.add_argument( | |||
"--cache", | |||
"-c", | |||
help="enable compilation caching to .kapitan_cache\ | |||
and dependency caching to .dependency_cache, default is False", | |||
help="enable compilation caching to $XDG_CACHE_HOME/kapitan, default is False", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is should state:
caching preferably to $XDG_CACHE_HOME/kapitan or $HOME/kapitan, default is False"
or
caching preferably to $XDG_CACHE_HOME/kapitan (if XDG-compliant) or $HOME/kapitan, default is False"
or
caching either to $XDG_CACHE_HOME/kapitan or $HOME/kapitan, default is False"
action="store_true", | ||
default=from_dot_kapitan("compile", "cache", False), | ||
) | ||
compile_parser.add_argument( | ||
"--cache-paths", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the removal of the --cache-paths
be announced on CHANGELOG.md file under the NEXT RELEASE - Breaking
section?
I think it would be good to have docstrings for the new functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Announcement of the new feature on the NEXT RELEASE section of the CHANGELOG.md might be missing.
# from https://nixos.wiki/wiki/Python#Emulating_virtualenv_with_nix-shell | ||
let | ||
pkgs = import <nixpkgs> {}; | ||
in pkgs.mkShell { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: in pkgs.mkShell with pkgs; {
@@ -102,34 +116,47 @@ def compile_file(self, config: KapitanInputTypeKadetConfig, input_path, compile_ | |||
target_name = self.target_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest changing slightly the initial line of this function's docstring from:
Compile a kadet input file.
to
Compile a kadet input file, if resulting compilation is not already cached
with open(cached_path_lock, "wb") as fp: | ||
logger.debug("Writing cache file: %s", cached_path_lock) | ||
self.dump_output(output_obj, fp) | ||
cached_path_lock.rename(Path(str(cached_path_lock).removesuffix(".lock"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if for some reason, someone aborts execution and this step is never executed? Should there be a recommendation to remove the .lock
? Would it be to:
- Delete the whole cache?
- Delete just the
.lock
file? - Remove the
.locl
suffix?
Fixes #1318
Proposed Changes
Docs and Tests