A sample Python project
Project description
My notes:
Register for an account on test.pypi, and get an API token.
# 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
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/
# 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
python3 -m build
python3 -m twine upload --repository testpypi dist/*
python3 -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file example_package_hchiam-0.0.2.tar.gz
.
File metadata
- Download URL: example_package_hchiam-0.0.2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 021badc229fbddce9768c4e125c49c28121a473e5674bb25300fb47b6ef62062 |
|
MD5 | 99191708a43abae36fd49f82fcbc392d |
|
BLAKE2b-256 | ee2075cf2568230c6af3813891a6ed41bcf5d159b4b052e4ec7ab918061e59bc |
File details
Details for the file example_package_hchiam-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: example_package_hchiam-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d9a289bd1be9213190b8ff622be5e7d8bdef7d7f1ca35b389b918cc3ae91b00 |
|
MD5 | 638ae54e969e1f7c5069da3879b97629 |
|
BLAKE2b-256 | 163839aa13d45c8549624ffc67f717c1703ecdd46c336f7b73fd32ac4f96ef33 |