A Python beginner was addicted to registering his own package on PyPI, February 2017 version

Here's what I struggled with when I first registered my own package on PyPI the other day. The first thing I'm addicted to is that you need to use twine, the package name is not appropriate.

Initially, I searched and looked up how to register a package on PyPI, and many blogs and articles showed the following steps.

no work Reference url/command
1 Source code creation
2 Arrange the folder structure Python:Include data files in your own package
3 setup.Create py PyPI registration steps for those who want to make a PyPI debut
4 Distribution construction >>python setup.py sdist
5 Test installation >>python setup.py install
6 Create an account on PyPI for test Registration destination
7 .Create pypirc Register as a package on PyPI
8 Register the package name >>python setup.py register -r pypitest
9 Upload package >>python setup.py sdist upload -r pypitest
10 Create an account on production PyPI Registration destination
11 Register the package name >>twine register dist/*
12 Upload package >>twine upload dist/*
13 Test installation >>pip install package name

Twine, PyPi for test, ".pypirc" related is supplemented.

-You need to create separate accounts for test PyPi and production PyPi. -".Pypirc" is required when using twine. -For Windows, the location to put ".pypirc" is the location specified by the environment variable (c: \ Users \ foo \ .pypirc if HOMEPATH = \ Users \ foo) -If server is defined in ".pypirc", write the server name defined in ".pypirc" in the url specification of python setup.py -r.

sample


file:.pypirc
        [distutils]
        index-servers =
            pypi
            pypitest

        [pypi]
        repository: https://pypi.python.org/pypi
        username: worst
        password: Salary_burglar

        [pypitest]
        repository: https://testpypi.python.org/pypi
        username: learner
        password: Being_late

#If the server definition is pypitest, specify as follows

>>python setup.py register -r pypitest
>>python setup.py sdist upload -r pypitest

I was addicted to that 1

It went smoothly until I registered with PyPI for test. If you have a long history of Python, it will take less than 5 minutes. When I registered the package name on the PyPI production server, I got the following error and stopped.

Server response (410): This API is no longer supported, instead simply upload the file.

It seems that you can use twine instead of python setup.py register, or register PKG-INFO directly with the following url.

https://pypi.python.org/pypi?%3Aaction=submit_form

sample


#Old way
python setup.py register
python setup.py sdist upload

#New way
pip install twine #Install if necessary
twine register dist/*
twine upload dist/*

It was around 2014 that this method became recommended (it is now required because it is no longer supported)? So, the articles up to 2014 are introduced in the old way.

And while PyPi for test can be registered with the old method, PyPi for production can only be registered with the new method, which is the easiest place to get hooked.


Where I was addicted, part 2

This is simple. The package name you were trying to register was already in use by someone else. In the response, I immediately noticed that it could not be specified if it was already in use, but ... is a later festival.

When I try to register PKG-INFO on the WEB with a used name, the following response is returned.

Forbidden You are not allowed to store 'picker' package information

When I use twine, I get the following message:

HTTPError: 403 Client Error: You are not allowed to edit 'picker' package information for url: https://pypi.python.org/pypi

Check the batting by searching on the PyPi site, or

https://pypi.python.org/pypi

Search for "pip search the name you want to use".

If you have any, please use "pip search *> list.txt" to get the full list and stare at it.

Recommended Posts

A Python beginner was addicted to registering his own package on PyPI, February 2017 version
I want to find a popular package on PyPi
How to register a package on PyPI (as of September 2017)
I was a little addicted to installing Python3.3 + mod_wsgi3.4 on Sakura VPS (CentOS), so a retrospective memo
A note I was addicted to when making a beep on Linux
Register as a package on PyPI
A story I was addicted to when inserting from Python to a PostgreSQL table
Semi-automatically generate a description of the package to be registered on PyPI
I was addicted to Flask on dotCloud
What I was addicted to Python autorun
Summary of points I was addicted to running Selenium on AWS Lambda (python)
A note I was addicted to when running Python with Visual Studio Code
A story that I was addicted to when I made SFTP communication with python
[2020 version] How to install Python3 on AWS EC2
Export Python3 version OpenCV KeyPoint to a file
I was soberly addicted to calling awscli from a Python 2.7 script registered in crontab
A story that got stuck when trying to upgrade the Python version on GCE
How to build a Django (python) environment on docker
I was addicted to scraping with Selenium (+ Python) in 2020
A story that I was addicted to at np.where
How to build a Python environment on amazon linux 2
What I was addicted to when using Python tornado
Publish / upload a library created in Python to PyPI
A story about a Python beginner who was about to be crushed by ModuleNotFoundError: No module named'tweepy'