Hi all,

Some responses inline below. The other thing I'll mention is that I believe
we can integrate it in a way where it's completely invisible to most
developers. You can edit a file with whatever style you want, then after
you run black it will be in the PEP8 style. From my experience, the only
things that need to be manually changed are quoted strings that are more
than 80 characters.

On Thu, Mar 4, 2021 at 6:49 AM Giacomo Travaglini via gem5-dev <
gem5-dev@gem5.org> wrote:

> Hi Jason,
>
> This is great news. When you say it is not configurable, do you mean it is
> not possible to suppress warning/errors or do you
> mean it is not possible to come up with custom rules?
>

There is a way to suppress changes by modifying the file with a comment `#
fmt: off`. You can also exclude files with a dotfile (like .gitignore).


>
> As I presume it's the first case, I am wondering if a different linter
> might provide such capabilities:
>
>
> https://books.agiliq.com/projects/essential-python-tools/en/latest/linters.html
>
> Is there a reason to prefer black over other linters?
>

It's owned by the python software foundation, which makes it seem
"official". Though the real reason is that it's the first one I looked at
and the only one I investigated.


>
> Kind regards
>
> Giacomo
>
> > -----Original Message-----
> > From: Gabe Black via gem5-dev <gem5-dev@gem5.org>
> > Sent: 04 March 2021 03:59
> > To: gem5 Developer List <gem5-dev@gem5.org>
> > Cc: Gabe Black <gabe.bl...@gmail.com>
> > Subject: [gem5-dev] Re: RFC: run python Black on gem5 python code
> >
> > I'm a little worried about the no exceptions part of that, since we
> might have
> > some weird restrictions that we have to do weird things to work around,
> but I
> > can't really think of an example of that off hand. I'd want to look at
> it to see
> > how much wiggle room there is in the style, since I think ironclad rules
> which
> > make no accommodation for occasional common sense are maybe more
> > trouble than they're worth. I'm not opposed to having at least some
> stated
> > standard for python though, and the "official" one seems like a pretty
> > reasonable choice. I guess it's fine with me, up until it causes me some
> sort of
> > problem :-)
>

I actually think it's a feature not a bug. With an "uncompromising Python
code formatter" there can be no arguments in code review about the style.


> >
> > Maybe the right thing to do would be to give it a shot but not make it
> > compulsory until we have a feeling for how much trouble it is.
> >
> >
> > Gabe
> >
> > On Wed, Mar 3, 2021 at 11:24 AM Bobby Bruce via gem5-dev <gem5-
> > d...@gem5.org <mailto:gem5-dev@gem5.org> > wrote:
> >
> >
> > Sounds like a good idea to me.
> > ---
> >
> > Dr. Bobby R. Bruce
> > Room 2235,
> > Kemper Hall, UC Davis
> > Davis,
> > CA, 95616
> >
> >
> > web: https://www.bobbybruce.net
> >
> >
> >
> > On Wed, Mar 3, 2021 at 10:11 AM Daniel Carvalho via gem5-dev
> > <gem5-dev@gem5.org <mailto:gem5-dev@gem5.org> > wrote:
> >
> >
> > +1
> >
> >
> > Em quarta-feira, 3 de março de 2021 14:35:57 BRT, Jason
> > Lowe-Power via gem5-dev <gem5-dev@gem5.org <mailto:gem5-
> > d...@gem5.org> > escreveu:
> >
> >
> > Hi all,
> >
> > Right now, we don't have an official style guide for python.
> > Our style guide
> > (http://www.gem5.org/documentation/general_docs/development/coding_st
> > yle/) is very C++ focused.
> >
> > I would like to propose adopting a relatively strict PEP 8 style
> > guide: https://www.python.org/dev/peps/pep-0008. This is the "official"
> style
> > guide for python (as much as there is anything official). I say
> "relatively strict"
> > to mean that we will limit our exceptions *as much as possible*.
> >
> > To implement this, Andreas S. recently pointed me to the
> > "Black" package (https://pypi.org/project/black/) which automatically
> fixes
> > code style. I just tried it out with gem5art (patch coming soon) and
> found that
> > it works really well. The only downside is that it's not configurable at
> all.
> > Adding special cases would be almost impossible.
> >
> > Concrete and specific proposal:
> > - Adopt PEP 8 as our official style guide
> > - Use black to reformat all python code in src/
> > - Use black to reformat code in configs/
> > - Use black to reformat other python code
> >
> > - Use black as part of our commit hook to make sure all future
> > python is formatted to PEP 8
> >
> > Let me know what you think!
> >
> > Cheers,
> > Jason
> >
> > _______________________________________________
> > gem5-dev mailing list -- gem5-dev@gem5.org <mailto:gem5-
> > d...@gem5.org>
> > To unsubscribe send an email to gem5-dev-le...@gem5.org
> > <mailto:gem5-dev-le...@gem5.org>
> > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
> > _______________________________________________
> > gem5-dev mailing list -- gem5-dev@gem5.org <mailto:gem5-
> > d...@gem5.org>
> > To unsubscribe send an email to gem5-dev-le...@gem5.org
> > <mailto:gem5-dev-le...@gem5.org>
> > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
> >
> > _______________________________________________
> > gem5-dev mailing list -- gem5-dev@gem5.org <mailto:gem5-
> > d...@gem5.org>
> > To unsubscribe send an email to gem5-dev-le...@gem5.org
> > <mailto:gem5-dev-le...@gem5.org>
> > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>
> IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy the
> information in any medium. Thank you.
> _______________________________________________
> gem5-dev mailing list -- gem5-dev@gem5.org
> To unsubscribe send an email to gem5-dev-le...@gem5.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to