Skip to content

Element dependencies: Improve inline documentation to make it clear that deps of _Scope.BUILD don't return self - #2173

Open
nathanwilliams-ct wants to merge 1 commit into
apache:masterfrom
nathanwilliams-ct:patch-1
Open

Element dependencies: Improve inline documentation to make it clear that deps of _Scope.BUILD don't return self#2173
nathanwilliams-ct wants to merge 1 commit into
apache:masterfrom
nathanwilliams-ct:patch-1

Conversation

@nathanwilliams-ct

Copy link
Copy Markdown
Contributor

All other cases yield an element and a subset of it's dependencies recursively with visit...

I suspect the _Scope.BUILD case should do this too.

@abderrahim

Copy link
Copy Markdown
Contributor

No, --deps build generally implies the element's build dependencies but not the element itself.

@juergbi juergbi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/buildstream/element.py
@nathanwilliams-ct

Copy link
Copy Markdown
Contributor Author

ta both.

I think it might still be valuable to add this documentation inline.

This makes it clear that _Scope.BUILD not yeilding element is intentional
@nathanwilliams-ct nathanwilliams-ct changed the title Element dependencies: Yield element on _Scope.BUILD case in recursive dependencies visit function Element dependencies: Improve inilne documentation to make it clear that deps of _Scope.BUILD don't return self Aug 12, 2026
@nathanwilliams-ct nathanwilliams-ct changed the title Element dependencies: Improve inilne documentation to make it clear that deps of _Scope.BUILD don't return self Element dependencies: Improve inline documentation to make it clear that deps of _Scope.BUILD don't return self Aug 13, 2026

@juergbi juergbi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple of nits.

def visit(element, scope, visited):
if scope == _Scope.ALL:
def visit(element: Element, scope: _Scope, visited: tuple[BitMap,BitMap]) -> Generator[Element]:
if scope == _Scope.ALL: # The element, it's runtime and build dependencies

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if scope == _Scope.ALL: # The element, it's runtime and build dependencies
if scope == _Scope.ALL: # The element, its runtime and build dependencies


elif scope == _Scope.RUN:
# _Scope.BUILD intentionally excludes yielding the element itself.
elif scope == _Scope.RUN: # The element and it's runtime dependencies

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif scope == _Scope.RUN: # The element and it's runtime dependencies
elif scope == _Scope.RUN: # The element and its runtime dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants