simi commented on PR #55894:
URL: https://github.com/apache/airflow/pull/55894#issuecomment-3410113452

   @potiuk that's what I mean by wrapped `DagBag`, special case adding to path 
with no cleanup. Currently it does add to path actually only when `bundle_path` 
is used which happens only in those cases:
   
   ```
   [retro@retro2  airflow (dagbag-syspath %=)]❤ ag DagBag -A 10 | grep 
bundle_path | sort
   airflow-core/src/airflow/cli/commands/dag_command.py:378:                    
dagbag = DagBag(bundle.path, bundle_path=bundle.path)
   airflow-core/src/airflow/cli/commands/dag_command.py:475:                    
dagbag = DagBag(bundle.path, bundle_path=bundle.path)
   airflow-core/src/airflow/cli/commands/dag_command.py:527:        dagbag = 
DagBag(bundle.path, bundle_path=bundle.path, include_examples=False)
   airflow-core/src/airflow/cli/commands/dag_command.py:691:        dag_bag = 
DagBag(bundle.path, bundle_path=bundle.path, include_examples=False)
   airflow-core/src/airflow/dag_processing/processor.py:189-        
bundle_path=msg.bundle_path,
   airflow-core/src/airflow/utils/cli.py:283-                
dag_folder=dagfile_path or bundle.path, bundle_path=bundle.path, 
include_examples=False
   airflow-core/src/airflow/utils/cli.py:293-                
dag_folder=dagfile_path or bundle.path, bundle_path=bundle.path, 
include_examples=False
   airflow-core/src/airflow/utils/cli.py:330:        dagbag = 
DagBag(dag_folder=bundle.path, bundle_path=bundle.path)
   airflow-core/tests/unit/dag_processing/test_dagbag.py:1010:        dagbag = 
DagBag(dag_folder=str(dag_file), bundle_path=None, include_examples=False)
   airflow-core/tests/unit/dag_processing/test_dagbag.py:951:        dagbag = 
DagBag(dag_folder=str(dag_file), bundle_path=tmp_path, include_examples=False)
   airflow-core/tests/unit/dag_processing/test_dagbag.py:986:        dagbag = 
DagBag(dag_folder=str(dag_file), bundle_path=tmp_path, include_examples=False)
   airflow-core/tests/unit/dag_processing/test_dagbag.py:991-    def 
test_bundle_path_none_no_syspath_manipulation(self, tmp_path, caplog):
   airflow-core/tests/unit/dag_processing/test_dagbag.py:993-        Test that 
no sys.path manipulation occurs when bundle_path is None.
   airflow-core/tests/unit/dag_processing/test_manager.py:469-            
bundle_path=test_dag_path.bundle_path,
   airflow-core/tests/unit/models/test_dag.py:2124:        bag = 
DagBag(dag_folder=file_path, bundle_path=bundle_path)
   task-sdk/src/airflow/sdk/execution_time/task_runner.py:620-        
bundle_path=bundle_instance.path,
   ```
   
   Wouldn't be enough to rename this argument (not sure it is that simple for 
backward compatibility), to make it clear it modifies `sys.path` or add 
additional argument `append_bundle_to_syspath` or similar?


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to