Skip to content

Param argument accepts generic dict subtypes #29782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

jcobb-healx
Copy link
Contributor

closes: #29358

Allow subtypes of dict to be passed as the DAG and task params argument. This ensures that a ParamsDict object is a valid type for the argument value.


Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg
Copy link

boring-cyborg bot commented Feb 27, 2023

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@msumit
Copy link
Contributor

msumit commented Feb 28, 2023

overall lgtm, though you've to add supported test cases for this. Also, could you ensure you've tested all paths touched by this change, like DAG trigger with config via UI/API/CLI, dag test cmd, etc.

@jcobb-healx
Copy link
Contributor Author

I wasn't sure about a test case given this is a typing change, so mypy should catch any errors and there are no functional changes. But I can add a test to ensure that a ParamsDict object is a valid input to a DAG, which should catch typing regressions

@potiuk potiuk force-pushed the covariant-dag-params branch from 1aa49bf to 4ab90c3 Compare March 4, 2023 17:57
@potiuk
Copy link
Member

potiuk commented Mar 4, 2023

I wasn't sure about a test case given this is a typing change, so mypy should catch any errors and there are no functional changes. But I can add a test to ensure that a ParamsDict object is a valid input to a DAG, which should catch typing regressions

Yeah. I kinda agree that no tests are needed in this case.

@potiuk
Copy link
Member

potiuk commented Mar 4, 2023

rebased to rebuild with latest main

@potiuk
Copy link
Member

potiuk commented Mar 4, 2023

@msumit - wdyt?

@eladkal eladkal added this to the Airflow 2.5.2 milestone Mar 4, 2023
@jcobb-healx jcobb-healx force-pushed the covariant-dag-params branch from 4ab90c3 to 71e5e56 Compare March 6, 2023 09:39
@potiuk potiuk merged commit b069df9 into apache:main Mar 7, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Mar 7, 2023

Awesome work, congrats on your first merged pull request!

@pierrejeambrun pierrejeambrun added the type:bug-fix Changelog: Bug Fixes label Mar 8, 2023
pierrejeambrun pushed a commit that referenced this pull request Mar 23, 2023
(cherry picked from commit b069df9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot use TypedDict object when defining params
5 participants