[For beginners] How to register a library created in Python in PyPI

Introduction

I was interested in automatic blog posting, but I made it myself because Python didn't have an easy-to-use library. I want to do pip install hogehoge, so I summarized the method.

environment

For busy people

You should register at PyPI! Use twine for uploading!

procedure

The following is the command when using Pipenv, but please replace it as appropriate by looking at Reference.

0. Premise

-You have created an account with PyPI and Test PyPI. --Prepare LICENSE, README.md, setup.py, etc. If you haven't done so already, please refer to here to create it.

1. Installation of twine

Uploading to PyPI uses twine, so install it in advance.

pipenv install --dev twine

2. Create registration file

The following will create .whl and .tar.gz under dist /.

python setup.py sdist bdist_wheel

3. Upload to Test PyPI

You can use PyPI in the Test environment before uploading to production PyPI. You don't have to use it, but it's better to use it before you get used to it.

python -m twine upload --repository testpypi dist/*

This completes the upload to Test PyPI. Since it's a big deal, let's install from Test PyPI.

pipenv install --pypi-mirror https://test.pypi.org/simple/ <PACKAGE_NAME>

4. Upload to PyPI

After confirming the operation of the library uploaded to Test PyPI, let's finally register it in the actual PyPI. Please feel free to contact us as it will not be judged by anyone.

python -m twine upload dist/*

This completes the upload to the production PyPI. Finally, try the example one and you're done. Thank you for your hard work.

pipenv install <PACKAGE_NAME>

reference

Packaging Python Projects

Recommended Posts

[For beginners] How to register a library created in Python in PyPI
Publish / upload a library created in Python to PyPI
[For beginners] How to use say command in python!
A memorandum to register the library written in Hy in PyPI
How to define multiple variables in a python for statement
How to get a stacktrace in python
[Introduction to Python] How to use the in operator in a for statement?
How to use the C library in Python
How to clear tuples in a list (Python)
How to embed a variable in a python string
How to use Python Image Library in python3 series
How to create a JSON file in Python
Try to calculate RPN in Python (for beginners)
How to notify a Discord channel in Python
[Python] How to draw a histogram in Matplotlib
How to make Python faster for beginners [numpy]
How to send a visualization image of data created in Python to Typetalk
How to convert / restore a string with [] in python
How to convert Python # type for Python super beginners: str
[For beginners] How to study Python3 data analysis exam
How to run python in virtual space (for MacOS)
[Python] How to expand variables in a character string
How to register on pypi
[Python] Created a method to convert radix in 1 second
How to develop in Python
Python # How to check type and type for super beginners
How to execute a command using subprocess in Python
~ Tips for beginners to Python ③ ~
Created a Python library to write complex comprehensions and reduce in an easy-to-read manner
How to support x-nullable for swagger in python's jsonschema library
How to slice a block multiple array from a multiple array in Python
How to debug the Python standard library in Visual Studio
How to import Python library set up in EFS to Lambda
[python] How to use the library Matplotlib for drawing graphs
How to manage a README for both github and PyPI
A story about how to specify a relative path in python.
How to use the __call__ method in a Python class
A simple way to avoid multiple for loops in Python
Developed a library to get Kindle collection list in Python
How to learn TensorFlow for liberal arts and Python beginners
How to make a Python package (written for an intern)
I tried "How to get a method decorated in Python"
How to develop in a virtual environment of Python [Memo]
How to specify Cache-Control for blob storage in Azure Storage in Python
How to get the last (last) value in a list in Python
How to implement Python EXE for Windows in Docker container
How to register a package on PyPI (as of September 2017)
How to convert Python # type for Python super beginners: int, float
How to get a list of built-in exceptions in python
For beginners, how to deal with common errors in keras
[Python] How to do PCA in Python
How to collect images in Python
How to use Requests (Python Library)
How to use SQLite in Python
[Python] How to import the library
<For beginners> python library <For machine learning>
How to use Mysql in python
How to wrap C in Python
How to use ChemSpider in Python
How to use PubChem in Python
Run unittests in Python (for beginners)