4
votes

I am trying to update the version of infixpy using twine. Here is my ~/.pypirc:

index-servers =
  pypi
  pypitest

[pypi]
repository: https://upload.pypi.org/legacy/ 
username: myuser
password: mypassword

[pypitest]
repository: https://upload.testpypi.org/legacy
username: myuser
password: mypassword

Here is the command line:

python setup.py build
twine upload -r  pypi dist/

The upload errors out with InvalidDistribution: Unknown distribution format: ''

Here is the full output:

Processing dependencies for infixpy==0.0.6
Finished processing dependencies for infixpy==0.0.6
Processing /Users/steve/git/infixpy
Building wheels for collected packages: infixpy
  Building wheel for infixpy (setup.py) ... done
  Created wheel for infixpy: filename=infixpy-0.0.6-py3-none-any.whl size=43459 sha256=01fed46f42fa86475079636a55685c93521989aa0ba6558726a9d35c01004b7a
  Stored in directory: /private/var/folders/d6/m67jyndd7h754m3810cl3bpm0000gp/T/pip-ephem-wheel-cache-1bizg6_y/wheels/47/66/74/d79a56979feba04c8ef05e12fe861cacf813cecd397e57071f
Successfully built infixpy
Installing collected packages: infixpy
  Attempting uninstall: infixpy
    Found existing installation: infixpy 0.0.6
    Uninstalling infixpy-0.0.6:
      Successfully uninstalled infixpy-0.0.6
Successfully installed infixpy-0.0.6
Uploading distributions to https://upload.pypi.org/legacy/
InvalidDistribution: Unknown distribution format: ''

What corrections are needed to my publishing process? I am on Python 3.7 on macOS.

2
It expects a file; dist/ is a directory, so you're ending up at github.com/pypa/twine/blob/…jonrsharpe
Huh. I had used this approach in the past: in fact I ran it from a custom install script used successfully. Maybe the twine publishing changed? oh - i missed the "*" after "/dist"WestCoastProjects
I changed it to reference an .egg and it does work. You can make it an answerWestCoastProjects

2 Answers

6
votes

Per the docs for twine upload (emphasis mine):


positional arguments:
  dist                  The distribution files to upload to the repository
                        (package index). Usually dist/* . May additionally
                        contain a .asc file to include an existing signature
                        with the file upload.

You've passed a directory, not files - as the docs suggest, you probably want dist/*. If you pass a directory there are no matches for known distributions, as these are based on file extension, so you end up at this error case:

        else:
            raise exceptions.InvalidDistribution(
                "Unknown distribution format: '%s'" % os.path.basename(filename)
            )

The basename for a directory is '', hence the not-so-helpful output.

4
votes

add * after dist/ like this : twine upload -r pypi dist/*

But Why?

Because dist/ is a directory and it expects a file to be uploaded, not any directory. So, the files will be all(*) files inside dist folder