__init__.py isn't empty and Dagster - a quick observation

preview_player
Показать описание
I learned something interesting about __init__.py files in Python

I was looking at a Dagster ML pipeline my colleagueJordan Volz recently wrote and I came across an __init__.py file with code in it.

While not surprising to software engineers, I always thought those __init__ files were supposed to be blank - just there to tell python to initialize your module as a package. I was wrong.

As it turns out, it's quite common to add code that python will initialize. In this video, I open the base __init__.py file in my local #mlflow installation to make this example clearer. I start coming out initialization code and seeing how it effects basic imports. SPOILER ALERT: it does!

So not ML related, but this was a fun nugget of Python/Software Engineering for me to learn.
Рекомендации по теме