Skip to content

Python build scripts: 2.x or 3.x? #33026

Closed
@sanmai-NL

Description

@sanmai-NL

I am about to contribute to src/bootstrap/bootstrap.py, so I checked whether it is supposed to run under Python 2.x or 3.x. I concluded that it is Python 3.x, since there is Python 3 code in there. ☂ Yet README.md says the dependency is on Python 2.x.

  1. I suppose README.md should be corrected?
  2. Additionally, in order to prevent confusion and compatibility problems, the shebang in all Python script files (i.e., a subset of all Python files) should explicitly refer to the required major Python version like so:
    .
#!/usr/bin/env python3

.
3. Finally, if no final decision has been made as to what version of Python and/or what version of the CPython implementation is required, I have the following order of preference:
CPython >=3.3 > CPython >=2.7 > Combined code base of CPython >=3.3 & >=2.7

Consider this official note that basically explains why Python 3 is preferred. I have found that src/bootstrap/bootstrap.py can be refactored to simpler and shorter code, especially when the CPython >=3.3 standard library is available. (Not that I am happy about the CPython dependency for Rust building in general.)

This official release engineering page states that CPython 3.2 and below are EOL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions