Skip to content

Conversation

@shcheklein
Copy link
Contributor

Now we can pass:

--env something=value \
--env something_else=value1

to datachain job run - it confused me, it confused AI, etc (it was silently just using the last entry)

@shcheklein shcheklein self-assigned this Jan 22, 2026
@shcheklein shcheklein requested a review from Copilot January 22, 2026 19:58
@shcheklein shcheklein added the enhancement New feature or request label Jan 22, 2026
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 22, 2026

Deploying datachain with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5aa99e8
Status: ✅  Deploy successful!
Preview URL: https://a5383cac.datachain-2g6.pages.dev
Branch Preview URL: https://fix-cli-env-handling.datachain-2g6.pages.dev

View logs

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the --env flag handling for the datachain job run command to properly support multiple environment variable declarations. Previously, when multiple --env flags were provided, only the last one would be used (silently ignoring others). The fix allows users to specify environment variables using either multiple --env flags or multiple values in a single --env flag.

Changes:

  • Added action="append" to the --env argument parser to accumulate all --env flag values
  • Implemented flattening logic to properly handle the resulting list of lists before joining into environment string
  • Updated tests to verify both usage patterns (multiple flags and multiple values per flag)
  • Enhanced documentation with examples showing both supported patterns

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/datachain/cli/parser/job.py Added action="append" to the --env argument to accumulate multiple flag instances
src/datachain/studio.py Added flatten import and logic to properly process the nested list structure from argparse
tests/test_cli_studio.py Updated test to validate both single --env with multiple values and multiple --env flags
docs/commands/job/run.md Added new example demonstrating both patterns for specifying multiple environment variables and renumbered subsequent examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@amritghimire
Copy link
Contributor

Tests seems to be failing, can you please take a look?

@shcheklein
Copy link
Contributor Author

@amritghimire unrelated, tocrchcodec, but yes, need to be addressed before merging ... I thought @ilongin fixed it tbh today, but it seems it something different.

@shcheklein shcheklein requested a review from a team January 25, 2026 02:53
@shcheklein shcheklein force-pushed the fix-cli-env-handling branch from 4a8e973 to 5aa99e8 Compare January 25, 2026 02:53
Copy link
Contributor

@dreadatour dreadatour left a comment

Choose a reason for hiding this comment

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

👍

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants