A Python package hosting hub that can be installed with pip install
. The reading is pie pie.
Both pypi.org and test.pypi.org cannot be overwritten by uploading the same name (version) (index is independent). If you want to update / fix, upgrade the version.
0.1.0-alpha < 0.1.0-alpha1 < 0.1.0-beta < 0.1.0-beta1 < 0.1.0 < 0.1.1
setup.py
__init__.py
YOUR_SCRIPT.py
LICENSE
README.md
__init__.py
from .YOUR_SCRIPT import *
import PACKAGE_NAME as PKG
PKG.some_function() # defined in YOUR_SCRIPT.py
setup.py
from setuptools import setup
setup(
name='PACKAGE_NAME',
version='0.1.0-alpha', # == 0.1.0-alpha0 == 0.1.0a0
license='MIT',
packages=[ 'YOUR_PACKAGE_NAME', ],
install_requires=[
# Example
'Pillow',
'opencv-python',
'numpy',
],
author='YOUR_NAME',
author_email='YOUR_EMAIL',
url='YOUR_WEBSITE_OR_REPOSITORY_URL',
description='SHORT_DESCRIPTION',
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)
--For the classifiers
section, copy and paste the applicable one from Classifiers · PyPI.
pip3 install wheel twine
--wheel: wheel packaging --tine: PyPI tool
python3 setup.py sdist
python3 setup.py sdist bdist_wheel
You can use https://test.pypi.org/ for experimental uploads, which behaves like pypi.org. The account is independent from pypi.org, [this article](https://qiita.com/shinichi-takii/items/e90dcf7550ef13b047b5#pypi%E3%82%A2%E3%82%AB%E3%82 % A6% E3% 83% B3% E3% 83% 88% E7% 99% BB% E9% 8C% B2) It seems that you should not make a mistake if you change the account name as recommended.
As mentioned above, once uploaded, the same PyPI repository cannot be overwritten (with the same version), so be careful about the version setting.
#For specific sdist only
twine upload --repository testpypi dist/YOUR_PACKAGE.tar.gz
#All files under dist
twine upload --repository testpypi dist/*
#For specific sdist only
twine upload --repository pypi dist/YOUR_PACKAGE.tar.gz
#All files under dist
twine upload --repository pypi dist/*
You can install it from GitHub, GitLab repositories, or local git repositories without pushing to PyPI. The directory structure is the same as when pushing to PyPI.
pip3 install git+https://github.com/USERNAME/REPOSITORY
pip3 install git+ssh://github.com/USERNAME/REPOSITORY
pip3 install git+file:///home/USER/REPOSITORY
It seems that you can also specify the branch and commit hash (see the official documentation above for details).
-PyPI package publishing procedure --Qiita
Recommended Posts