Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: support merging output from multiple file keys when writing to stdout #115
feat: support merging output from multiple file keys when writing to stdout #115
Changes from 8 commits
d02317a
8878178
675d778
2b4ec1f
c2781e5
f9c818a
e504a80
cb00f33
df3848d
6a2228e
8a06818
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
The
name:
field in these generated conda environments is ignored in every workflow I'm aware of in RAPIDS... it's always overwritten by-n
/--name
passed through like this:That's why I'm proposing a hard-coded mildly-informative name instead of taking on the complexity of other alternatives, like:
conda_env_name=None
to be passed tomake_dependency_file()
--file-key
s were passedThere 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’d weakly prefer allowing None here. I don’t think conda environment files require a name? Maybe we can just omit it.
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.
Ok, I just pushed df3848d changing this to allow
None
.Correct.
Works without issue
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.
make_dependency_file()
is already really 3 distinct codepaths inside one function. The codepath for generatingpyproject
output rightly expects to be given a path to an existingpyproject.toml
file to read in.I'm proposing just not allowing multiple
--file-key
together with--output pyproject
and passing through this hard-coded nonsense string instead of taking on the complexity of other options like:make_dependency_file()
up into e.g.make_conda_env_file()
,make_requirements_file()
, andmake_pyproject_file()
file_name=None
to be passed tomake_dependency_file()
and generating TOML content from scratch if it isThere 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 had to read this 3 times but I think I understand all of the information in this comment? I don't have any feedback, I think this is maybe-fine-enough and if not we can fix it later.
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.
Let me try a different way with links.
After processing
dependencies.yaml
, filtering stuff by output type and matrices, deduplicating, etc., DFG wants the literal text that it'll either echo tostdout
or write to a file.For that, it calls
make_dependency_file()
:dependency-file-generator/src/rapids_dependency_file_generator/_rapids_dependency_file_generator.py
Line 439 in 6e10811
Despite the name, that function actually just creates and returns that text... it never writes anything to the filesystem.
The body of the function, in pseudocode, is like:
So there's very little shared code in there. The list of arguments for the function contains a mix of things that are only used for some but not all of the output types.
Like this:
dependency-file-generator/src/rapids_dependency_file_generator/_rapids_dependency_file_generator.py
Lines 117 to 119 in 6e10811
That's complex but has been kind of "fine" as long as this was always being called with the data from a single
--file-key
.For this PR, we now want to use that function to generate a single type of output from multiple
--file-key
entries. For that, there's no single representativeoutput_dir
, for example. Here, I've just kind of awkwardly provided values with the right types somypy
will be happy, with the knowledge that they don't really matter (since most of the arguments arepyproject
-specific, and this PR isn't supporting pyproject.toml).It'd be clearer if
make_dependency_file()
was decomposed intomake_conda_env_file()
,make_requirements_file()
andmake_pyproject_file()
. But I really really did not want to take that on in the scope of this PR.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.
If you are wondering "why isn't there a test case here checking that passing multiple
--file-key
together with--output pyproject
is rejected?"... it's because I put the exception-raising code for that down further, inmake_dependency_file()
, so that the exception would also be raised ifrapids-build-backend
(which does not use the CLI) tried to pass inputs like that.I did add a unit test in
test_rapids_dependency_file_generator
checking that that exception is raised as expected.