> Agreed that we don't want to limit ourselves in terms of languages to
use, decisions like that should be made as a result of PR review.

Meant on a case-by-case basis during PR review.

On Wed, Apr 14, 2021 at 2:10 PM Zach Hoffman <[email protected]> wrote:

> Agreed that we don't want to limit ourselves in terms of languages to use,
> decisions like that should be made as a result of PR review.
>
> > For instance, `db/admin.pl` was replaced with Go instead of Python
> because we didn't want to add internet dependencies during installation and
> wanted a single static binary to include in the rpm.
>
> On the master branch but not in any release yet, we use a Python rewrite
> for the Postinstall script (install/bin/_postinstall) (which works
> according to both CDN in a Box and internal Comcast testing so far). No
> Python dependency is required, other than `python(abi)`, which is already
> satisfied by a stock CentOS install (checked CentOS 5 through 8). To verify
> that you have that dependency satisfied, you can run:
>
>     rpm -q --whatprovides 'python(abi)'
>
> It runs under Python 2.7 (CentOS 7) or Python 3.6+ (CentOS 8), using a
> `python(abi)`-provided Python binary or a normal Python binary that is
> already in the PATH, in case the host distro is not CentOS:
> https://github.com/apache/trafficcontrol/blob/1dc6a0678a/traffic_ops/install/bin/_postinstall#L1-L2
>
> So, that is not to say that we should converge on Python (or any other
> language), just that, if a given script supports both Python 2.7 and Python
> 3.6+ and has no Python module dependencies, Python is another language,
> besides Go, that we can use with no additional dependencies installed.
>
> -Zach
>
> On Wed, Apr 14, 2021 at 9:56 AM Rawlin Peters <[email protected]> wrote:
>
>> I don't think we should really make any kind of language suggestions
>> in the project. While I agree Python should be considered for scripts
>> that are too complex for Bash, there may be other reasons where it
>> would make more sense for it to be written in Go or some other
>> compiled language. For instance, `db/admin.pl` was replaced with Go
>> instead of Python because we didn't want to add internet dependencies
>> during installation and wanted a single static binary to include in
>> the rpm. For those reasons, Go was the best tool for the job, and we
>> should always try to use the best tool for the job rather than
>> requiring everyone to use a specific tool.
>>
>> - Rawlin
>>
>> On Wed, Apr 14, 2021 at 8:50 AM ocket 8888 <[email protected]> wrote:
>> >
>> > > What would that be for?
>> >
>> > Not much, to be honest. Just a suggestion. I also see I didn't mention
>> this
>> > originally, but the suggestion is also intended to specifically mention
>> > Python as a good choice for when rewriting old scripts from Perl.
>> >
>> > > From the homepage of the project, you can see what languages are
>> > leveraged and realize that by picking something else you run the risk of
>> > having your PR rejected for unmaintainability
>> >
>> > Sort of. If you looked a month ago using that decision-making process
>> you'd
>> > maybe conclude you should write your scripts in Perl. If you look today,
>> > you'll see:
>> > -
>> > - * Go 55.3% <https://github.com/apache/trafficcontrol/search?l=go>
>> > - * <https://github.com/apache/trafficcontrol/search?l=go>JavaScript
>> 12.2%
>> > <https://github.com/apache/trafficcontrol/search?l=javascript>
>> > <https://github.com/apache/trafficcontrol/search?l=java>
>> > - * Java 9.0% <https://github.com/apache/trafficcontrol/search?l=java>
>> > - * HTML 7.2% <https://github.com/apache/trafficcontrol/search?l=html>
>> > - <https://github.com/apache/trafficcontrol/search?l=typescript>*
>> TypeScript
>> > 4.3% <https://github.com/apache/trafficcontrol/search?l=typescript>
>> > - <https://github.com/apache/trafficcontrol/search?l=shell>* Shell 3.4%
>> > <https://github.com/apache/trafficcontrol/search?l=shell>
>> > * Other 8.6%
>> > <https://github.com/apache/trafficcontrol/search?l=shell>
>> >
>> > So you wouldn't see Python anywhere on that list
>> >
>> > On Tue, Apr 13, 2021 at 11:35 AM Gray, Jonathan
>> > <[email protected]> wrote:
>> >
>> > > What would that be for?  The project should accept useful additions
>> in any
>> > > maintainable language already.  From the homepage of the project, you
>> can
>> > > see what languages are leveraged and realize that by picking
>> something else
>> > > you run the risk of having your PR rejected for unmaintainability.  In
>> > > those cases, sharing links to the scripts are still useful on the
>> mailing
>> > > lists, but simply wouldn't be merged.
>> > >
>> > > Jonathan G
>> > >
>> > > On 4/13/21, 11:16 AM, "ocket 8888" <[email protected]> wrote:
>> > >
>> > >     I was thinking about adding a section to CONTRIBUTING.md and/or
>> the
>> > >     development docs that suggests Python as the language to use for
>> > > scripts
>> > >     that are too complex for bash but don't need the performance
>> afforded
>> > > by a
>> > >     compiled language - any objections?
>> > >
>> > >
>>
>

Reply via email to