-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
AIP-79 Generate assets for Flask application in FAB provider (#44744) #45060
base: main
Are you sure you want to change the base?
Conversation
Running all tests just to be sure |
|
||
def is_fab_provider_installed() -> bool: | ||
return ( | ||
importlib.util.find_spec("airflow") is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether this will work. because airflow and providers are not installed in pre-commit.
But as you can be sure the source tree is checked-out, how about checking if source tree is available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But when you install, the sources are not available, are not they? So is_fab_provider_installed
will return False
in this case? Although we wan do want to generate assets for FAB as well. As for the pre-commit
, since Airflow is not installed, is_fab_provider_installed
will return False
.
I am not 100% sure I understand everything correctly here so I might be wrong :)
EDIT: what I meant is, it is okay to not generate the assets for FAB in the CI, however, when Airflow is installed, we definitely should generate them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought from the point of lifecycle. The pre-commit hook will be called in CI and locally... at build time. Source tree will be there. And it needs to be called at build-time to create the static JS content as dist folder to be packaged into the wheel.
The check you are referring to is at runtime At pip install apache-airflow-providers-fab
time the wheel is only un-packed to site-packages. There will no pre-commit be executed as well as you need to assume that at point of install no yarn will be available (might be the user installing is even offline w/o internet).
Otherwise - not being an expert - if the wheel install need to compile/bind/do something at point of install you need to define this in package meta data - not in a pre-commit script that is not available at install time.
You can see this also for airflow/www - the pre-commit is making the package before the sdist/wheel is built and then the dist is packed into the wheel.
So if the check now makes it more safe... I assume the dist will just not be created during build then and only the TS/TSX source tree will be packaged into the wheel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. Following this approach I am at the exact same point as in #45058. I dont quite get the error. Will re-try later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bbovenzi or @pierrejeambrun can you help here? yarn is not really successfully compiling www assets. I assume the yarn lock file is somewhat "different" but I am not an expert why the compile fails. (Still I suspect that loading airflow a Py module is not correct because at CI/compile time the packahe is not installed (chicken+egg))
3118f49
to
0fcbcfe
Compare
Revert the revert #45057 of #44744.
It failed because of:
I updated the function
is_fab_provider_installed
and check if airflow is installed first. I ranbreeze release-management prepare-airflow-package --package-format wheel
and it succeeds (but fails without the fix).^ Add meaningful description above
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.