Publishing SmartKDB to PyPI

Quick Publish

# Clean old builds
Remove-Item -Recurse -Force dist, build, *.egg-info

# Build package
python -m build

# Upload to PyPI
twine upload dist/*

Prerequisites

  1. Account on PyPI

    • Create account at https://pypi.org

    • Get API token from Account Settings

  2. Required Tools

    pip install build twine
    

Step-by-Step Publishing

1. Update Version

Edit pyproject.toml:

version = "5.0.1"  # Increment this

2. Update Changelog

Edit docs/CHANGELOG.md:

## [5.0.1] - 2024-XX-XX
### Added
- New feature X

### Fixed
- Bug Y

3. Clean & Build

# Remove old builds
Remove-Item -Recurse -Force dist, build, *.egg-info

# Build new package
python -m build

This creates:

  • dist/smartkdb-5.0.1.tar.gz (source)

  • dist/smartkdb-5.0.1-py3-none-any.whl (wheel)

4. Test Locally (Optional)

pip install dist/smartkdb-5.0.1-py3-none-any.whl

5. Upload to PyPI

twine upload dist/*

Enter credentials:

  • Username: __token__

  • Password: pypi-your-api-token-here

6. Verify

Visit: https://pypi.org/project/smartkdb/


Semantic Versioning

Follow SemVer:

  • 5.0.05.0.1 : Bug fixes

  • 5.0.05.1.0 : New features (backward compatible)

  • 5.0.06.0.0 : Breaking changes


Testing Before Publishing


Checklist Before Publishing

  • [ ] Version number updated in pyproject.toml

  • [ ] Changelog updated in docs/CHANGELOG.md

  • [ ] All tests passing (python -m pytest)

  • [ ] README.md is up to date

  • [ ] Examples work correctly

  • [ ] No sensitive data in code


Common Issues

Issue: “File already exists”

Solution: You can’t re-upload the same version. Increment version number.

Issue: “Invalid token”

Solution: Generate new token at https://pypi.org/manage/account/token/

Issue: “Package name taken”

Solution: Choose different name in pyproject.toml


Ready to publish! 🚀