potiuk commented on code in PR #45060:
URL: https://github.com/apache/airflow/pull/45060#discussion_r1943332556


##########
scripts/ci/pre_commit/compile_www_assets.py:
##########
@@ -71,4 +72,23 @@ def get_directory_hash(directory: Path, skip_path_regexp: 
str | None = None) ->
     subprocess.check_call(["yarn", "install", "--frozen-lockfile"], 
cwd=os.fspath(www_directory))
     subprocess.check_call(["yarn", "run", "build"], 
cwd=os.fspath(www_directory), env=env)
     new_hash = get_directory_hash(www_directory, 
skip_path_regexp=r".*node_modules.*")
-    WWW_HASH_FILE.write_text(new_hash)
+    www_hash_file.write_text(new_hash)
+
+
+def is_fab_provider_installed() -> bool:
+    return (
+        importlib.util.find_spec("airflow") is not None

Review Comment:
   Well, that one will require figuring out some custom build process for FAB 
provider.  We have two options:
   
   1) Add custom build steps and slightly modified `pyproject.toml` - maybe 
even changing the build backend. Currently we use flit backend - which is 
simple for pure-python packages without custom build steps. In Airflow we do it 
using `hatchling` - and `hatch_build.py` - you will find a "custom" build step 
that retrieves information from git and builds the asset using pyproject.toml. 
But this is a bit problematic - because we are generating pyproject.toml for 
all providers from the same template and we have simple `flit build` command to 
build them.
   
   2) Another - better IMHO opinion - way is to add pre-commit that will 
compile the assets when they change and we could then commit such generated 
assets as part of the provider code. That has the benefit that we would not 
have to have custom build step - also I presume that FAB assets do not change 
frequently (this is the main reason why we are not doing it for airflow - 
because such pre-compiled assets would have to be committed after every UI 
change - and this is pretty much all the time now - that would also generate 
terrible conflicts to resolve while many people are working on UI in parallel. 
   
   So I'd say 2) is the right option. We already have the pre-comits that 
complile UI assets for Airflow and it would be relatively straightforward to do 
similar pre-commits for FAB



-- 
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-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to