Add publishing configuration and package metadata for PyPI distribution

- Add .pypirc for PyPI and TestPyPI token configuration
- Create MANIFEST.in to include necessary files for package distribution
- Add PUBLISHING.md with detailed instructions for package publishing
- Update pyproject.toml for build system configuration
- Update README.md with PyPI installation instructions
- Bump version to 0.4.0 in __init__.py
- Include rules.json in package source for distribution
This commit is contained in:
sanjeed5
2025-02-28 19:43:17 +05:30
parent 2ed7dd1030
commit 34046a1da0
7 changed files with 1082 additions and 11 deletions
+77
View File
@@ -0,0 +1,77 @@
# Publishing to PyPI
This document provides instructions for publishing the `cursor-rules` package to PyPI.
## Prerequisites
1. Create a PyPI account at https://pypi.org/account/register/
2. Generate an API token at https://pypi.org/manage/account/token/
3. Install required tools:
```bash
pip install build twine
```
## Publishing Steps
1. Update the version in `src/__init__.py`
2. Build the package:
```bash
python -m build
```
3. Test the package locally:
```bash
pip install --force-reinstall dist/cursor_rules-*.whl
cursor-rules --help
```
4. Upload to TestPyPI (optional):
```bash
python -m twine upload --repository testpypi dist/*
```
5. Install from TestPyPI (optional):
```bash
pip install --index-url https://test.pypi.org/simple/ cursor-rules
```
6. Upload to PyPI:
```bash
python -m twine upload dist/*
```
## Using API Tokens
When using twine, you can either:
1. Create a `.pypirc` file in your home directory:
```
[distutils]
index-servers =
pypi
testpypi
[pypi]
username = __token__
password = your_pypi_token
[testpypi]
repository = https://test.pypi.org/legacy/
username = __token__
password = your_testpypi_token
```
2. Or provide credentials via environment variables:
```bash
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=your_pypi_token
```
3. Or enter them when prompted by twine.
## Updating the Package
1. Make your changes
2. Update the version in `src/__init__.py`
3. Rebuild and upload following the steps above