Skip to content
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

Problem publishing at pypi Client error '400 Start filename for 'github3.py' with 'github3.py'.' #833

Closed
staticdev opened this issue Apr 23, 2023 · 11 comments

Comments

@staticdev
Copy link

We just migrated github3.py to using hatch and I was not lucky trying to publish after build:

% hatch build 
[sdist]
dist/github3_py-4.0.0.tar.gz

[wheel]
dist/github3_py-4.0.0-py3-none-any.whl

% hatch publish
Enter your username: user
Enter your credentials: 
dist/github3_py-4.0.0-py3-none-any.whl ... failed
Error uploading to repository: https://upload.pypi.org/legacy/ - Client error '400 Start filename for 'github3.py' with 'github3.py'.' for url 'https://upload.pypi.org/legacy/'
For more information check: https://httpstatuses.com/400

Error message didn't help me much, any idea what might be the issue?

@ofek
Copy link
Collaborator

ofek commented Apr 23, 2023

I'm not sure, that error comes directly from PyPI. Does Twine work for uploading that wheel?

@ofek
Copy link
Collaborator

ofek commented Apr 23, 2023

That is a known bug pypi/warehouse#10030

What you can do is disable the strict-naming option for builds:

@ofek
Copy link
Collaborator

ofek commented Apr 23, 2023

After you successfully release feel free to close this issue

@offbyone
Copy link

Adding that sdist option does not in fact work:

diff --git a/pyproject.toml b/pyproject.toml
index 57259d73..63ec6338 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -52,7 +52,11 @@ dev = [
 [tool.hatch.version]
 path = "src/github3/__about__.py"
 
+[tool.hatch.build.targets.sdist]
+strict-naming = false
+
 [tool.hatch.build.targets.wheel]
+strict-naming = false
 packages = [
   "src/github3",
 ]
python -mbuild
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (hatchling)
* Getting build dependencies for sdist...
* Building sdist...
ERROR Source /var/folders/tc/mhq0tfws3s1bs5788hx6nhkc0000gn/T/build-via-sdist-q7534m0e/github3.py-3.2.0 is not a directory

@ofek
Copy link
Collaborator

ofek commented Apr 23, 2023

I can reproduce. I'm not sure what build is doing but both Hatch and PDM build it successfully

@ofek
Copy link
Collaborator

ofek commented Apr 23, 2023

bb

My guess is that build is using the filename component to determine the top-level archive component name and since they differ it breaks. I think this is a genuine bug, so I will open an issue over there.

On behalf of the packaging community I'm sorry you're encountering so many bugs today 😅

@ofek
Copy link
Collaborator

ofek commented Apr 23, 2023

pypa/build#607

@ofek
Copy link
Collaborator

ofek commented Apr 23, 2023

I would like to note 2 things:

  1. In theory Hatchling could change the archive component to not be normalized but I think that is not the proper way forward
  2. build builds wheels successfully

@offbyone
Copy link

What's actually pretty funny is that build also builds sdists correctly!

$ python -mbuild
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (hatchling)
* Getting build dependencies for sdist...
* Building sdist...
ERROR Source /var/folders/tc/mhq0tfws3s1bs5788hx6nhkc0000gn/T/build-via-sdist-6wbzvh9r/github3.py-3.2.0 is not a directory

$ python -mbuild -s
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (hatchling)
* Getting build dependencies for sdist...
* Building sdist...
Successfully built github3.py-3.2.0.tar.gz

@staticdev
Copy link
Author

Wow.. this escalated quick.

@ofek
Copy link
Collaborator

ofek commented Apr 23, 2023

@ofek ofek closed this as completed Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants