This guide documents the end-to-end journey of creating, troubleshooting, and successfully publishing a Python package (autoedapkd) to PyPI using uv.
The Action: We started by initializing a new Python package.
uv init --package autoeda
cd autoedaProject State:
- Before: Empty directory.
- After:
uvscaffolded a standard project structure:autoeda/ ├── src/ │ └── autoeda/ │ └── __init__.py ├── .gitignore ├── .python-version ├── pyproject.toml └── README.md
The Action: We added the necessary libraries for data analysis and visualization.
uv add pandas numpy matplotlib seabornProject State:
- Before:
pyproject.tomlhad an emptydependencies = []block. - After: A
uv.lockfile was generated, and the dependencies were added topyproject.toml:dependencies = [ "matplotlib>=3.11.0", "numpy>=2.5.1", "pandas>=3.0.3", "seaborn>=0.13.2", ]
The Action: Once the code was ready, we generated the distribution archives.
uv buildProject State:
- Before: No distribution files existed.
- After: A new
dist/folder was created containing the.tar.gzand.whlfiles:dist/ ├── autoeda-0.1.0-py3-none-any.whl └── autoeda-0.1.0.tar.gz
Before publishing, an API token is required.
- Log in to pypi.org
- Go to Account settings → API tokens
- Click Add API token, choose the scope, and generate it.
Important
PyPI shows the token only once — copy and store it securely.
The Action: We attempted to upload the package to PyPI.
uv publish --token <YOUR_TOKEN>Project State:
- Result: The upload failed with a
403 Forbiddenerror:403 The user 'faizymohd' isn't allowed to upload to project 'autoeda'. - Why: The name
autoedawas already taken by someone else on PyPI.
The Action: We had to rename the package to something unique (autoedapkd). We updated the name field in pyproject.toml, and then renamed the module directory to match.
# Rename the source directory to match the new package name
mv src/autoeda src/autoedapkdProject State:
- Before: Module was located at
src/autoeda/andpyproject.tomlusedname = "autoeda". - After: Module moved to
src/autoedapkd/andpyproject.tomlupdated:name = "autoedapkd" ... [project.scripts] autoeda = "autoedapkd:main"
The Action: We removed the old dist files and built the new renamed package.
rm -rf dist
uv buildProject State:
- Before:
dist/contained the oldautoedafiles. - After:
dist/was refreshed with the newautoedapkddistribution files:dist/ ├── autoedapkd-0.1.0-py3-none-any.whl └── autoedapkd-0.1.0.tar.gz
The Action: We ran the publish command one final time.
uv publish --token <YOUR_TOKEN>Project State:
- Before: Wheels sat unpublished in the
distfolder. - After: The package
autoedapkdwas successfully uploaded to PyPI and became available for anyone to install viapip install autoedapkd!
When you make changes to your code and want to release a new version of your package, follow these steps:
The Action: You must increase the version number in pyproject.toml. PyPI does not allow you to overwrite an existing version.
- Open
pyproject.toml - Change
version = "0.1.0"toversion = "0.1.1"(or your next version).
Project State:
- Before:
version = "0.1.0" - After:
version = "0.1.1"
The Action: Remove the old distribution files so you don't accidentally try to upload them again.
rm -rf distProject State:
- Before:
dist/contains version 0.1.0 files. - After:
dist/directory is completely removed.
The Action: Generate the new distribution archives for the updated version.
uv buildProject State:
- Before: No
dist/directory exists. - After: A new
dist/folder is created with the updated version files:dist/ ├── autoedapkd-0.1.1-py3-none-any.whl └── autoedapkd-0.1.1.tar.gz
The Action: Upload the new version to PyPI using your token.
uv publish --token <YOUR_TOKEN>Project State:
- Before: New wheels sit unpublished.
- After: Version
0.1.1is successfully uploaded to PyPI. Users can now runpip install --upgrade autoedapkdto get the latest features!
You can view and install this package directly from PyPI: https://pypi.org/project/autoedapkd/
If you want to run the package locally using the example runner script run_EDA.py , follow these steps to set up your environment:
If you haven't initialized the project space yet, you can do so using:
uv initCreate a virtual environment to isolate your dependencies:
uv venvActivate the environment (Windows PowerShell/CMD):
- PowerShell:
.venv\Scripts\activate
Install the package dependencies into your virtual environment:
uv pip install -r requirements.txt(Or manually add autoedapkd directly using uv add autoedapkd)
Navigate into the 12_PyPi_Pkg folder (if you aren't already in it) and run the run_EDA.py script:
cd 12_PyPi_Pkg/run_autoEDA
python run_EDA.py