You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "bugraoz93 (via GitHub)" <gi...@apache.org> on 2026/01/05 20:04:27 UTC
[I] Make positional parameters as a destionation paramater [airflow]
bugraoz93 opened a new issue, #60142:
URL: https://github.com/apache/airflow/issues/60142
### Description
**What**
We need to make adjustments in this file.
https://github.com/apache/airflow/blob/a4f3417bb0ae22a447b974e5e543af45e55e3c7f/airflow-ctl/src/airflowctl/ctl/cli_config.py#L499-L584
airflowctl will understand whether the parameter is nullable. If it is not nullable, we should add as a destination parameter, and if it is nullable, it will be positional.
Example:
from
`airflow connections create --connection-id="test" --conn-type="test" ...`
to
`airflow connections create test test ...`
### Use case/motivation
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "Fury0508 (via GitHub)" <gi...@apache.org>.
Fury0508 commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-3716764155
Thank you so much @douglasmnegri! I really appreciate your understanding. This is my first contribution too, so I was nervous about the situation.
Best of luck with your next issue! If you ever want to collaborate or have questions, feel free to reach out. 🙂
@jroachgolf64 @bugraoz93 - PR #60193 is now ready for review!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-3986417225
@douglasmnegri We are unassigning you from this issue as part of our updated [assignment policy](https://github.com/apache/airflow/blob/main/contributing-docs/04_how_to_contribute.rst#contribute-code-changes).
This is not meant to discourage your contribution — quite the opposite! You are still very welcome to work on this issue and submit a PR for it. Simply comment that you are working on it and open a PR when ready.
We found that formal assignments were not working well, as they often prevented others from contributing when the assignee was not actively working on the issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-3715172503
@abhijeets25012-tech, please feel free to check out "Issues" to find another issue that you'd like to contribute to. @douglasmnegri is going to take a spin at this one :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "abhijeets25012-tech (via GitHub)" <gi...@apache.org>.
abhijeets25012-tech commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-3712510979
I would also like to contribute
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "douglasmnegri (via GitHub)" <gi...@apache.org>.
douglasmnegri commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-3716757511
No problem at all @Fury0508 ! I was still setting up my environment to run tests and start developing the code, so nothing concrete yet.
This is my first issue as well, so feel free to keep going with it. I'll tackle the next one!
Thanks for the heads-up and good luck with the PR!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "bugraoz93 (via GitHub)" <gi...@apache.org>.
bugraoz93 commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-4201175102
> Quick clarifying question on scope — should **all** required non-boolean params become positional, even for commands with many required args?
>
> For example, `xcom add` has 5 required params (`dag_id`, `dag_run_id`, `task_id`, `key`, `value`). Making all of them positional means:
>
> airflowctl xcom add example_dag "manual__2025-01-01" runme_0 my_key '{"value": 1}'
> vs keeping some as flags for clarity:
>
> airflowctl xcom add example_dag "manual__2025-01-01" --task-id=runme_0 --key=my_key --value='{"value": 1}'
> Similarly, `dagrun list` has `state` and `limit` as required primitives — should those be positional too?
>
> Happy to go either way, just want to confirm the intent before submitting the PR.
We should be able to use arguments in both styles, as optional flags `--param-name <value>` and as positional arguments <value>. Mandatory fields can be either positional arguments or optional flags with required=True. Any CLI can have both positional and optional argument types for Pydantic required fields. For not required Pydantic fields, we should leave them optional as `--param-name <value>`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "Fury0508 (via GitHub)" <gi...@apache.org>.
Fury0508 commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-3716727418
Hi @douglasmnegri and @jroachgolf64,
I apologise, I started working on this issue before realising @douglasmnegri was assigned yesterday. This is my first open source contribution and I didn't check assignments first.
I've completed an implementation and am submitting a PR to share the work, but I want to be clear: if @douglasmnegri is already working on this, I will immediately close my PR. I'm not trying to compete or step on anyone's work.
I've learned to check for assignments before starting work going forward. Thanks for your patience with a first-time contributor!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "shivaam (via GitHub)" <gi...@apache.org>.
shivaam commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-4194675332
Quick clarifying question on scope — should **all** required non-boolean params become positional, even for commands with many required args?
For example, `xcom add` has 5 required params (`dag_id`, `dag_run_id`, `task_id`, `key`, `value`). Making all of them positional means:
```bash
airflowctl xcom add example_dag "manual__2025-01-01" runme_0 my_key '{"value": 1}'
```
vs keeping some as flags for clarity:
```bash
airflowctl xcom add example_dag "manual__2025-01-01" --task-id=runme_0 --key=my_key --value='{"value": 1}'
```
Similarly, `dagrun list` has `state` and `limit` as required primitives — should those be positional too?
Happy to go either way, just want to confirm the intent before submitting the PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "shivaam (via GitHub)" <gi...@apache.org>.
shivaam commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-4204186516
Thanks for the feedback @bugraoz93!
I looked into supporting both positional and `--flag` styles for required params. Unfortunately argparse doesn't natively support this — a parameter is either positional (`dag_id`) or a flag (`--dag-id`), never both.
**Why it's not straightforward:**
The closest workaround is registering all params as `--flags`, adding a `nargs='*'` catch-all for bare values, and using `parse_intermixed_args` to map positionals into unfilled flag slots after parsing. But this means we lose argparse's built-in validation, type checking, help formatting, and `required=True` for those params — we'd essentially reimplement positional argument handling ourselves on top of argparse.
**Options:**
1. **Keep it positional for required params** (current PR) — the simplest, most conventional choice. Required params are positional, optional params are flags. All argparse features work, clean help output.
2. **Two-pass parsing** — maintain two parsers per command: one with required params as positional, one with them as `--flags required=True`. Try positional first, fall back to flags. Users can use either style, just not mixed in the same invocation:
```bash
# both work:
airflowctl xcom add my_dag my_task my_key
airflowctl xcom add --dag-id=my_dag --task-id=my_task --key=my_key
# but not mixed:
airflowctl xcom add my_dag --task-id=my_task my_key # would fail
```
No argparse hacks needed (both parsers are standard), but doubles the parser setup and mixed usage isn't supported.
3. **Cap positional count** — first 1-2 required params (like `dag_id`) are positional, rest stay as `--flag required=True`. Common CLI pattern (like `git checkout <branch> --force`). No hacks, all argparse features work.
I'd recommend Option 1 for simplicity. Happy to go with whichever you prefer!
---
<details>
<summary>Details on the <code>parse_intermixed_args</code> workaround (and why I didn't recommend it)</summary>
The idea is to register all required params as `--flags` only (no argparse positionals), add a single `nargs='*'` argument to collect any bare values, then map those bare values into whichever flag slots the user didn't fill:
```python
PARAM_ORDER = ['dag_id', 'task_id', 'key']
parser.add_argument('--dag-id', dest='dag_id', default=None)
parser.add_argument('--task-id', dest='task_id', default=None)
parser.add_argument('--key', default=None)
parser.add_argument('positionals', nargs='*')
args = parser.parse_intermixed_args(argv)
# map bare values into unfilled flag slots, left to right
unfilled = [d for d in PARAM_ORDER if getattr(args, d) is None]
for i, val in enumerate(args.positionals):
setattr(args, unfilled[i], val)
```
`parse_intermixed_args` (Python 3.7+) allows flags and bare values to be freely interspersed, so all of these would work:
```bash
airflowctl xcom add d t k # all positional
airflowctl xcom add --dag-id=d --task-id=t --key=k # all flags
airflowctl xcom add d --task-id=t k # mixed
airflowctl xcom add --task-id=t my_dag my_key # gap-filling
```
The problem is what we lose:
- **Validation** — can't use `required=True` on flags (argparse would reject positional-only usage), so we validate manually after gap-filling
- **Type checking** — `type=int`, `choices=[...]` etc. don't apply to the `nargs='*'` catch-all, so we type-check manually
- **Help output** — shows `[positionals ...]` instead of named params like `DAG_ID TASK_ID`, and no indication which flags are required vs optional
- **`argparse.REMAINDER`** and **mutually exclusive groups with positionals** — unsupported with `parse_intermixed_args`
This effectively means using argparse for flag parsing only and reimplementing positional handling on top of it.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "douglasmnegri (via GitHub)" <gi...@apache.org>.
douglasmnegri commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-3711965197
Can you assign me this issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-3712003706
@douglasmnegri, please feel free to open a PR for this issue!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "shivaam (via GitHub)" <gi...@apache.org>.
shivaam commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-4195245159
Opened a PR: https://github.com/apache/airflow/pull/64812
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Make positional parameters as a destionation paramater for auto-generated commands [airflow]
Posted by "shivaam (via GitHub)" <gi...@apache.org>.
shivaam commented on issue #60142:
URL: https://github.com/apache/airflow/issues/60142#issuecomment-4191044210
I'm working on this issue. Will submit a PR shortly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org