From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 4737E385116B for ; Thu, 13 Oct 2022 10:16:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4737E385116B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1AE951F38A; Thu, 13 Oct 2022 10:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1665656217; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=35nB2nhK57SOcMzlXtoROMd3QCiuLuUb/NfZ3S6dbxE=; b=CSuymKiow3vsmrcI6lZNUvhRCFd4cVWxCbfTbXRRaX3DQuMIrydVjs62mpQcoe37v9wtUG sLuf15DriKLTPr2L7TdgRq0zAkFzh8m84UUbBiEflzKsB5dNc6B+fzLstWKK4EKnxmDtmM YnF1r6KrR2qC0aHHbGT1MwRsaVICM4c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1665656217; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=35nB2nhK57SOcMzlXtoROMd3QCiuLuUb/NfZ3S6dbxE=; b=9XyUYj5oZw4dTxaoqUo9Ycb1aC6TwZA3NRmjEau8bjOPQmU3u1M+Sxx0xpVXzyYg6Usuro ZJ5xE9N9VslvA/Cw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CACF1139F3; Thu, 13 Oct 2022 10:16:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VT4sMJjlR2MJMAAAMHmgww (envelope-from ); Thu, 13 Oct 2022 10:16:56 +0000 Message-ID: <019f73ee-23aa-6bca-4ed8-93fbd86ed279@suse.cz> Date: Thu, 13 Oct 2022 12:16:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [DOCS] Python Language Conventions Content-Language: en-US To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com References: From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 10/13/22 12:03, Richard Sandiford wrote: > Martin Liška writes: >> I think we should add how Python scripts should be formatted. I noticed >> that while reading the Modula-2 patchset where it follows the C/C++ style >> when it comes to Python files. >> >> Ready to be installed? >> Thanks, >> Martin > > Did you consider requiring black formatting instead? Maybe black -l79 > to maintain the usual 80-character limit. No, the automatic formatting might be a next step. About 80 chars, can we relax that for Python scripts? I think it's hairy restriction these days. > > At least that way there's only one right answer. Yep. We can definitely recommend using black as an optional approach, what do you think? Martin > > Richard > >> >> --- >> htdocs/codingconventions.html | 14 ++++++++++++++ >> 1 file changed, 14 insertions(+) >> >> diff --git a/htdocs/codingconventions.html b/htdocs/codingconventions.html >> index e4d30510..180ef35a 100644 >> --- a/htdocs/codingconventions.html >> +++ b/htdocs/codingconventions.html >> @@ -80,6 +80,7 @@ the conventions separately from any other changes to the code.

>> >> >> >> +
  • Python Language Conventions >> >> >> >> @@ -1483,6 +1484,19 @@ with a right brace, optional closing comment, and a new line. >> Definitions within the body of a namespace are not indented. >>

    >> >> +

    Python Language Conventions

    >> + >> +

    >> +Python scripts should follow PEP 8 – Style Guide for Python Code >> +which can be verified by flake8 tool. >> +We do also recommend using the following flake8 plug-ins: >> + >> +

      >> +
    • flake8-builtins
    • >> +
    • flake8-import-order
    • >> +
    • flake8-quotes
    • >> +
    >> +

    >> >> >>