Skip to main content

My notes:

Register for an account on test.pypi, and get an API token.

https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives

# update the pyproject.toml [project] name (to be the package name)
python3 -m pip install --upgrade build
# go to folder that contains pyproject.toml and run this:
python3 -m build

https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives

python3 -m pip install --upgrade twine
# go folder containing dist and run this:
python3 -m twine upload --repository testpypi dist/*
# for username, literally enter username as __token__
# for password, use your API key from your test.pypi account, including pypi- prefix
# https://test.pypi.org/search/?q=example_package_hchiam
# https://test.pypi.org/project/example-package-hchiam/

(more steps if you want to test the test-only version of your package: https://test.pypi.org/project/example-package-hchiam/)

To upload the production-ready version of your package: (pypi requires a separate registration and API key set up from the test.pypi site)

python3 -m twine upload dist/*
# for username, still literaly enter __token__
# for password, use your other API key from your pypi account, including pypi- prefix
# https://pypi.org/search/?q=example_package_hchiam
# https://pypi.org/project/example-package-hchiam/

https://pypi.org/project/example-package-hchiam/

# python3 -m pip install [your-package]
python3 -m pip install example_package_hchiam

/tests/test_example.py shows a good example of how the package will be used by users, where you can see a method from an inner/non-__init__ file, e.g.:

from example_package_hchiam.example import add_one

Streamlined thereafter:

# update code
# update pyproject.toml version number
# remove the old .whl and .gz files
rm -rf dist
python3 -m build
python3 -m twine upload --repository testpypi dist/*
python3 -m twine upload dist/*

python3 -m pip install example_package_hchiam

Release files for example-package-hchiam 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for example-package-hchiam 0.0.3
File Size Uploaded
example_package_hchiam-0.0.3.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for example-package-hchiam 0.0.3
File Interpreter ABI Platform
example_package_hchiam-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / example_package_hchiam-0.0.3.tar.gz

Download URL example_package_hchiam-0.0.3.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9ac9dca134e8f693eac18865170f3553b80d4c243b19061e8bb0125a9f4ac297
BLAKE2b-256 checksum
How to use checksums
6c549188a0c4e94abc3aa218c39d1e33c42210b9adf92464eee348ed479a6058
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.7

Release files / example_package_hchiam-0.0.3-py3-none-any.whl

Download URL example_package_hchiam-0.0.3-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16574a909d5c96df16017991738bd068fefc3b00bdbb4ed343667fbdc66ac596
BLAKE2b-256 checksum
How to use checksums
96f1b94b4a06e193a085a3634ab4d855292e3e8adc4f265f9a8206e336c3afda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page