Should we have a `Platforms/` directory in the repo?

If you look at the top level of the repo you will find a few directories dedicated to various platforms:

  1. Android
  2. Apple
  3. Mac
  4. PC
  5. PCbuild
  6. iOS/Resources/bin

While at the core dev sprints I brought up moving WASI to the top-level and out from under Tools/wasm (and I suspect Emscripten would also like to move). @thomas suggested consolidating all the platforms into a Platforms/ directory to prevent proliferation while @freakboy3742 mentioned he was at least consolidating non-macOS Apple platforms under Apple/ and suggested potentially a WASM/ directory.

So, should we try to consolidate all of these platform directories under a unified Platforms/ and that’s where I move the WASI stuff? If not, are people okay with a WASI/ and Emscpriten/ top directories or a top WASM/ top directory that contains both (and if not any of these, why not when it’s tier 2 and we have tier 3 platforms with top-level directories)?

12 Likes

I’m worried about the compatibility impact on users of moving PCbuild. That’s going to be hard coded into so many scripts out there (possibly mostly mine…), and generally those scripts aren’t going to have nice ways to choose an alternative location based on repo version (as in, they currently work for all 3.x versions, and have no easy way to tell that they’re on 3.15 other than checking if a file exists - not a great migration path). It’s also going to be in many contribution tutorials, since that’s where the main build steps/projects are for Windows. It’s also the output location for binaries, which means even more cases where it’s assumed (including throughout CPython/stdlib/test suite).

Moving PC isn’t such a big deal, though it’s worth considering that it largely contains source files and not auxiliary files (there are some, such as the PC/layout script[1] and the classicAppCompat files[2]). Maybe the modules are better off going under Modules and the rest going into PCbuild?

Anything fairly new is good to consolidate I think, especially if it doesn’t include an entrypoint used widely by other users. Though maybe it all falls into that category and there’s no way to move anything without causing disruption? In which case, we should probably get a better entrypoint in place first (maybe a top-level build script that can delegate properly) and then move the underlying scripts later?


  1. Which kind of falls into the same problem as PCbuild, though probably should’ve been in Tools from the start. ↩︎

  2. Which can be deleted now we no longer release directly to the Store. ↩︎

3 Likes

tl;dr:

  • I agree WASM should become a top-level folder.
  • I don’t really mind one way or the other if we have a top level Platform folder; the only real issue there is backwards compatibility - see below for details.

The Apple folder is the result of the consolidation process that I described - although it only contains the iOS code at present. This change mostly made it easier to maintain my external tvOS/watchOS/visionOS patches (with a view to submitting them upstream at some point). I

iOS is entirely vestigial at this point; it only exists because the buildbot doesn’t have a mechanism to identify the base Python version against which a PR has been developed. With a change to buildbot to allow for the buildbot to use different rulesets for 3.13 vs 3.14+ PRs, the iOS directory could be purged.

I imagine similar problems would exist for other platforms - Android and Emscripten would definitely be affected by this.

1 Like

I will say that moving Tools/wasm/wasi.py to Tools/wasm/wasi/__main__.py was a bit of work updating all of my stuff, so I think it’s unavoidable.

1 Like

I actually had to turn off PR builds for older Python versions and put all the smarts into Tools/wasm/wasi to work around the limitation.

I feel a Platforms/ directory makes sense at least for new (or newish) platforms, but it may not be worth the disruption to move some existing folders with a long history (e.g., PCbuild/ has been in the repo since 1997, Mac/ since 1990). On the other hand, the mobile and WASM folders that are fairly new could perhaps be moved.

4 Likes

I would be fine with WASI/ and Emscpriten/ top directories. I’m not sure that it’s worth it to have a Platforms/ sub-directory. We can live with a flat structure :slight_smile:

Moving existing directories into a Platforms/ sub-directory may cause a lot of troubles, I don’t think that it’s worth it.

1 Like

I don’t have any skin in this game, just thinking that any backwards incompatibilty could be momentarily fixed with symlinks right? But that might not work on all platforms…

Windows doesn’t necessarily have symlinks support turned on.

1 Like

So, no real consensus, and in fact responses ran the entire gamut of options. :sweat_smile: So here’s a poll to see if there’s more consensus if people don’t have to type anything. I turned on ranked choice to see if that causes anything to be clearer because people’s second choice happens to be aligned or something. The poll is open for about week since I typically work on WASI stuff on Wednesdays and so I can start work on moving stuff then. I’ve also restricted voting to committers since we will be the ones living with the decision the longest.

Note that some of the options have (Wasm)? in them to signify that portion of the path could be there, but it isn’t important enough to make yet another option just to support that possibility (I would assume Russell, Hood, and I would talk things over if one of those options won to decide what we wanted).

Also assume that whatever gets chosen will lead to a similar thing being done for Emscripten.


Where should the directory for WASI-specific stuff be?
  • WASI/
  • Wasm/WASI/
  • Platforms/(Wasm)?/WASI/ but do NOT move anything
  • Platforms/(Wasm)?/WASI/ AND move things
0 voters

@brettcannon What would “AND move things” entail? I.e. what things would be moved/not moved between options 3 and 4?

A

1 Like

That’s a wider discussion, but I think it’s a question of whether we force/encourage others to move. Basically I view options 3 and 4 as “only new stuff” versus “we try to at least move what other platforms we can stand to”.

1 Like

I really like the idea of having Platforms/, but I don’t see much utility in adding it unless we’re moving other things under it (like iOS, Android, Emscripten, etc.). Creating the Platforms directory just to stick WASI in it feels like premature organization. It adds a level of hierarchy without clear benefit, IMO.

8 Likes