PEP 829: Structured Startup Configuration via .site.toml Files

One has a concrete proposal, the other doesn’t (yet?).

Like I said before, I’m not interested in going in that direction, because I still think the declarative approach outlined in 829 is the right way to go. But I also won’t discourage someone else from proposing an alternative and seeing where the chips land.

2 Likes

Fine, I’ll turn my proposal into a PEP.

But honestly, a problem here is that I don’t see a way to advocate for “do nothing, all of this simply isn’t worth the upheaval”. Which is really what I think[1]. My gut feeling from this thread is that there isn’t a huge amount of support in the community for the proposal - but I’m very aware that who posts in this type of thread is a very unbalanced cross-section of the community. On the other hand, I know of no way of getting a sense of what the SC might think of the proposal, so I’m left in a position where I feel that I need to submit a “damage limitation” PEP that explains how to get most of the benefits of PEP 829 without the disruption of a new file format - particularly if you’re using the argument that PEP 829 is the better option because it has a formal proposal…


  1. With the proviso that I believe that deprecation of “extra code on the import line” in .pth files could have been achieved with nothing more than the normal PR process, if we hadn’t already escalated the debate into PEP territory. ↩︎

8 Likes

If we really need to write a counter PEP just to say no to this one then here you go…

PEP ~829 – Not changing .pth files

Abstract

Lets leave .pth files alone.

Motivation

Breaking stuff without good motivation is unhelpful.

Specification

We will make the following changes:

Rationale

No changes being proposed actually fix anything wrong with .pth files (which in itself, no-one can define) or provide any new functionality that we have any use for.

Backwards Compatibility

None. Not even for the use cases we didn’t even know about.

Security Implications

Not doing anything that could be misconstrued as a security feature is a security feature!

How to Teach This

Python users who don’t know or care that we’re having this discussion may carry on doing so.

Reference Implementation

See any semi-recent Python version.

Rejected Ideas

  • Descoping existing .pth files so they can at most, import another module with side effects to achieve the same thing
    Why bother? It achieves the same thing.

  • Turning .pth files into a structured config file
    Same again.

(Sorry, I couldn’t help myself :slight_smile:)

2 Likes

It seems like this alternative should just be a “rejected idea” in the pep, with an actual explanation why it wasn’t the preferred direction. The SC shouldn’t need a competing proposal just to see that argument.

5 Likes

That’s really the main tension I see, and that’s why I’ve been asking about the intended use cases: We want very different capabilities for external packages vs. the user’s own customization. Not even from a security standpoint, but for package interoperability and because tools need to support this, where .pth files are a problem today (that’s why I’m engaging here, I care the user experience in the interaction of these features with tools)

My experience is that these custom formats cause all sorts of problems (we certainly have them with WHEEL, METADATA and PEP 508), so I’d prefer an existing, structured format.

4 Likes

I agree. If the argument is, “reject this PEP for these reasons”, that should be covered in the Rejected Ideas section. Same goes for a more restrictive .pth file format if people think that doesn’t require a PEP or don’t want to write a PEP unless the SC says they prefer that approach.

3 Likes

@pf_moore and I had an actual conversation (imagine that!). It was quite pleasant and I think we may have some common ground. I’ll work on an updated 829 in the next couple of days.

14 Likes

Yep, exactly. The trick is that the narrowed syntax would be valid on all existing versions, so affected projects would just need to migrate to that narrowed format before the deprecation period ran out. No need to ship two different formats, just stop using the deprecated constructs (replacing them with an importable callable).

In the case of legacy namespace packages, it would potentially be feasible to migrate over to native namespace packages and drop the associated .pth file entirely.

1 Like