-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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: update poetry-core via poetry self update #5306
Conversation
cd981c9
to
48906b8
Compare
48906b8
to
e21536f
Compare
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.
Looks good overall but could use a little tweaking. Also, I strongly dislike the use of scoped imports -- is there any real benefit to those? If not, hoist them to the top of the file with everything else.
] | ||
|
||
if not update_releases: | ||
self.line("You are using the latest version") |
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.
self.line("You are using the latest version") | |
self.line("You are already using the latest version.") |
f"<c1>{release.pretty_name}</c1> to <c2>{release.version}</c2>" | ||
for release in update_releases | ||
] | ||
self.line(f"Updating {' and '.join(msg)}.") |
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.
self.line(f"Updating {' and '.join(msg)}.") | |
self.line(f"Updating {', '.join(msg)}.") |
self._make_bin() | ||
|
||
self.line("") | ||
self.line(f"Successfully updated {' and '.join(msg)}. Great!") |
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.
self.line(f"Successfully updated {' and '.join(msg)}. Great!") | |
self.line(f"Successfully updated {', '.join(msg)}!") |
if dependency.name == "poetry-core": | ||
if core and not dependency.constraint.allows(Version.parse(core)): | ||
raise PoetrySimpleConsoleException( | ||
f"poetry-core {core} is not supported by poetry" |
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.
f"poetry-core {core} is not supported by poetry" | |
f"poetry-core {core} is not supported by Poetry" |
break | ||
else: | ||
raise PoetrySimpleConsoleException( | ||
"No compatible version of poetry-core for poetry" |
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.
"No compatible version of poetry-core for poetry" | |
"No compatible version of poetry-core for Poetry" |
version = self.argument("version") | ||
if not version: | ||
version = ">=" + __version__ | ||
is_prerelease = Version.parse(metadata.version("poetry")).is_prerelease() | ||
version = ">=" + metadata.version("poetry") |
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.
Use str.format() here -- it's a bit more readable.
version = ">=" + metadata.version("poetry") | ||
|
||
release = self._find_release( | ||
"poetry", version, is_prerelease or self.option("preview") |
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.
Please use these as kwargs for readability.
f" {poetry_release.version}." | ||
) | ||
|
||
core_release = self._find_release("poetry-core", core, True) |
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.
Use kwargs here, please.
|
||
env = EnvManager.get_system_env(naive=True) | ||
|
||
# We can't use is_relative_to() since it's only available in Python 3.9+ |
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 comment could be a little more descriptive -- we're throwing away the result of the env.path
call because it throws an exception when the paths are not adjacent, right?
Closing in favor of #5450 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Running
poetry self update
now updates to a newpoetry-core
release, even if there is no newpoetry
release.Via a new parameter
--core
it is possible to define a specific version ofpoetry-core
to update to.Furthermore
poetry self update
now updates to a newpoetry
pre-release version, if the current installed version is a pre-release version as well.Pull Request Check List
Resolves: #issue-number-here