-
Notifications
You must be signed in to change notification settings - Fork 631
Add version parsing from Pipfile #1067
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
base: main
Are you sure you want to change the base?
Add version parsing from Pipfile #1067
Conversation
f387444
to
0fc6a29
Compare
Hi @aradkdj, Thanks! |
0fc6a29
to
c44ab2e
Compare
Hi @aradkdj, |
Sure. I took a look at it and could not figure out why it's failing on CI but not on the unit tests. Any pointer would be appreciated |
Hi @aradkdj,
Since 'Pipenv' doesn't match 'Pipfile', the corresponding logic isn't triggered. Please update the file name to resolve the issue. |
c44ab2e
to
e87e3e9
Compare
Sorry I missed that. It should be fixed now |
Hi @aradkdj, If you need any help interpreting the logs or fixing a specific error, feel free to share the error details here and we can assist further. |
Merged and checked if the dist changes. But it didn't. If I understand the errors correctly they come from annotations about the installed |
Hi @aradkdj, |
4302de9
to
9485ba7
Compare
9485ba7
to
ee0eb5b
Compare
ee0eb5b
to
b62f6a8
Compare
@mahabaleshwars this should be passing now. Sorry for the delay |
There was a problem hiding this 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 PR adds support for parsing Python versions from a Pipfile via the python-version-file
option.
- Introduces
getVersionInputFromPipfileFile
and hooks it intogetVersionInputFromFile
. - Updates docs and CI workflows to demonstrate and test Pipfile usage.
- Adds unit tests covering
python_version
,python_full_version
, and empty Pipfile cases.
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/utils.ts | Implement getVersionInputFromPipfileFile and integrate it |
docs/advanced-usage.md | Document how to use Pipfile with python-version-file |
tests/utils.test.ts | Add tests for Pipfile parsing scenarios |
.github/workflows/test-python.yml | Add Pipfile-based setup jobs for python_version and python_full_version |
.github/workflows/test-python-freethreaded.yml | Add equivalent Pipfile jobs in the freethreaded workflow |
* Python version extracted from the Pipfile file. | ||
*/ | ||
export function getVersionInputFromPipfileFile(versionFile: string): string[] { | ||
core.debug(`Trying to resolve version form ${versionFile}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the debug message: "version form" should be "version from".
core.debug(`Trying to resolve version form ${versionFile}`); | |
core.debug(`Trying to resolve version from ${versionFile}`); |
Copilot uses AI. Check for mistakes.
} | ||
|
||
core.info(`Extracted ${versions} from ${versionFile}`); | ||
return [extractValue(pipfileConfig, keys)] as string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return ignores the previously built versions
array and may return [undefined]
. It should return versions
to properly reuse the filtered values and handle missing versions.
return [extractValue(pipfileConfig, keys)] as string[]; | |
return versions; |
Copilot uses AI. Check for mistakes.
*/ | ||
export function getVersionInputFromPipfileFile(versionFile: string): string[] { | ||
core.debug(`Trying to resolve version form ${versionFile}`); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider checking if versionFile
exists (e.g., with fs.existsSync
) and emitting a warning before calling readFileSync
to prevent unhandled exceptions.
if (!fs.existsSync(versionFile)) { | |
core.warning(`File ${versionFile} does not exist.`); | |
return []; | |
} |
Copilot uses AI. Check for mistakes.
Description:
Add version parsing from a Pipfile, passed through the
python-version-file
option.Related issue:
#574
Check list: