Code Monkey home page Code Monkey logo

Comments (9)

sigmavirus24 avatar sigmavirus24 commented on June 15, 2024

There is no way to upload a file over another file on PyPI (as you and I already discussed on #59). I am also almost entirely certain that PyPI does not support using the Range header to upload a file. Currently, files are uploading using a multipart/form-data POST request. This means that even if we wanted to be able to support Range the current upload API doesn't support it.

The other way to fix this is use different version numbers. If you were uploading CoolProp-5.0.0 you could change the version number to CoolProp-5.0.0post1 which indicates that the code/library/tool is functionally the same, but there's a difference in the releases. This new version will be newer than 5.0.0 as far as pip is concerned and will be installed instead of 5.0.0.

There really isn't anyway of "fixing" this for you.

from twine.

ibell avatar ibell commented on June 15, 2024

But I can't change the version number as the python wrapper is only one of about 15 different languages that we support and the release number has to be the same between all of them to maintain a simple level of sanity.

Why can't twine just skip the file and keep going if the file it is trying to upload is already on the server? The upload returned an error, can't you parse this error and determine it was because the file was already there, and just move to the next file?

A command line option for what to do when the file already exists could also work:

--exists error: throw an error, abort
--exists warning: runtime error, keep going

A similar problem occurs if you lose internet connection halfway through a large upload with many files.

from twine.

dstufft avatar dstufft commented on June 15, 2024

Twine can't generally just skip the file because if you ask a CLI program to do something and it can't do it, then it should return a non zero exit code. In particular this would break anyone relying on twine to nicely report errors so they can automate uploads and determine if they succeeded or not.

As far as an --exists flag, I'm on the fence about it. I'm not sure it would be generally useful.

from twine.

ibell avatar ibell commented on June 15, 2024

But I have already given two (common) use cases where the existing behavior has problems. The connection interruption is a particularly common and annoying one. The --exists would be backwards compatible (--exists error would be the default)

from twine.

dstufft avatar dstufft commented on June 15, 2024

Right. I think my problem is that you may (or may not) need to actually verify the the uploaded files were correctly uploaded or not. Depending on when the connection was interrupted you might have a broken file. I'm not strictly opposed to such a flag, I'm just not sure how generally useful it is. Especially since you can do the same thing just by doing: for f in *.whl; do twine upload $f || echo "Failed to upload $f"; done or something similar.

from twine.

ibell avatar ibell commented on June 15, 2024

I guess you are right, but it seems like

twine upload --exists warning dist/*

is a much cleaner syntax that less-experienced users would be more comfortable with. Also, nicer to use on windows.

from twine.

sigmavirus24 avatar sigmavirus24 commented on June 15, 2024

Except that --exists is an ambiguous option name. --if-exists would be better but still violates the principle of least surprise and introduces another way of uploading files that aren't broken. Sure it allows the user not to think, but I don't believe that we want people to ignore broken uploads (in the event the first attempt was interrupted) and think that it's a valid wheel. They won't be angry with their internet provider, they'll be angry with us because they made assumptions about what --exists does.

from twine.

tisaconundrum2 avatar tisaconundrum2 commented on June 15, 2024

Not sure if this was closed because it was solved, but maybe important for anyone that stumbles onto this in the future.

In your project directory

Foo
  |_ foo
       |_ __init__.py
       |_ __main__.py
       |_ ...

#Inside __init__.py Update your version
__version__ = "1.0.1"

This is one way of getting around this problem

from twine.

sigmavirus24 avatar sigmavirus24 commented on June 15, 2024

@tisaconundrum2 --skip-existing is a flag that will skip over files that already exist on PyPI.

from twine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.