PyPI Setup Guide for HPFRACC๏ƒ

Overview๏ƒ

This guide explains how to set up PyPI authentication for uploading the hpfracc package.

Prerequisites๏ƒ

  • PyPI account with API token access

  • twine package installed (pip install twine)

Setup Steps๏ƒ

1. Create PyPI API Token๏ƒ

  1. Go to PyPI Account Settings

  2. Navigate to โ€œAPI tokensโ€

  3. Create a new token with scope: hpfracc

  4. Copy the token (it starts with pypi-)

2. Configure Authentication๏ƒ

Create a .pypirc file in your home directory (~/.pypirc):

[distutils]
index-servers =
    pypi
    testpypi

[pypi]
username = __token__
password = YOUR_PYPI_API_TOKEN_HERE
repository = https://upload.pypi.org/legacy/

[testpypi]
username = __token__
password = YOUR_TESTPYPI_API_TOKEN_HERE
repository = https://test.pypi.org/legacy/

Important: Replace YOUR_PYPI_API_TOKEN_HERE with your actual token.

3. Build and Upload๏ƒ

# Build the package
python -m build

# Upload to PyPI
twine upload dist/*

# Upload to TestPyPI (optional)
twine upload --repository testpypi dist/*

Security Notes๏ƒ

  • Never commit .pypirc to git - it contains sensitive API tokens

  • The .pypirc file is already in .gitignore

  • Use .pypirc.template as a reference for the file structure

Troubleshooting๏ƒ

  • If you get authentication errors, verify your API token is correct

  • Ensure the token has the correct scope for the hpfracc project

  • Check that .pypirc is in your home directory (~/.pypirc)

Current Status๏ƒ

  • โœ… Package successfully uploaded to PyPI as hpfracc-1.3.1

  • โœ… Authentication working with project-scoped API token

  • โœ… Automated uploads via twine upload dist/*