Need Packaging support

I am creating PYPI package for the first time and I am unable to upload it to PYPI.Can someone help me with this?


How can I solve this issue?

Did you read the information provided at the link shown in the error message? Did you follow the hints at this link?

3 Likes

Yes.Thats how I landed here.What ever I paste the token is always hidden?How will I know the token is pasted or not?

You sure you use the credentials for the TEST instance of PyPI? The main PyPI and the test instance do not use the same credentials. You need to create separate accounts.

Oh.I thought it’s optional.I will create and try.

What is the difference between https://test.pypi.org and https://pypi.org?

Thank you for helping. I was trying this for long time and I finally succeed in creating my first package.

1 Like

https://test.pypi.org/ is for you to test your package before releasing it for real on https://pypi.org/.

Typically you would create your sdist and your wheel(s), upload them to test PyPI. Then maybe check if the description renders correctly on the test PyPI website, if all the metadata values are rendered correctly. Then maybe you would try to install your package from test PyPI, in order to check if all the necessary files are in the sdist and wheel(s). And check a bunch of other things as well. Once you are happy with all these checks, you would upload to the real PyPI server.

As far as I recall, the test PyPI server is different in that there is no guarantee that distribution packages (sdists and wheels) are kept forever. There is much less scrutiny (if any at all) in terms of typosquatting, safety checks and so on.

An important recommendation when downloading (and installing) from the test PyPI server is to only download what you uploaded yourself and nothing else. So typically you would run something like the following, the important bits being the usage of the --no-deps flag, making sure to use the correct distribution package name (here my-new-library) and the correct version string (here 1.2.3):

python -m pip install --index-url https://test.pypi.org/simple/ --no-deps 'my-new-library==1.2.3'
2 Likes

How to release it on https://pypi.org/ from Https://test.pypi.org/?

There is no path to move distribution packages (sdists and wheels) from https://test.pypi.org/ to https://pypi.org/. You have to repeat the upload process on the main PyPI server, using the same distribution packages that you uploaded on the test server. And you should indeed try to upload the exact same distributions packages, you should avoid to rebuild them (otherwise you would publish something that you have not checked on the test server).

If I want to make changes or add something to the existing package, what should I do?And I created my package as example_package_add not sure why it got saved as example-package-add.

In principle if you make changes, you should test this new version on test PyPI first. I guess that would be the recommendation.

I think maybe it could be problematic because you can’t upload again the same file name. I do not know if there is a way to work around that on test PyPI.

That is the standard normalization of the name:

https://packaging.python.org/en/latest/specifications/name-normalization/

I have seen people updating the packages to version2,3… If I make changes in my GitHub link will it update the package as well? How is it?

I do not understand what you mean. And maybe I had misunderstood your previous message as well.

If you make changes to your project after you published it on the main PyPI, then you have to change the version string. Here is a discussion on versioning.

I am struggling to find a way to make changes in the published package.In setup tools we mention the GitHub links as well so if I make changes and deploy will it update the package as well or how is it?Is there any other procedure to follow for updating the package.

You change your code, you set a new version string, you build the new distribution packages, you upload the new distribution packages to Test PyPI, you check the distribution packages on Test PyPI, you upload those same distribution packages to the main PyPI.

The GitHub link is here just for information. So that people can find where the source code of your project is. It really is just a link, there is no magic behind it. The link is displayed on the PyPI page, in the left column, that’s it.

You mean I can use the same package name if I change the version?

yes, exactly

Thanks for helping.