Skip to content
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

feat: added python-version-strategy config option, to enable enforcing use of the lowest supported (approximate) version #775

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/setup-python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function resolveVersionInputFromDefaultFile(): string[] {
function resolveVersionInput() {
let versions = core.getMultilineInput('python-version');
const versionFile = core.getInput('python-version-file');
const versionStrategy = core.getInput('python-version-strategy');

if (versions.length) {
if (versionFile) {
Expand All @@ -73,6 +74,9 @@ function resolveVersionInput() {
}
}

if(versionStrategy == "approximate")
Copy link
Author

Choose a reason for hiding this comment

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

Might be better to make the versionStrategy directly take ~ as an argument, so that it can be used for all kinds of version overrides.

Not sure if there are uses for overriding the strategy to ^ however.

versions.map(v => v.replace(">=", "~").replace("^", "~"));

return versions;
}

Expand Down