This document explains how to prepare, build, and publish the Fantasy Premier League MCP package to PyPI.
- Create a PyPI account at https://pypi.org/account/register/
- Install required tools:
pip install build twine
Before publishing a new release, update the version number in:
pyproject.toml
setup.py
(if applicable)src/fpl_mcp/__init__.py
(if version is defined there)
Follow semantic versioning (MAJOR.MINOR.PATCH):
- MAJOR version for incompatible API changes
- MINOR version for added functionality in a backward compatible manner
- PATCH version for backward compatible bug fixes
Add a new entry to CHANGELOG.md
with details about the changes in the new release.
Remove any previous build artifacts:
rm -rf dist/ build/ *.egg-info/
Build both wheel and sdist packages:
python -m build
This creates:
- A source distribution in
dist/*.tar.gz
- A wheel distribution in
dist/*.whl
Verify the built package:
twine check dist/*
Test your upload on TestPyPI:
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Upload the package to the real PyPI:
twine upload dist/*
Enter your PyPI username and password when prompted.
The repository includes a GitHub Actions workflow for automated publishing:
- Generate an API token at https://pypi.org/manage/account/token/
- Add the following secrets to your GitHub repository:
PYPI_USERNAME
:__token__
PYPI_PASSWORD
: Your PyPI API token
-
Create a new tag:
git tag v0.1.0 git push origin v0.1.0
-
Create a release from the tag on GitHub:
- Go to the repository on GitHub
- Navigate to "Releases"
- Click "Create a new release"
- Select the tag
- Add a title and description
- Publish the release
The GitHub Actions workflow will automatically:
- Build the package
- Test it
- Upload it to PyPI
If you get an error saying the package already exists with that version:
- You cannot upload a file with the same name twice to PyPI
- You must increment the version number even for small fixes
If twine reports problems with your package structure:
- Check that your
pyproject.toml
andsetup.py
are properly configured - Verify that all required files are included in the package
If you have authentication problems:
- Verify your PyPI username and password
- Check that your API token is correctly set up and has appropriate permissions
- Ensure your token hasn't expired
- Update version number in all relevant files
- Update
CHANGELOG.md
- Run tests locally:
pytest
- Build package locally:
python -m build
- Check package:
twine check dist/*
- Create Git tag
- Create GitHub release
- Verify the GitHub Action completes successfully
- Verify package is available on PyPI
- Verify package can be installed:
pip install fpl-mcp