fix(python): run assets by path when the path is not a valid module name - #2584
Open
mustafa3rsan wants to merge 1 commit into
Open
fix(python): run assets by path when the path is not a valid module name#2584mustafa3rsan wants to merge 1 commit into
mustafa3rsan wants to merge 1 commit into
Conversation
Contributor
Prompt To Fix All With AI### Issue 1
pkg/python/uv.go:332-333
**Script mode bypasses pyproject dependencies**
When an invalid-module asset contains PEP 723 metadata and has a discovered `pyproject.toml`, passing the original file to `uv run` switches uv into script mode, causing dependencies provided only by the project to be unavailable.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(python): run assets by path when the..." | Re-trigger Greptile |
bruin turns an asset's file path into a dotted module name and runs it with `uv run --module`. Paths that are not importable — a leading dot (.claude/...), a hyphen or a space in a segment — produce names the interpreter rejects with 'Relative module names not supported', so those assets could not run at all. Fall back to passing the file path in that case; valid module paths are unchanged.
mustafa3rsan
force-pushed
the
fix/python-asset-non-module-path
branch
from
August 22, 2026 07:35
28a23e0 to
36ea694
Compare
Contributor
|
Reviews (2): Last reviewed commit: "fix(python): run assets by path when the..." | Re-trigger Greptile |
albertobruin
approved these changes
Aug 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bruin turns an asset's file path into a dotted module name and runs it with
uv run --module. When the path is not importable, the interpreter rejects it and the asset cannot run at all:That covers any segment starting with a dot (
.claude/,.github/— a leading dot means "relative import") and any segment that is not a valid Python identifier (my-assets/,ad assets/,2024/). The same file runs fine when executed by path; only the-mform is affected.Fix: when the module name does not match
^[A-Za-z_]\w*(\.[A-Za-z_]\w*)*$, pass the file path touv runinstead of--module. Valid module paths keep the existing behaviour.Verified with a
@bruin-headed asset under.claude/…:Relative module names not supported/ FAIL before, runs / PASS after, with secrets still injected.One caveat: an asset executed by path gets
sys.path[0]set to its own directory instead of the repo root, so imports rooted at the repo will not resolve there. Those assets could not run at all before, so nothing regresses — happy to add the repo root toPYTHONPATHin that branch if you want the two forms fully equivalent.