Skip to content

feat: add pixi.init_cwd template variable for task inputs/outputs#5505

Merged
ruben-arts merged 3 commits intoprefix-dev:mainfrom
Premkumar-2004:issue-5475
Feb 18, 2026
Merged

feat: add pixi.init_cwd template variable for task inputs/outputs#5505
ruben-arts merged 3 commits intoprefix-dev:mainfrom
Premkumar-2004:issue-5475

Conversation

@Premkumar-2004
Copy link
Contributor

@Premkumar-2004 Premkumar-2004 commented Feb 14, 2026

Description

Added pixi.init_cwd template variable so it can be used in task inputs/outputs for caching.

[tasks.mkdir_test]
cmd = "mkdir -p {{ pixi.init_cwd }}/test"
outputs = ["{{ pixi.init_cwd }}/test"]

Fixes #5475

How Has This Been Tested?

Added unit test test_template_string_renders_init_cwd and ran existing task tests

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: claude

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.
  • I have verified that changes that would impact the JSON schema have been made in schema/model.py.

Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

Appart from the use of std::env in the manifest code, I like this change.

@ruben-arts
Copy link
Contributor

I tested it locally and it doens't seem to work. Please make sure you test your code before sending a review request.

❯ pixi run --templated 'echo "{{ pixi.init_cwd }}"'
Error:   × failed to replace argument placeholders
   ╭────
 1 │ {{ pixi.init_cwd }}
   ·    ──────┬──────
   ·          ╰── this part can't be replaced
   ╰────
❯ pixi run mkdir_test
✨ Pixi task (mkdir_test in default): mkdir -p {{ pixi.init_cwd }}/test                                                                                                                                   ⠁Error:   × failed to replace argument placeholders
   ╭────
 1 │ mkdir -p {{ pixi.init_cwd }}/test
   ·             ──────┬──────
   ·                   ╰── this part can't be replaced
   ╰────
[tasks.mkdir_test]
cmd = "mkdir -p {{ pixi.init_cwd }}/test"
outputs = ["{{ pixi.init_cwd }}/test"]

Also, why don't you check the "I take responsibility for any AI-generated content in my PR.". I forgot to check it on some of your previous PR's but I don't feel like taking ownership of code that an AI has written and the contributor doesn't want to take responsiblity over.

@Premkumar-2004
Copy link
Contributor Author

I just tested it locally and it works now after my fixes.

Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

Now it works, thanks

@ruben-arts ruben-arts merged commit 993eaef into prefix-dev:main Feb 18, 2026
40 checks passed
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.

Adding support for environment variable in inputs and outputs field

2 participants