pypa / flit

Simplified packaging of Python modules
https://flit.pypa.io/
BSD 3-Clause "New" or "Revised" License
2.16k stars 134 forks source link

404 error when trailing / in upload url ommitted #179

Open MasonEgger opened 6 years ago

MasonEgger commented 6 years ago

When trying to upload to https://test.pypi.org/legacy a stack trace is thrown stating the url is not found. If a trailing / is appended as such https://test.pypi.org/legacy/ the issue is no longer present.

$ flit --repository testpypi publish
Found 15 files tracked in git                                                                                                                     I-flit.sdist
Using setup.py from repository, not generating setup.py                                                                                           W-flit.sdist
Built sdist: dist/sample-0.1.tar.gz                                                                                                               I-flit.sdist
Copying package file(s) from /var/folders/zf/0mb199fd3zs_0tq75gxg2s3h0000gn/T/tmponzn4c97/sample-0.1/sample                                       I-flit.wheel
Writing metadata files                                                                                                                            I-flit.wheel
Writing the record of files                                                                                                                       I-flit.wheel
Built wheel: dist/sample-0.1-py2.py3-none-any.whl                                                                                                 I-flit.wheel
Using repository at https://test.pypi.org/legacy                                                                                                 I-flit.upload
Install keyring to store passwords securely                                                                                                      W-flit.upload
Server  : https://test.pypi.org/legacy
Username: Zelgius # Replace with your TestPyPI username
Password:
Uploading dist/sample-0.1-py2.py3-none-any.whl...                                                                                                I-flit.upload
Traceback (most recent call last):
  File "/Users/Zelgius/.virtualenvs/warehouse/bin/flit", line 11, in <module>
    sys.exit(main())
  File "/Users/Zelgius/.virtualenvs/warehouse/lib/python3.6/site-packages/flit/__init__.py", line 104, in main
    main(args.ini_file, args.repository, formats=set(args.format or []))
  File "/Users/Zelgius/.virtualenvs/warehouse/lib/python3.6/site-packages/flit/upload.py", line 281, in main
    do_upload(built.wheel.file, built.wheel.builder.metadata, repo_name)
  File "/Users/Zelgius/.virtualenvs/warehouse/lib/python3.6/site-packages/flit/upload.py", line 254, in do_upload
    upload_file(file, metadata, repo)
  File "/Users/Zelgius/.virtualenvs/warehouse/lib/python3.6/site-packages/flit/upload.py", line 236, in upload_file
    resp.raise_for_status()
  File "/Users/Zelgius/.virtualenvs/warehouse/lib/python3.6/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://test.pypi.org/legacy/

[testpypi] repository = https://test.pypi.org/legacy username = Zelgius # Replace with your TestPyPI username



I believe it should correct for this and add the missing / to the url
bpabel commented 4 years ago

I actually have the opposite problem. It's not throwing an error, and appears to be failing silently, as the package is not uploaded to pypi

$ flit publish --repository testpypi
Found 3 files tracked in git                              I-flit.sdist
Writing generated setup.py                                I-flit.sdist
Built sdist: dist\brendan_pack-0.1.0.tar.gz          I-flit_core.sdist
Copying package file(s) from C:\Users\XXX\AppData\Local\Temp\2\tmptbsqkd5u\brendan_pack-0.1.0\brendan_pack.py  I-flit_core.wheel
Writing metadata files                               I-flit_core.wheel
Writing the record of files                          I-flit_core.wheel
Built wheel: dist\brendan_pack-0.1.0-py2.py3-none-any.whl  I-flit_core.wheel
Using repository at https://test.pypi.org/legacy         I-flit.upload
Uploading dist\brendan_pack-0.1.0-py2.py3-none-any.whl...  I-flit.upload
Package is at https://test.pypi.org/project/brendan_pack/  I-flit.upload
Using repository at https://test.pypi.org/legacy         I-flit.upload
Uploading dist\brendan_pack-0.1.0.tar.gz...              I-flit.upload
Package is at https://test.pypi.org/project/brendan_pack/  I-flit.upload
takluyver commented 4 years ago

@bpabel your package appears to be there now at the address shown in the output: https://test.pypi.org/project/brendan_pack/

Is it possible that you looked at the main PyPI site? test.pypi.org is separate, so uploads there won't show up on regular PyPI. Or perhaps something was cached somewhere, so the change didn't show up immediately?

bpabel commented 4 years ago

@takluyver Yes, it uploaded after I changed the pypi path to include the trailing slash, so that's why those packages are there now.