michaltarana opened a new issue, #57197:
URL: https://github.com/apache/airflow/issues/57197

   ### Apache Airflow version
   
   Other Airflow 2/3 version (please specify below)
   
   ### If "Other Airflow 2/3 version" selected, which one?
   
   3.0.3
   
   ### What happened?
   
   $AIRFLOW_HOME/dags subdirectory appears in sys.path when the DAG is 
triggered from the UI. It is not in sys.path when the DAG is triggered using 
the cli.
   
   ### What you think should happen instead?
   
   According to the documentation (HowTo Guides - Setting Configuration 
Options):
   
   > Starting from Airflow 2.10.1, the $AIRFLOW_HOME/dags folder is no longer 
included in sys.path at initialization, so any local settings in that folder 
will not be imported.
   
   I believe that this should be consistent, regardless of the way the DAG is 
triggered (UI or cli). Therefore, the subdirectory $AIRFLOW_HOME/dags should 
*not* appear in sys.path when the DAG is triggered from the UI.
   
   ### How to reproduce
   
   1. Create a simple DAG:
   
   ```
   from airflow.sdk import DAG, task
   import sys
   from pprint import pprint
   
   pprint(sys.path)
   
   @task(executor="LocalExecutor")
   def report_local():
       print(f"Airflow with executor 'LocalExecutor' is running")
   
   with DAG(
       dag_id="simple_dag"
   ) as dag:
       report_local()
   ```
   
   2. Execute ```airflow dags test simple_dag```
   3. Check whether the output looks like this:
   ```
   ['/home/airflow/.local/bin',
    '/usr/local/lib/python312.zip',
    '/usr/local/lib/python3.12',
    '/usr/local/lib/python3.12/lib-dynload',
    '/home/airflow/.local/lib/python3.12/site-packages',
    '/opt/airflow/config',
    '/opt/airflow/plugins']
   ```
   (no /opt/airflow/dags).
   4. Trigger the same DAG from the web UI.
   5. Check whether the result looks like this:
   ```
   ['/home/airflow/.local/bin',
    '/usr/local/lib/python312.zip',
    '/usr/local/lib/python3.12',
    '/usr/local/lib/python3.12/lib-dynload',
    '/home/airflow/.local/lib/python3.12/site-packages',
    '/opt/airflow/config',
    '/opt/airflow/plugins',
    '/opt/airflow/dags']
   ```
   
   ### Operating System
   
   Debian GNU/Linux 11 (bullseye)
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   pache Airflow
   version                | 3.0.3                                               
                                                                                
                                                                                
                          
   executor               | LocalExecutor,CeleryExecutor                        
                                                                                
                                                                                
                          
   task_logging_handler   | airflow.utils.log.file_task_handler.FileTaskHandler 
                                                                                
                                                                                
                          
   sql_alchemy_conn       | 
postgresql+psycopg2://heyflow:RyNjxf3BA4MP7SPH@postgres:5434/heyflow?sslmode=verify-full&sslcert=%2Fopt%2Fairflow%2Fconfig%2Fheyflow.crt&sslkey=%2Fopt%2Fairflow%2Fconfig%2Fheyflow.key&sslrootcert=%2Fopt%2Fairflow%2Fconfig%2Fheyflow-ca.crt
   dags_folder            | /opt/airflow/dags                                   
                                                                                
                                                                                
                          
   plugins_folder         | /opt/airflow/plugins                                
                                                                                
                                                                                
                          
   base_log_folder        | /opt/airflow/logs                                   
                                                                                
                                                                                
                          
   remote_base_log_folder |                                                     
                                                                                
                                                                                
                          
                                                                                
                                                                                
                                                                                
                          
   
   System info
   OS              | Linux                                                      
                                                                                
    
   architecture    | x86_64                                                     
                                                                                
    
   uname           | uname_result(system='Linux', node='78f5e167b944', 
release='5.10.0-33-amd64', version='#1 SMP Debian 5.10.226-1 (2024-10-03)', 
machine='x86_64')
   locale          | ('C', 'UTF-8')                                             
                                                                                
    
   python_version  | 3.12.11 (main, Jul  1 2025, 02:44:10) [GCC 12.2.0]         
                                                                                
    
   python_location | /home/airflow/.local/bin/python                            
                                                                                
    
                                                                                
                                                                                
    
   
   Tools info
   git             | git version 2.39.5                                         
                                    
   ssh             | OpenSSH_9.2p1 Debian-2+deb12u6, OpenSSL 3.0.16 11 Feb 2025 
                                    
   kubectl         | NOT AVAILABLE                                              
                                    
   gcloud          | NOT AVAILABLE                                              
                                    
   cloud_sql_proxy | NOT AVAILABLE                                              
                                    
   mysql           | mysql  Ver 15.1 Distrib 10.11.13-MariaDB, for 
debian-linux-gnu (x86_64) using  EditLine wrapper
   sqlite3         | 3.40.1 2022-12-28 14:03:47 
df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f3alt1    
   psql            | psql (PostgreSQL) 17.5 (Debian 17.5-1.pgdg120+1)           
                                    
                                                                                
                                    
   
   Paths info
   airflow_home    | /opt/airflow                                               
                                                                                
                                                                     
   system_path     | 
/root/bin:/home/airflow/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
                                                                                
                  
   python_path     | 
/home/airflow/.local/bin:/usr/local/lib/python312.zip:/usr/local/lib/python3.12:/usr/local/lib/python3.12/lib-dynload:/home/airflow/.local/lib/python3.12/site-packages:/opt/airflow/config:/opt/airflow/plugins
   airflow_on_path | True                                                       
                                                                                
                                                                     
                                                                                
                                                                                
                                                                     
   
   Providers info
   apache-airflow-providers-amazon           | 9.9.0 
   apache-airflow-providers-celery           | 3.12.1
   apache-airflow-providers-cncf-kubernetes  | 10.6.1
   apache-airflow-providers-common-compat    | 1.7.2 
   apache-airflow-providers-common-io        | 1.6.1 
   apache-airflow-providers-common-messaging | 1.0.4 
   apache-airflow-providers-common-sql       | 1.27.3
   apache-airflow-providers-docker           | 4.4.1 
   apache-airflow-providers-elasticsearch    | 6.3.1 
   apache-airflow-providers-fab              | 2.3.0 
   apache-airflow-providers-ftp              | 3.13.1
   apache-airflow-providers-git              | 0.0.4 
   apache-airflow-providers-google           | 16.1.0
   apache-airflow-providers-grpc             | 3.8.1 
   apache-airflow-providers-hashicorp        | 4.3.1 
   apache-airflow-providers-http             | 5.3.2 
   apache-airflow-providers-microsoft-azure  | 12.5.0
   apache-airflow-providers-mysql            | 6.3.2 
   apache-airflow-providers-odbc             | 4.10.1
   apache-airflow-providers-openlineage      | 2.5.0 
   apache-airflow-providers-postgres         | 6.2.1 
   apache-airflow-providers-redis            | 4.1.1 
   apache-airflow-providers-sendgrid         | 4.1.2 
   apache-airflow-providers-sftp             | 5.3.2 
   apache-airflow-providers-slack            | 9.1.2 
   apache-airflow-providers-smtp             | 2.1.1 
   apache-airflow-providers-snowflake        | 6.5.0 
   apache-airflow-providers-ssh              | 4.1.1 
   apache-airflow-providers-standard         | 1.4.1 
   
   
   ### Anything else?
   
   $AIRFLOW_HOME/dags does not appear in the output of airflow info in 
python_path
   
   ### Are you willing to submit 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: [email protected]

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

Reply via email to