You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beam.apache.org by Joey Tran <jo...@schrodinger.com> on 2023/10/02 16:58:42 UTC

[PYTHON] Yapf configurations to prevent workflow mangling

Does anyone have any recommendations on how to get yapf to play nicely with
beam workflows? Left to its own, it absolutely destroys the readability of
a workflow. The solution is simple enough by just adding # yapf:disables
everywhere but it's not really ideal. Are there any specific yapf knobs
recommended for mitigating this?

Best,
Joey

-- 

Joey Tran | Senior Developer Il | AutoDesigner TL

*he/him*

[image: Schrödinger, Inc.] <https://schrodinger.com/>

Re: [PYTHON] Yapf configurations to prevent workflow mangling

Posted by Joey Tran <jo...@schrodinger.com>.
Okay. I was hoping I'd find some simple flag to switch off/on but turns out
it's just the google yapf style that doesn't mesh well with beam workflows
(i.e. `based_on_style=google`). Will dig through yapf settings to see if
there's a knob that can be used in conjunction with the google style to do
what I want, just wanted to update in case anyone happens to already have a
solution

On Wed, Oct 4, 2023 at 9:37 AM Joey Tran <jo...@schrodinger.com> wrote:

> Huh, the default yapf settings _do_ seem to play nicely with beam after
> all. I tried creating a bare dir and created a wordcount.py with one
> transform per line and tried formatting with both yapf==0.29 and yapf==0.31
> (what we currently use), and both left the workflow nicely divided with one
> transform per line.
>
> Looks like it's something up with my project's particular yapf settings.
> Should've checked that first before posting. Thanks for the response and
> apologies for the noise!
>
> On Wed, Oct 4, 2023 at 9:06 AM Ahmed Abualsaud via user <
> user@beam.apache.org> wrote:
>
>> Hey Joey,
>>
>> I had similar problems where yapf was reformatting every file until I
>> explicitly installed yapf==0.29.0, which is what Beam uses
>> <https://github.com/apache/beam/blob/95af465f0dfaa123364e5880bccc3dff32a19b39/sdks/python/tox.ini#L245>.
>> Can you check if you have a different version installed?
>>
>> Best,
>> Ahmed
>>
>> On Mon, Oct 2, 2023 at 12:59 PM Joey Tran <jo...@schrodinger.com>
>> wrote:
>>
>>> Does anyone have any recommendations on how to get yapf to play nicely
>>> with beam workflows? Left to its own, it absolutely destroys the
>>> readability of a workflow. The solution is simple enough by just adding #
>>> yapf:disables everywhere but it's not really ideal. Are there any specific
>>> yapf knobs recommended for mitigating this?
>>>
>>> Best,
>>> Joey
>>>
>>> --
>>>
>>> Joey Tran | Senior Developer Il | AutoDesigner TL
>>>
>>> *he/him*
>>>
>>> [image: Schrödinger, Inc.] <https://schrodinger.com/>
>>>
>>

Re: [PYTHON] Yapf configurations to prevent workflow mangling

Posted by Joey Tran <jo...@schrodinger.com>.
Huh, the default yapf settings _do_ seem to play nicely with beam after
all. I tried creating a bare dir and created a wordcount.py with one
transform per line and tried formatting with both yapf==0.29 and yapf==0.31
(what we currently use), and both left the workflow nicely divided with one
transform per line.

Looks like it's something up with my project's particular yapf settings.
Should've checked that first before posting. Thanks for the response and
apologies for the noise!

On Wed, Oct 4, 2023 at 9:06 AM Ahmed Abualsaud via user <
user@beam.apache.org> wrote:

> Hey Joey,
>
> I had similar problems where yapf was reformatting every file until I
> explicitly installed yapf==0.29.0, which is what Beam uses
> <https://github.com/apache/beam/blob/95af465f0dfaa123364e5880bccc3dff32a19b39/sdks/python/tox.ini#L245>.
> Can you check if you have a different version installed?
>
> Best,
> Ahmed
>
> On Mon, Oct 2, 2023 at 12:59 PM Joey Tran <jo...@schrodinger.com>
> wrote:
>
>> Does anyone have any recommendations on how to get yapf to play nicely
>> with beam workflows? Left to its own, it absolutely destroys the
>> readability of a workflow. The solution is simple enough by just adding #
>> yapf:disables everywhere but it's not really ideal. Are there any specific
>> yapf knobs recommended for mitigating this?
>>
>> Best,
>> Joey
>>
>> --
>>
>> Joey Tran | Senior Developer Il | AutoDesigner TL
>>
>> *he/him*
>>
>> [image: Schrödinger, Inc.] <https://schrodinger.com/>
>>
>

Re: [PYTHON] Yapf configurations to prevent workflow mangling

Posted by Ahmed Abualsaud via user <us...@beam.apache.org>.
Hey Joey,

I had similar problems where yapf was reformatting every file until I
explicitly installed yapf==0.29.0, which is what Beam uses
<https://github.com/apache/beam/blob/95af465f0dfaa123364e5880bccc3dff32a19b39/sdks/python/tox.ini#L245>.
Can you check if you have a different version installed?

Best,
Ahmed

On Mon, Oct 2, 2023 at 12:59 PM Joey Tran <jo...@schrodinger.com> wrote:

> Does anyone have any recommendations on how to get yapf to play nicely
> with beam workflows? Left to its own, it absolutely destroys the
> readability of a workflow. The solution is simple enough by just adding #
> yapf:disables everywhere but it's not really ideal. Are there any specific
> yapf knobs recommended for mitigating this?
>
> Best,
> Joey
>
> --
>
> Joey Tran | Senior Developer Il | AutoDesigner TL
>
> *he/him*
>
> [image: Schrödinger, Inc.] <https://schrodinger.com/>
>