Skip to content

Add Architecture-Specific PATH Management for Python with --user Flag on Windows #1122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

aparnajyothi-y
Copy link
Contributor

Description:
This update modifies the PATH handling for Python installations on Windows, specifically for the --user flag. For Python 3.10 and above, architecture-specific directories (e.g., Python310-32) are added to the PATH, while for earlier versions, the default --user path is used. This ensures proper environment configuration for user-installed Python versions based on version and architecture.

Related issue:
#1005

@Copilot Copilot AI review requested due to automatic review settings June 6, 2025 13:13
@aparnajyothi-y aparnajyothi-y requested a review from a team as a code owner June 6, 2025 13:13
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request improves the PATH configuration for Windows Python installations when using the --user flag by adding architecture-specific directory handling for Python 3.10+ and adjusting for freethreaded builds.

  • Moves a debug log to a new location
  • Introduces new logic to append architecture-specific suffixes to the PATH for Windows
  • Updates the construction of the user Scripts directory
Comments suppressed due to low confidence (1)

src/find-python.ts:164

  • [nitpick] Consider clarifying the conditional handling of the architecture. Using explicit variables or abstractions for base architecture and freethreaded variations can reduce confusion between 'x86' and 'x86-freethreaded' cases.
if (architecture === 'x86' && (major > 3 || (major === 3 && minor >= 10))) {

Comment on lines +162 to +176
// Append '-32' for x86 architecture if Python version is >= 3.10
if (
architecture === 'x86' &&
(major > 3 || (major === 3 && minor >= 10))
) {
versionSuffix += '-32';
} else if (architecture === 'arm64') {
versionSuffix += '-arm64';
}
// Append 't' for freethreaded builds
if (freethreaded) {
versionSuffix += 't';
if (architecture === 'x86-freethreaded') {
versionSuffix += '-32';
} else if (architecture === 'arm64-freethreaded') {
Copy link
Preview

Copilot AI Jun 6, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider refactoring the nested freethreaded logic to clearly separate the base architecture check from freethreaded adjustments. This may help prevent potential misconfigurations when combining freethreaded and architecture-specific suffixes.

Suggested change
// Append '-32' for x86 architecture if Python version is >= 3.10
if (
architecture === 'x86' &&
(major > 3 || (major === 3 && minor >= 10))
) {
versionSuffix += '-32';
} else if (architecture === 'arm64') {
versionSuffix += '-arm64';
}
// Append 't' for freethreaded builds
if (freethreaded) {
versionSuffix += 't';
if (architecture === 'x86-freethreaded') {
versionSuffix += '-32';
} else if (architecture === 'arm64-freethreaded') {
// Determine base architecture suffix
if (architecture === 'x86' && (major > 3 || (major === 3 && minor >= 10))) {
versionSuffix += '-32';
} else if (architecture === 'arm64') {
versionSuffix += '-arm64';
}
// Adjust for freethreaded builds
if (freethreaded) {
versionSuffix += 't';
if (architecture.includes('x86')) {
versionSuffix += '-32';
} else if (architecture.includes('arm64')) {

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant