- Install build tools:
pip install --upgrade pip setuptools wheel twine build-
Get your PyPI API token from https://pypi.org/manage/account/token/
-
Create/update
~/.pypirc:
[pypi]
username = __token__
password = pypi-<your-token-here>IMPORTANT: Build ONLY wheels (binary distributions), NOT source distributions! Users should get pre-compiled binaries and NOT need Visual Studio!
# Clean previous builds
rm -rf build dist *.egg-info
# Build wheels for each Python version you want to support
py -3.11 -m build --wheel # Python 3.11
py -3.12 -m build --wheel # Python 3.12
py -3.13 -m build --wheel # Python 3.13
py -3.14 -m build --wheel # Python 3.14
# Or use the automated script:
build_wheels.bat
# This creates ONLY wheels (no .tar.gz!):
# - dist/fluidx3d-2.16.0-cp311-cp311-win_amd64.whl (Python 3.11)
# - dist/fluidx3d-2.16.0-cp312-cp312-win_amd64.whl (Python 3.12)
# - etc.Why wheels only?
- ✅ Pre-compiled, ready to install
- ✅ Users don't need Visual Studio
- ✅ Fast installation
- ❌ Source distributions require users to compile (BAD!)
# Upload to TestPyPI (WHEELS ONLY!)
python -m twine upload --repository testpypi dist/*.whl
# DO NOT upload .tar.gz files! Only .whl files!
# Test install (from another PC or clean venv)
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple fluidx3d
# Test it works
python -c "import fluidx3d; print(fluidx3d.__version__)"# Upload to real PyPI (WHEELS ONLY!)
python -m twine upload dist/*.whl
# Install from PyPI
pip install fluidx3d
# If you accidentally uploaded a source distribution too, users might try to compile it!
# Only upload .whl files to prevent this!To release a new version:
- Update version in
setup.py:
version='2.16.1', # Increment version- Update version in
src/python_bindings_full.cpp:
return "2.16.1-python";- Rebuild and upload:
rm -rf build dist *.egg-info
python -m build
python -m twine upload dist/*- You can't re-upload the same version
- Increment version number and rebuild
- Make sure you're using
__token__as username - Token must start with
pypi-
- OpenCL.lib must be in
src/OpenCL/lib/ - Check MANIFEST.in includes all necessary files
- This package only works on Windows (x64)
- Wheel will be:
fluidx3d-2.16.0-cp3XX-cp3XX-win_amd64.whl
- Each Python version needs its own wheel (3.11, 3.12, 3.13, 3.14)
- Build on the target Python version you want to support
- Source distribution (.tar.gz) will require compilation on user's machine
- Wheels (.whl) are pre-compiled and install faster