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: update poetry-core via poetry self update #5306

Closed
wants to merge 1 commit into from

Conversation

finswimmer
Copy link
Member

@finswimmer finswimmer commented Mar 13, 2022

Running poetry self update now updates to a new poetry-core release, even if there is no new poetry release.

Via a new parameter --core it is possible to define a specific version of poetry-core to update to.

Furthermore poetry self update now updates to a new poetry pre-release version, if the current installed version is a pre-release version as well.

Pull Request Check List

Resolves: #issue-number-here

  • Added tests for changed code.
  • Updated documentation for changed code.

@finswimmer finswimmer force-pushed the self-update-core branch 4 times, most recently from cd981c9 to 48906b8 Compare March 13, 2022 16:27
@finswimmer finswimmer changed the title wip: update poetry-core via poetry self update feat: update poetry-core via poetry self update Mar 13, 2022
@finswimmer finswimmer requested a review from a team March 13, 2022 16:44
@finswimmer finswimmer marked this pull request as ready for review March 13, 2022 16:44
Copy link
Member

@neersighted neersighted left a 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")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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)}.")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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!")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"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")
Copy link
Member

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")
Copy link
Member

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)
Copy link
Member

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+
Copy link
Member

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?

@finswimmer
Copy link
Member Author

Closing in favor of #5450

@finswimmer finswimmer closed this Jun 4, 2022
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants