PYPI_DEPLOYMENT.mdโข5.92 kB
# ๐ PyPI ๋ฐฐํฌ ๊ฐ์ด๋
์ด ๋ฌธ์๋ `encoding-mcp` ํจํค์ง๋ฅผ PyPI์ ๋ฐฐํฌํ๋ ๋ฐฉ๋ฒ์ ์ค๋ช
ํฉ๋๋ค.
## ๐ ์ฌ์ ์ค๋น์ฌํญ
### 1. PyPI ๊ณ์ ์์ฑ
- [PyPI.org](https://pypi.org) ๊ณ์ ์์ฑ
- [TestPyPI.org](https://test.pypi.org) ๊ณ์ ์์ฑ (ํ
์คํธ์ฉ)
### 2. API ํ ํฐ ์์ฑ
PyPI์ TestPyPI์์ API ํ ํฐ์ ์์ฑํฉ๋๋ค:
1. PyPI ๋ก๊ทธ์ธ โ Account settings โ API tokens
2. "Add API token" ํด๋ฆญ
3. Token name: `encoding-mcp-release`
4. Scope: "Entire account" (์ฒซ ๋ฐฐํฌ์) ๋๋ "Project: encoding-mcp"
5. ์์ฑ๋ ํ ํฐ์ ์์ ํ ๊ณณ์ ์ ์ฅ
### 3. GitHub Secrets ์ค์
GitHub ์ ์ฅ์์์ ๋ค์ Secrets๋ฅผ ์ค์ ํฉ๋๋ค:
- `PYPI_API_TOKEN`: PyPI API ํ ํฐ
- `TEST_PYPI_API_TOKEN`: TestPyPI API ํ ํฐ (์ ํ์ฌํญ)
**์ค์ ๋ฐฉ๋ฒ:**
1. GitHub ์ ์ฅ์ โ Settings โ Secrets and variables โ Actions
2. "New repository secret" ํด๋ฆญ
3. Name๊ณผ Value ์
๋ ฅ ํ ์ ์ฅ
## ๐ ๏ธ ๋ก์ปฌ ๊ฐ๋ฐ ํ๊ฒฝ ์ค์
### 1. ๊ฐ๋ฐ ์์กด์ฑ ์ค์น
```bash
# ๊ฐ๋ฐ ํ๊ฒฝ ์ค์
pip install -e .[dev,test]
# ๋๋ ๊ฐ๋ณ ์ค์น
pip install build twine pytest flake8 mypy black
```
### 2. ์ฝ๋ ํ์ง ๊ฒ์ฌ
```bash
# ๋ฆฐํ
flake8 encoding_mcp
# ํ์
์ฒดํฌ
mypy encoding_mcp
# ์ฝ๋ ํฌ๋งทํ
black encoding_mcp
# ํ
์คํธ ์คํ
pytest --cov=encoding_mcp
```
## ๐ฆ ์๋ ๋ฐฐํฌ ๋ฐฉ๋ฒ
### 1. ํจํค์ง ๋น๋
```bash
# ๋น๋ ๋๋ ํฐ๋ฆฌ ์ ๋ฆฌ
rm -rf dist/ build/ *.egg-info/
# ํจํค์ง ๋น๋
python -m build
```
### 2. ํจํค์ง ๊ฒ์ฆ
```bash
# ํจํค์ง ๊ตฌ์กฐ ํ์ธ
twine check dist/*
# ์ค์น ํ
์คํธ
pip install dist/*.whl
python -c "import encoding_mcp; print(encoding_mcp.__version__)"
```
### 3. TestPyPI์ ์
๋ก๋ (ํ
์คํธ)
```bash
# TestPyPI์ ์
๋ก๋
twine upload --repository testpypi dist/*
# TestPyPI์์ ์ค์น ํ
์คํธ
pip install --index-url https://test.pypi.org/simple/ encoding-mcp
```
### 4. PyPI์ ์
๋ก๋ (์ด์)
```bash
# PyPI์ ์
๋ก๋
twine upload dist/*
# PyPI์์ ์ค์น ํ
์คํธ
pip install encoding-mcp
```
## ๐ค ์๋ ๋ฐฐํฌ ๋ฐฉ๋ฒ (๊ถ์ฅ)
### 1. GitHub Actions๋ฅผ ํตํ ์๋ ๋ฐฐํฌ
ํ๋ก์ ํธ์๋ ๋ค์ ์ํฌํ๋ก์ฐ๊ฐ ์ค์ ๋์ด ์์ต๋๋ค:
- **`.github/workflows/test.yml`**: Push/PR ์ ์๋ ํ
์คํธ
- **`.github/workflows/release.yml`**: ํ๊ทธ ์์ฑ ์ ์๋ ๋ฐฐํฌ
### 2. ๋ฆด๋ฆฌ์ค ์์ฑ ๊ณผ์
#### A. ๋ฒ์ ์
๋ฐ์ดํธ
```bash
# ๋ฒ์ ํ์ธ
git tag --list
# ์ ๋ฒ์ ํ๊ทธ ์์ฑ (์: v1.1.0)
git tag v1.1.0
git push origin v1.1.0
```
#### B. ์๋ ๋ฐฐํฌ ๊ณผ์
1. ํ๊ทธ ํธ์ โ GitHub Actions ํธ๋ฆฌ๊ฑฐ
2. ๋ค์ค Python ๋ฒ์ ์์ ํ
์คํธ ์คํ
3. ํจํค์ง ๋น๋ ๋ฐ ๊ฒ์ฆ
4. PyPI์ ์๋ ์
๋ก๋
#### C. ๋ฆด๋ฆฌ์ค ๋
ธํธ ์์ฑ
GitHub์์ Release ํ์ด์ง์ ๋ณ๊ฒฝ์ฌํญ์ ๊ธฐ๋กํฉ๋๋ค.
## ๐ง ๊ณ ๊ธ ์ค์
### 1. Trusted Publishing (๊ถ์ฅ)
GitHub Actions์์ OIDC๋ฅผ ์ฌ์ฉํ ๋ณด์ ๋ฐฐํฌ:
1. PyPI โ Account settings โ Publishing
2. "Add a new pending publisher" ํด๋ฆญ
3. ์ ์ฅ์ ์ ๋ณด ์
๋ ฅ:
- Owner: `whyjp`
- Repository: `encoding_mcp`
- Workflow: `release.yml`
- Environment: `release`
### 2. ๋ฒ์ ์๋ ๊ด๋ฆฌ
`setuptools_scm`์ ์ฌ์ฉํ์ฌ Git ํ๊ทธ์์ ์๋์ผ๋ก ๋ฒ์ ์ ์์ฑํฉ๋๋ค:
```python
# pyproject.toml์ ์ค์ ๋จ
[tool.setuptools_scm]
write_to = "encoding_mcp/_version.py"
```
### 3. ๋ฐฐํฌ ํ๊ฒฝ ๋ถ๋ฆฌ
- **๊ฐ๋ฐ**: ๋ก์ปฌ ํ
์คํธ
- **์คํ
์ด์ง**: TestPyPI
- **์ด์**: PyPI
## ๐ ๋ฌธ์ ํด๊ฒฐ
### 1. ์ผ๋ฐ์ ์ธ ์ค๋ฅ
#### "File already exists" ์ค๋ฅ
```bash
# ํด๊ฒฐ: ๋ฒ์ ์ ์ฌ๋ฆฌ๊ฑฐ๋ ๊ธฐ์กด ํ์ผ ์ญ์
twine upload --skip-existing dist/*
```
#### ํจํค์ง ๋น๋ ์คํจ
```bash
# ์์กด์ฑ ํ์ธ
pip install --upgrade build setuptools wheel
# ๋น๋ ๋๋ ํฐ๋ฆฌ ์ ๋ฆฌ
rm -rf dist/ build/ *.egg-info/
```
#### ํ
์คํธ ์คํจ
```bash
# ์์กด์ฑ ์ค์น ํ์ธ
pip install -e .[test]
# ๊ฐ๋ณ ํ
์คํธ ์คํ
pytest tests/test_encoding_detector.py -v
```
### 2. GitHub Actions ๋ฌธ์
#### Secrets ์ค์ ํ์ธ
- Repository secrets๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์ค์ ๋์๋์ง ํ์ธ
- API ํ ํฐ์ด ์ ํจํ์ง ํ์ธ
#### ์ํฌํ๋ก์ฐ ๊ถํ ํ์ธ
- Repository โ Settings โ Actions โ General
- "Workflow permissions" ํ์ธ
## ๐ ๋ฐฐํฌ ์ํ ๋ชจ๋ํฐ๋ง
### 1. PyPI ํต๊ณ
- [PyPI ํ๋ก์ ํธ ํ์ด์ง](https://pypi.org/project/encoding-mcp/)
- ๋ค์ด๋ก๋ ์, ๋ฒ์ ์ ๋ณด ํ์ธ
### 2. GitHub Actions
- Actions ํญ์์ ๋น๋/๋ฐฐํฌ ์ํ ํ์ธ
- ์คํจ ์ ๋ก๊ทธ๋ฅผ ํตํ ๋ฌธ์ ์ง๋จ
### 3. ์ค์น ํ
์คํธ
```bash
# ๋ค์ํ ํ๊ฒฝ์์ ํ
์คํธ
pip install encoding-mcp
python -c "import encoding_mcp; print('Success!')"
```
## ๐ฏ ๋ฐฐํฌ ์ฒดํฌ๋ฆฌ์คํธ
### ๋ฐฐํฌ ์ ํ์ธ์ฌํญ
- [ ] ๋ชจ๋ ํ
์คํธ ํต๊ณผ
- [ ] ์ฝ๋ ํ์ง ๊ฒ์ฌ ํต๊ณผ
- [ ] README.md ์
๋ฐ์ดํธ
- [ ] CHANGELOG ์์ฑ
- [ ] ๋ฒ์ ๋ฒํธ ํ์ธ
- [ ] GitHub Secrets ์ค์ ํ์ธ
### ๋ฐฐํฌ ํ ํ์ธ์ฌํญ
- [ ] PyPI์์ ํจํค์ง ํ์ธ
- [ ] ์ค์น ํ
์คํธ ์ฑ๊ณต
- [ ] GitHub Release ์์ฑ
- [ ] ๋ฌธ์ ์
๋ฐ์ดํธ
## ๐ ์ง์์ ๊ฐ์
### 1. ์๋ํ ๊ฐ์
- ๋ ๋ง์ ํ
์คํธ ์ผ์ด์ค ์ถ๊ฐ
- ๋ค์ํ OS/Python ๋ฒ์ ์ง์
- ์ฑ๋ฅ ๋ฒค์น๋งํฌ ์ถ๊ฐ
### 2. ํ์ง ๊ด๋ฆฌ
- ์ฝ๋ ์ปค๋ฒ๋ฆฌ์ง ํฅ์
- ์ ์ ๋ถ์ ๋๊ตฌ ์ถ๊ฐ
- ๋ณด์ ์ค์บ ๋๊ตฌ ํตํฉ
### 3. ์ฌ์ฉ์ ํผ๋๋ฐฑ
- Issue ์ถ์ ๋ฐ ํด๊ฒฐ
- ์ฌ์ฉ์ ์์ฒญ ๊ธฐ๋ฅ ๊ตฌํ
- ๋ฌธ์ ๊ฐ์
---
**์ฐธ๊ณ ๋งํฌ:**
- [PyPI Packaging Guide](https://packaging.python.org/)
- [GitHub Actions Documentation](https://docs.github.com/actions)
- [Setuptools Documentation](https://setuptools.pypa.io/)