-
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
Don't publish if version already exists #3304
Comments
I am confused... The issue you are describing should not have happened to begin with. As far as I know it is impossible to overwrite a distribution (sdist or wheel) on PyPI. Would you mind describing again what happened? |
@sinoroc The problem that originally motivated this request happened when using Artifactory as the remote repo. I published new changes to a package using an old version that had already been published. A colleague tried to
Ah, I did not know that! I assumed PyPI and Artifactory had similar behavior in this regard. Upon further research, it appears that Artifactory has permissions that control package overwriting. I think that would be a better solution. |
I did not know Artifactory allowed overwriting an already published distribution (we all learned something). It seems dangerous to me, I am glad it is not the case in PyPI. But for a private internal repository, why not. I do not know if it is a workflow that poetry wants to support explicitly. It seems like everything is already working as expected. If overwriting is allowed, it overwrites. If it is not allowed, it fails. If it were my place to decide, I would not change anything, or I would need some further convincing. We'll see what others think. |
Agreed. The status-quo appears to be that it's on the onus of the repo to control overwrites. I'm fine if we close this issue, but other may have a different opinion. |
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? |
It is the responsibility of the repo to control overwrites but it is the responsibility of the tooling how to handle this case. For some it is an error and for some it is not, thus an option to control the behavior makes very much sense. |
Another use of flag such as |
This would be really helpful, Something that also helps to overwrite the existing package as well. |
|
It has already been done: #2812. You can try with poetry >= 1.2.0b2 |
Can we implement this feature?
We too need for CI/CD. In our scenario, we have a jfrog artifactory running for an internal pypi-index and we build our packages with Gitlab CI/CD and the best way to make sure people bump project version is to add this flag. We would be willing to submit a PR for this if approved. |
Poetry has had |
I mean to add a |
I don't think Poetry is an appropriate tool for such a task (checking if a version exists on an index), though that's mostly because the implementation for the flag would essentially be an entirely separate function that doesn't upload anything, but instead actually implements a (really minimal) PEP 508 client. Regardless, that's a new feature request; you won't get any traction adding comments to closed & tangential issues -- would you mind creating one? |
thanks, I'll look into implementing a poetry-plugin for this scenario |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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:
Idea 2:
Idea 3:
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.
The text was updated successfully, but these errors were encountered: