Settings for uploading Python packages locally to PyPI

Currently, setting up a deployment on GitHub Actions as part of CI / CD Seems to be a best practice.

This method leaves a note as a workaround for testing and trouble.

procedure

Place .pypirc (PyPi's account config file) in ~ /. The contents are as stated below:

[pypirc]
servers =
    pypi
    testpypi
[pypi]
repository: https://upload.pypi.org/legacy/
username: __token__
password: (API token)
[testpypi]
repository: https://test.pypi.org/legacy/
username: __token__
password: (API token)

Execute the following command in the virtual environment where Twine is installed.

twine upload --repository pypi dist/*

Reference: Uploading the distribution archives | Packaging Python Projects — Python Packaging User Guide

When registering as a shortcut for Pipenv

It is convenient to register the following in the Pipfile.

[scripts]
clear = "rm -rf yamldataclassconfig.egg-info/* build/* dist/*"
build = "python setup.py sdist bdist_wheel"
deploy = "twine upload --repository pypi dist/*"

Then execute the command as follows.

pipenv run clear
pipenv run build
pipenv run deploy

Recommended Posts

Settings for uploading Python packages locally to PyPI
[Python] Local → Procedure for uploading files to S3 (boto3)
Roadmap for publishing Python packages
~ Tips for beginners to Python ③ ~
Introduction to Python For, While
Snippet settings for python jupyter notebook
Upload packages to PyPI using tokens
Emacs settings for Python development environment
An introduction to Python for non-engineers
How to configure CORS settings for Azure storage service in Python
[For beginners] How to register a library created in Python in PyPI
Memo to ask for KPI with python
Creating amateur python environment settings (for MAC)
[Python] Organizing how to use for statements
I tried with the top 100 PyPI packages> I tried to graph the packages installed on Python
Python> Output numbers from 1 to 100, 501 to 600> For csv
How to use "deque" for Python data
An introduction to Python for machine learning
Manage python packages to install in containers
An introduction to Python for C programmers
Memo # 4 for Python beginners to read "Detailed Python Grammar"
The fastest way for beginners to master Python
Python for super beginners Python for super beginners # Easy to get angry
Memo # 3 for Python beginners to read "Detailed Python Grammar"
How to install Python for pharmaceutical company researchers
Memo # 1 for Python beginners to read "Detailed Python Grammar"
Logging settings for daily log rotation in python
Try to calculate RPN in Python (for beginners)
[Introduction to Udemy Python3 + Application] 43. for else statement
Memo # 2 for Python beginners to read "Detailed Python Grammar"
[Python / Chrome] Basic settings and operations for scraping
Memo # 7 for Python beginners to read "Detailed Python Grammar"
Settings for Python coding in Visual Studio Code
Introduction to Programming (Python) TA Tendency for beginners
Memo # 6 for Python beginners to read "Detailed Python Grammar"
How to make Python faster for beginners [numpy]
String to Unicode Escape Sequence Format for Python
Convert binary packages for windows to wheel format
Memo # 5 for Python beginners to read "Detailed Python Grammar"
[Visual Studio Code] [Python] Tasks.json + problemMatcher settings for Python
Understand Python for Pepper development. -Introduction to Python Box-
Settings for getting started with MongoDB in python
2016-10-30 else for Python3> for:
Updated to Python 2.7.9
python environment settings
Install Python locally
"Backport" to python 2
Tool to make mask image for ETC in Python
[BigQuery] How to use BigQuery API for Python -Table creation-
I tried to graph the packages installed in Python
[For beginners] How to use say command in python!
How to convert Python # type for Python super beginners: str
How to run python in virtual space (for MacOS)
Change IP settings to ACL of conoha with python
Summary of python environment settings for myself [mac] [ubuntu]
VS Code settings for developing in Python with completion
[Introduction to python] A high-speed introduction to Python for busy C ++ programmers
Preparing to start "Python machine learning programming" (for macOS)
For those who want to write Python with vim
Articles to see when installation for Python + OpenCV fails
Python # How to check type and type for super beginners