You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airflow.apache.org by Tomasz Urbaszek <to...@polidea.com> on 2020/09/09 08:35:27 UTC

Import style in Airflow codebase

Hi all,

I would like to spark a (hopefully short) discussion about import
style in Airflow. In short: absolute vs relative imports.
Reason for this discussion:
https://github.com/apache/airflow/pull/10729#discussion_r485419342

Personally I think we should enforce (using pre-commit hook) absolute
imports in the whole Airflow codebase. We use them already but it's
not written anywhere that this is a preferred way.

I find absolute imports easier to understand and tremendously helpful
to understand the structure and interconnections in a codebase. It
also easier to refactor absolute imports than relative ones. The only
price of absolute imports is their length
(airflow.providers.google.cloud.operator.dataproc <3) but I still
prefere informativeness over amount of code.

What is your opinion on this?

Cheers,
Tomek

Re: Import style in Airflow codebase

Posted by Daniel Imberman <da...@gmail.com>.
+1 on my end!

via Newton Mail 
[https://cloudmagic.com/k/d/mailapp?ct=dx&cv=10.0.50&pv=10.15.6&source=email_footer_2]
On Wed, Sep 9, 2020 at 7:38 PM, Maxime Beauchemin 
<ma...@gmail.com> wrote:
+1

On Wed, Sep 9, 2020 at 10:36 AM Vikram Koka <vi...@astronomer.io> wrote:

 > +1 on absolute import. Honestly, a huge fan of doing it as an absolute 
vs.
 > relative.
 >
 > On Wed, Sep 9, 2020 at 4:09 AM Kaxil Naik <ka...@gmail.com> wrote:
 >
 > > No strong opinion but absolute import seems better from a user's
 > > perspective.
 > >
 > > On Wed, Sep 9, 2020 at 12:07 PM Jarek Potiuk 
<Ja...@polidea.com>
 > > wrote:
 > >
 > > > +1!
 > > >
 > > > On Wed, Sep 9, 2020 at 11:11 AM Ash Berlin-Taylor <as...@apache.org>
 > > wrote:
 > > >
 > > > > Get's my vote, certainly.
 > > > >
 > > > > Here's a PR to do it -- 
https://github.com/apache/airflow/pull/10825
 > > > >
 > > > > If no one complains in 24 hours lets merge that.
 > > > >
 > > > > On Sep 9 2020, at 9:35 am, Tomasz Urbaszek <
 > > tomasz.urbaszek@polidea.com>
 > > > > wrote:
 > > > >
 > > > > > Hi all,
 > > > > >
 > > > > > I would like to spark a (hopefully short) discussion about 
import
 > > > > > style in Airflow. In short: absolute vs relative imports.
 > > > > > Reason for this discussion:
 > > > > > 
https://github.com/apache/airflow/pull/10729#discussion_r485419342
 > > > > >
 > > > > > Personally I think we should enforce (using pre-commit hook)
 > absolute
 > > > > > imports in the whole Airflow codebase. We use them already but 
it's
 > > > > > not written anywhere that this is a preferred way.
 > > > > >
 > > > > > I find absolute imports easier to understand and tremendously
 > helpful
 > > > > > to understand the structure and interconnections in a codebase. 
It
 > > > > > also easier to refactor absolute imports than relative ones. The
 > only
 > > > > > price of absolute imports is their length
 > > > > > (airflow.providers.google.cloud.operator.dataproc <3) but I 
still
 > > > > > prefere informativeness over amount of code.
 > > > > >
 > > > > > What is your opinion on this?
 > > > > >
 > > > > > Cheers,
 > > > > > Tomek
 > > > > >
 > > > >
 > > >
 > > >
 > > > --
 > > >
 > > > Jarek Potiuk
 > > > Polidea <https://www.polidea.com/> | Principal Software Engineer
 > > >
 > > > M: +48 660 796 129 <+48660796129>
 > > > [image: Polidea] <https://www.polidea.com/>
 > > >
 > >
 >

Re: Import style in Airflow codebase

Posted by Maxime Beauchemin <ma...@gmail.com>.
+1

On Wed, Sep 9, 2020 at 10:36 AM Vikram Koka <vi...@astronomer.io> wrote:

> +1 on absolute import. Honestly, a huge fan of doing it as an absolute vs.
> relative.
>
> On Wed, Sep 9, 2020 at 4:09 AM Kaxil Naik <ka...@gmail.com> wrote:
>
> > No strong opinion but absolute import seems better from a user's
> > perspective.
> >
> > On Wed, Sep 9, 2020 at 12:07 PM Jarek Potiuk <Ja...@polidea.com>
> > wrote:
> >
> > > +1!
> > >
> > > On Wed, Sep 9, 2020 at 11:11 AM Ash Berlin-Taylor <as...@apache.org>
> > wrote:
> > >
> > > > Get's my vote, certainly.
> > > >
> > > > Here's a PR to do it -- https://github.com/apache/airflow/pull/10825
> > > >
> > > > If no one complains in 24 hours lets merge that.
> > > >
> > > > On Sep 9 2020, at 9:35 am, Tomasz Urbaszek <
> > tomasz.urbaszek@polidea.com>
> > > > wrote:
> > > >
> > > > > Hi all,
> > > > >
> > > > > I would like to spark a (hopefully short) discussion about import
> > > > > style in Airflow. In short: absolute vs relative imports.
> > > > > Reason for this discussion:
> > > > > https://github.com/apache/airflow/pull/10729#discussion_r485419342
> > > > >
> > > > > Personally I think we should enforce (using pre-commit hook)
> absolute
> > > > > imports in the whole Airflow codebase. We use them already but it's
> > > > > not written anywhere that this is a preferred way.
> > > > >
> > > > > I find absolute imports easier to understand and tremendously
> helpful
> > > > > to understand the structure and interconnections in a codebase. It
> > > > > also easier to refactor absolute imports than relative ones. The
> only
> > > > > price of absolute imports is their length
> > > > > (airflow.providers.google.cloud.operator.dataproc <3) but I still
> > > > > prefere informativeness over amount of code.
> > > > >
> > > > > What is your opinion on this?
> > > > >
> > > > > Cheers,
> > > > > Tomek
> > > > >
> > > >
> > >
> > >
> > > --
> > >
> > > Jarek Potiuk
> > > Polidea <https://www.polidea.com/> | Principal Software Engineer
> > >
> > > M: +48 660 796 129 <+48660796129>
> > > [image: Polidea] <https://www.polidea.com/>
> > >
> >
>

Re: Import style in Airflow codebase

Posted by Vikram Koka <vi...@astronomer.io>.
+1 on absolute import. Honestly, a huge fan of doing it as an absolute vs.
relative.

On Wed, Sep 9, 2020 at 4:09 AM Kaxil Naik <ka...@gmail.com> wrote:

> No strong opinion but absolute import seems better from a user's
> perspective.
>
> On Wed, Sep 9, 2020 at 12:07 PM Jarek Potiuk <Ja...@polidea.com>
> wrote:
>
> > +1!
> >
> > On Wed, Sep 9, 2020 at 11:11 AM Ash Berlin-Taylor <as...@apache.org>
> wrote:
> >
> > > Get's my vote, certainly.
> > >
> > > Here's a PR to do it -- https://github.com/apache/airflow/pull/10825
> > >
> > > If no one complains in 24 hours lets merge that.
> > >
> > > On Sep 9 2020, at 9:35 am, Tomasz Urbaszek <
> tomasz.urbaszek@polidea.com>
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > I would like to spark a (hopefully short) discussion about import
> > > > style in Airflow. In short: absolute vs relative imports.
> > > > Reason for this discussion:
> > > > https://github.com/apache/airflow/pull/10729#discussion_r485419342
> > > >
> > > > Personally I think we should enforce (using pre-commit hook) absolute
> > > > imports in the whole Airflow codebase. We use them already but it's
> > > > not written anywhere that this is a preferred way.
> > > >
> > > > I find absolute imports easier to understand and tremendously helpful
> > > > to understand the structure and interconnections in a codebase. It
> > > > also easier to refactor absolute imports than relative ones. The only
> > > > price of absolute imports is their length
> > > > (airflow.providers.google.cloud.operator.dataproc <3) but I still
> > > > prefere informativeness over amount of code.
> > > >
> > > > What is your opinion on this?
> > > >
> > > > Cheers,
> > > > Tomek
> > > >
> > >
> >
> >
> > --
> >
> > Jarek Potiuk
> > Polidea <https://www.polidea.com/> | Principal Software Engineer
> >
> > M: +48 660 796 129 <+48660796129>
> > [image: Polidea] <https://www.polidea.com/>
> >
>

Re: Import style in Airflow codebase

Posted by Kaxil Naik <ka...@gmail.com>.
No strong opinion but absolute import seems better from a user's
perspective.

On Wed, Sep 9, 2020 at 12:07 PM Jarek Potiuk <Ja...@polidea.com>
wrote:

> +1!
>
> On Wed, Sep 9, 2020 at 11:11 AM Ash Berlin-Taylor <as...@apache.org> wrote:
>
> > Get's my vote, certainly.
> >
> > Here's a PR to do it -- https://github.com/apache/airflow/pull/10825
> >
> > If no one complains in 24 hours lets merge that.
> >
> > On Sep 9 2020, at 9:35 am, Tomasz Urbaszek <to...@polidea.com>
> > wrote:
> >
> > > Hi all,
> > >
> > > I would like to spark a (hopefully short) discussion about import
> > > style in Airflow. In short: absolute vs relative imports.
> > > Reason for this discussion:
> > > https://github.com/apache/airflow/pull/10729#discussion_r485419342
> > >
> > > Personally I think we should enforce (using pre-commit hook) absolute
> > > imports in the whole Airflow codebase. We use them already but it's
> > > not written anywhere that this is a preferred way.
> > >
> > > I find absolute imports easier to understand and tremendously helpful
> > > to understand the structure and interconnections in a codebase. It
> > > also easier to refactor absolute imports than relative ones. The only
> > > price of absolute imports is their length
> > > (airflow.providers.google.cloud.operator.dataproc <3) but I still
> > > prefere informativeness over amount of code.
> > >
> > > What is your opinion on this?
> > >
> > > Cheers,
> > > Tomek
> > >
> >
>
>
> --
>
> Jarek Potiuk
> Polidea <https://www.polidea.com/> | Principal Software Engineer
>
> M: +48 660 796 129 <+48660796129>
> [image: Polidea] <https://www.polidea.com/>
>

Re: Import style in Airflow codebase

Posted by Jarek Potiuk <Ja...@polidea.com>.
+1!

On Wed, Sep 9, 2020 at 11:11 AM Ash Berlin-Taylor <as...@apache.org> wrote:

> Get's my vote, certainly.
>
> Here's a PR to do it -- https://github.com/apache/airflow/pull/10825
>
> If no one complains in 24 hours lets merge that.
>
> On Sep 9 2020, at 9:35 am, Tomasz Urbaszek <to...@polidea.com>
> wrote:
>
> > Hi all,
> >
> > I would like to spark a (hopefully short) discussion about import
> > style in Airflow. In short: absolute vs relative imports.
> > Reason for this discussion:
> > https://github.com/apache/airflow/pull/10729#discussion_r485419342
> >
> > Personally I think we should enforce (using pre-commit hook) absolute
> > imports in the whole Airflow codebase. We use them already but it's
> > not written anywhere that this is a preferred way.
> >
> > I find absolute imports easier to understand and tremendously helpful
> > to understand the structure and interconnections in a codebase. It
> > also easier to refactor absolute imports than relative ones. The only
> > price of absolute imports is their length
> > (airflow.providers.google.cloud.operator.dataproc <3) but I still
> > prefere informativeness over amount of code.
> >
> > What is your opinion on this?
> >
> > Cheers,
> > Tomek
> >
>


-- 

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

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

Re: Import style in Airflow codebase

Posted by Ash Berlin-Taylor <as...@apache.org>.
Get's my vote, certainly.

Here's a PR to do it -- https://github.com/apache/airflow/pull/10825

If no one complains in 24 hours lets merge that.

On Sep 9 2020, at 9:35 am, Tomasz Urbaszek <to...@polidea.com> wrote:

> Hi all,
> 
> I would like to spark a (hopefully short) discussion about import
> style in Airflow. In short: absolute vs relative imports.
> Reason for this discussion:
> https://github.com/apache/airflow/pull/10729#discussion_r485419342
> 
> Personally I think we should enforce (using pre-commit hook) absolute
> imports in the whole Airflow codebase. We use them already but it's
> not written anywhere that this is a preferred way.
> 
> I find absolute imports easier to understand and tremendously helpful
> to understand the structure and interconnections in a codebase. It
> also easier to refactor absolute imports than relative ones. The only
> price of absolute imports is their length
> (airflow.providers.google.cloud.operator.dataproc <3) but I still
> prefere informativeness over amount of code.
> 
> What is your opinion on this?
> 
> Cheers,
> Tomek
>