There is one implementation detail in AIP-21 that I continue to have
questions about, and I wanted to ask community about it.

Since we moved to Python 3, we have the option of using implicit namespace
packages.
https://www.python.org/dev/peps/pep-0420/ . We have now grouping per folder
for services, so it would require a lot more __init__.py files if we
continue using them.

The implicit naming boils down to not requiring __init__.py files if no
initialisation of package is needed. We could do it consistently for all
code which is "internal" to airflow. This means that most packages will not
have __init__.py there will be few exceptions like 'airflow',
'airflow.modules' and likely few others with the __init__.py.

I did a quick check and we have only 25 _init_.py with some logic -
remaining ~ 140 could be removed as they only contain comments.

find . -name '__init__.py' | xargs grep -le '^[^#].*'  | wc -l
      25
find . -name '__init__.py' |wc -l
     164

Those are the files that will be left:
./tests/__init__.py
./tests/utils/log/elasticmock/__init__.py
./tests/utils/log/elasticmock/utilities/__init__.py
./tests/models/__init__.py
./tests/task/__init__.py
./airflow/sensors/__init__.py
./airflow/operators/__init__.py
./airflow/_vendor/nvd3/__init__.py
./airflow/_vendor/slugify/__init__.py
./airflow/serialization/__init__.py
./airflow/__init__.py
./airflow/models/__init__.py
./airflow/www/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py
./airflow/ti_deps/deps/__init__.py
./airflow/macros/__init__.py
./airflow/executors/__init__.py
./airflow/lineage/__init__.py
./airflow/lineage/backend/__init__.py
./airflow/lineage/backend/atlas/__init__.py
./airflow/hooks/__init__.py
./airflow/task/task_runner/__init__.py
./airflow/api/__init__.py
./airflow/api/common/experimental/__init__.py
./airflow/api/client/__init__.py
./airflow/jobs/__init__.py

WDYT?

J

-- 

Jarek Potiuk
Polidea <https://www.polidea.com/> | Principal Software Engineer

M: +48 660 796 129 <+48660796129>
[image: Polidea] <https://www.polidea.com/>

Reply via email to