FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Enhance readability of .python-version by lmvysakh · Pull Request #1105 · actions/setup-python · GitHub

Enhance readability of .python-version - #1105

Closed
lmvysakh wants to merge 1 commit into
actions:mainfrom
lmvysakh:enhance-python-version-readability
Closed

Enhance readability of .python-version#1105
lmvysakh wants to merge 1 commit into
actions:mainfrom
lmvysakh:enhance-python-version-readability

Conversation

lmvysakh commented May 14, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

Enhance reading from .python-version file, matching the Pyenv behavior:

We extend our thanks to @krystof-k for the valuable contribution in implementing this feature in PR #787. To expedite its availability to users, we have created this PR, which incorporates the same changes while addressing the CI issues that had previously delayed the merge of PR #787.

Check list:

  • Tests were added or updated to cover the changes.

Copilot AI review requested due to automatic review settings May 14, 2025 11:10
lmvysakh requested a review from a team as a code owner May 14, 2025 11:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull Request Overview

This PR improves the readability and functionality when reading the .python-version file by supporting multiple versions, handling pyenv-virtualenv pointers, ignoring comments and empty lines, and trimming whitespace.

  • Updated the function name and logic in utils.ts to process multiple lines.
  • Refactored setup-python.ts and updated tests in tests/utils.test.ts to integrate the new behavior.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/utils.ts Renamed and updated function to support multi-line version files and pointer handling.
src/setup-python.ts Updated import and usage to reflect the new function name.
tests/utils.test.ts Added tests for multi-line files and updated expected outcomes.

Comment thread src/utils.ts
Comment on lines +284 to +287
if (line.startsWith('#') || line.trim() === '') {
return undefined;
}
let version: string = line.trim();

Copilot AI May 14, 2025

Copy link

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

[nitpick] Consider caching the result of line.trim() in a variable to avoid calling trim() multiple times within the mapping function.

Suggested change
if (line.startsWith('#') || line.trim() === '') {
return undefined;
}
let version: string = line.trim();
const trimmedLine = line.trim();
if (line.startsWith('#') || trimmedLine === '') {
return undefined;
}
let version: string = trimmedLine;

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

The relevant changes and improvements proposed here have already been addressed and implemented in PR #787. Hence, this PR is now superseded by #787, which provides a more comprehensive solution for the scenarios discussed. Therefore, we are closing this pull request.

lmvysakh closed this May 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

4 participants


Back | FazBrowse Home | New Git URL