question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't publish if version already exists

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Let’s say a package maintainer publishes version 1.5.0 of package foo. Later on, the maintainer decides to publish new changes but forgets to bump the package version. Now, mayhem and chaos ensue whilst the fabric of reality disintegrates from the epicenter of PyPI.

Ok, so maybe the fabric of reality wont disintegrate, but overwriting an existing package in a remote repo certainly isn’t desirable is most circumstances. Would it be possible to add a check/flag to poetry publish such that it errors if a version of a package already exists in a remote repo? Here are some possible API ideas:

Idea 1:

# Assume foo-1.5.0 already exists in the remote repo
poetry publish  # this will error if foo-1.5.0 is published 
poetry publish --force  # this will overwrite the existing foo-1.5.0

Idea 2:

# Assume foo-1.5.0 already exists in the remote repo
poetry publish  # this will overwrite the existing foo-1.5.0
poetry publish --check-existing  # this will error if foo-1.5.0 is published 

Idea 3:

# This lists all the existing versions of the package in the remote repo.
# Clients can then consume the output however they wish to determine if a version already exists.
# The `version` command admittedly may not be the best place for this new functionality, but it's just an example.
poetry version --list-remote

Idea 3 may be useful for reasons other than version checking.

Let me know if any of these ideas sound feasible and worthwhile. I’m happy to submit a PR.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

16reactions
nikarocommented, May 13, 2021

It would still be nice to have a flag allowing to not fail if the version already exists. I have a use case where my CI run at each commit, even the “publish” step, and i was hoping that poetry would skip publish if version was not incremented from what is on PyPI.

Can this issue be reopened? Or should i open a new one?

3reactions
heavelockcommented, Aug 11, 2022

Another use of flag such as --check-existing could be in CI pipelines. It could be used just as a automation step to remind about bumping the version before publishing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fail uploading python package to artifactory if version already ...
I want to add something in github-actions that doesn't publish the package to artifactory if a version number alreaedy exists. github actions ...
Read more >
Gitlab NPM Registry reports "Package already exists." on ...
When trying to publish packages to the Gitlab NPM registry, a 403 (Package already exists.) gets returned, even though the version of that ......
Read more >
Plugin to skip publishing if artifact already exists in repository
Hi everyone I'm trying to create gradle plugin, which enhances publication tasks in a project so that they first check is apt artifact ......
Read more >
Create and publish a NuGet package using Visual Studio ...
A quickstart that shows how to create and publish a .NET NuGet package using Visual Studio for Windows.
Read more >
Publishing Maven Releases to Maven Central Repository
You can download and install the latest version of Maven before continuing. ... or you're trying to release a version that already exists....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found