Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justwaitfor-me/pypi-tutorial
How to upload your Python Package
https://github.com/justwaitfor-me/pypi-tutorial
package pip pypi pypi-package pypi-upload python
Last synced: about 1 month ago
JSON representation
How to upload your Python Package
- Host: GitHub
- URL: https://github.com/justwaitfor-me/pypi-tutorial
- Owner: justwaitfor-me
- Created: 2023-09-25T22:02:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-04T17:40:33.000Z (10 months ago)
- Last Synced: 2024-04-04T18:46:26.545Z (10 months ago)
- Topics: package, pip, pypi, pypi-package, pypi-upload, python
- Language: Python
- Homepage: https://www.pypi.org/
- Size: 582 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
How to upload a Python package to Pypi?
The Python Package Index, abbreviated as PyPI, is the official repository of software for the Python
programming language. By default, pip — which is the most popular Python package manager — uses PyPI as
the
source for retrieving package dependencies.
1. PyPi Account
1. Create an account with PyPi here and verify your email
address
2. In your account settings, scroll down and enable two-factor authentication (2FA)
1. Enable *PyPI-Recovery-Codes* and save them in a File
2.
Acivate 2FA and scan the QR Code with an Authenticator
- Botan (programming
library)
-
FreeOTP
Authenticator
-
multiOTP
- Comparison of
TOTP applications
3. Finally, you have to generate an API Token at the bottom of your
account
settings. You will need the Token later!
2. Python Package
1. create a new Folder (package_name) and open it in your favourite
code editor
2. create the Files and Folders in your Folder by using the templates
listed below. Replace the [] with your own names
NOTE: You have to change the Information in every File to
your
Information
LICENSE
MANIFEST.in
pyproject.toml
README.md
requirements.txt
setup.py
/src
/[package_name]
src/__init__.py
(empty file)
[Modul_1].py
(your code)
[Modul_2].py
(your code)
you can add more
Moduls
It should look like this:
3. PyPi Package
0. install build and twine
NOTE: Make shure that you have pip installed
pip install twine
pip install build
1. install the Package locally:
cd [package_name]
pip install .
Now your Repo should look like this:
NOTE: You can Test your Package localy before deploying
it
2. building the Package (this Step can take some time)
python -m build
output (end):
Successfully built Package_Name-0.0.1.tar.gz and
Package_Name-0.0.1-py3-none-any.whl
Now you should have the /dist direcory:
3. deploying the Package
NOTE: The user 'username'
isn't
allowed to upload to project 'package_name'. means that the Package Name ist allready
taken.
python -m twine upload dist/*
Username = __token__
Password = [your Token]
Your Package is now online on PyPi and can be used by downloading it
with
pip
pip install [package_name]
4. Updating the Package
To update your Package you have to change the version in the pyproject.toml file.
python -m build
python -m twine upload --skip-existing
dist/*
To install the new Version:
pip uninstall Package_Name
pip install Package_Name