RL005: PyPIPublished
Overview
| Property | Value |
|---|---|
| ID | RL005 |
| Name | PyPIPublished |
| Group | release |
| Severity | NOTE |
Description
Checks whether the package has been published to PyPI (Python Package Index).
Being on PyPI makes your package easily installable via pip install.
What it checks
The check queries PyPI’s API to determine if a package with the project name exists:
- Reads the project name from
pyproject.toml - Queries
https://pypi.org/pypi/{package_name}/json - Reports if the package is found or not
Why it matters
- Discoverability - Users can find your package on PyPI
- Easy Installation -
pip install package-namejust works - Dependency Resolution - Other packages can depend on yours
- Trust - PyPI-published packages appear more established
- Version Management - PyPI tracks all published versions
How to fix
Publishing to PyPI
Create a PyPI account at pypi.org
Configure your build backend in
pyproject.toml:
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "my-package"
version = "1.0.0"
# ... other metadata- Build your package:
pip install build
python -m build- Upload to PyPI:
pip install twine
twine upload dist/*Using trusted publishing (recommended)
Set up trusted publishing with GitHub Actions for secure, passwordless uploads:
- Add your project on PyPI with GitHub Actions as a trusted publisher
- Use this workflow:
name: Publish to PyPI
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build tools
run: pip install build
- name: Build package
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1Test on TestPyPI first
Before publishing to PyPI, test on TestPyPI:
twine upload --repository testpypi dist/*
pip install --index-url https://test.pypi.org/simple/ my-packageConfiguration
Skip this check
[tool.pycmdcheck]
skip = ["RL005"]CLI
pycmdcheck --skip RL005