Skip to content

Add architecture (ISA) awareness to Python discovery#3815

Merged
gaborbernat merged 12 commits intotox-dev:mainfrom
rahuldevikar:feature/architecture-aware-discovery
Feb 24, 2026
Merged

Add architecture (ISA) awareness to Python discovery#3815
gaborbernat merged 12 commits intotox-dev:mainfrom
rahuldevikar:feature/architecture-aware-discovery

Conversation

@rahuldevikar
Copy link
Copy Markdown
Collaborator

This change makes tox aware of the CPU architecture (ISA) when discovering and validating Python interpreters.
It closes #3069 and addresses the consolidated requests in #3320, #3137, and #2535.

For context:

On machines that can run multiple architectures — like Apple Silicon running both arm64 and x86_64 through Rosetta, or Linux with qemu-user — tox now lets you pin an environment to a specific architecture via base_python. For example, cpython3.12-64-arm64 will only match an ARM interpreter, and tox will fail if the discovered interpreter doesn't match, the same way it already does for version mismatches.

The architecture is derived from sysconfig.get_platform() (e.g. linux-x86_64, macosx-14.0-arm64) and flows through virtualenv's PythonSpec, which normalizes common aliases (amd64 → x86_64, aarch64 → arm64).

Needs virtualenv >= 20.39 at runtime

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

@rahuldevikar
Copy link
Copy Markdown
Collaborator Author

rahuldevikar commented Feb 23, 2026

Waiting on virtualenv new release(>=20.39)

@gaborbernat
Copy link
Copy Markdown
Member

gaborbernat commented Feb 23, 2026

@rahuldevikar
Copy link
Copy Markdown
Collaborator Author

@rahuldevikar rahuldevikar marked this pull request as ready for review February 23, 2026 19:14
Copy link
Copy Markdown
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have a test via tox r -e pyxy-{platform} to validate this. The machine should be a valid factor.

@gaborbernat gaborbernat merged commit c754e8b into tox-dev:main Feb 24, 2026
28 checks passed
@Tenzer
Copy link
Copy Markdown

Tenzer commented Feb 24, 2026

Given this code depends on virtualenv 20.39, should the dependency on virtualenv not be adjusted to reflect this?

"virtualenv>=20.38",

I assume that's what is causing the CI failure here, when running with tox 4.46.0: https://github.com/Memrise/mypy-json-report/actions/runs/22365072220/job/64728762783?pr=268.

@Tenzer
Copy link
Copy Markdown

Tenzer commented Feb 24, 2026

Just as a follow up, the test failure was fixed by updating the virtualenv version to 20.39.

@rahuldevikar
Copy link
Copy Markdown
Collaborator Author

Thanks @Tenzer, it would probably be better if we update the min version.

kajinamit added a commit to kajinamit/tox that referenced this pull request Feb 25, 2026
The recent 4.46.0 release introduced the feature[1] which requires
virtualenv>=20.39.0 .

[1] tox-dev#3815
kajinamit added a commit to kajinamit/tox that referenced this pull request Feb 25, 2026
The recent 4.46.0 release introduced the feature[1] which requires
virtualenv>=20.39.0 .

[1] tox-dev#3815
@kajinamit
Copy link
Copy Markdown
Contributor

Just as a follow up, the test failure was fixed by updating the virtualenv version to 20.39.

We are seeing the CI failure exactly caused by this, and I proposed #3829 to fix it.
Ideally older versions after 4.46.0 needs to be yanked to avoid installation of incompatible versions, though I'm unsure if that's desired .

kajinamit added a commit to kajinamit/tox that referenced this pull request Feb 25, 2026
The recent 4.46.0 release introduced the feature[1] which requires
virtualenv>=20.39.0 .

[1] tox-dev#3815
kajinamit added a commit to kajinamit/tox that referenced this pull request Feb 25, 2026
The recent 4.46.0 release introduced the feature[1] which requires
virtualenv>=20.39.0 .

[1] tox-dev#3815
gaborbernat pushed a commit that referenced this pull request Feb 25, 2026
The recent 4.46.0 release introduced the feature[1] which requires
virtualenv>=20.39.0 .

[1] #3815

- [x] ran the linter to address style issues (`tox -e fix`)
- [x] wrote descriptive pull request text
- [x] ensured there are test(s) validating the fix
- [x] added news fragment in `docs/changelog` folder
- [x] updated/extended the documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Selection by platform architecture, like arm64. x86_64, amd64 ...

4 participants