This guide outlines the steps to publish the Code-RAG project to PyPI.
You can use the provided release script to automate the version bumping, tagging, building, and publishing process:
python3 scripts/release.pyThe script will:
- Ask for the version bump type (patch, minor, major).
- Update the version in
pyproject.tomlandsrc/code_rag/__init__.py. - Commit and tag the version in git.
- Build the package using
python -m build. - Upload the package to PyPI using
twine.
- Create an account on PyPI.
- (Optional but recommended) Create an account on TestPyPI to test the upload first.
- Install the necessary tools:
pip install --upgrade build twine
We have already created a pyproject.toml file which contains the metadata and dependencies.
- Action Required: Open
pyproject.tomland update the following fields:authors: Replace "Your Name" and "[email protected]".project.urls: Update the GitHub URLs to your repository.
Run the following command in the root directory:
python -m buildThis will create a dist/ directory containing the source distribution (.tar.gz) and the wheel (.whl).
Check if the description and metadata are correct:
twine check dist/*It's a good idea to test the upload on the test server first:
twine upload --repository testpypi dist/*You can then try installing it from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ --no-deps code-ragOnce everything looks good, upload to the real PyPI:
twine upload dist/*To publish a new version later:
- Update the version in
pyproject.tomlandsrc/code_rag/__init__.py. - Delete the old
dist/folder. - Repeat steps 3, 4, and 6.