본문 바로가기
카테고리 없음

나만의 파이썬 패키지 만들어서 배포하기

by 뷰티풀스택 2023. 5. 16.
반응형

1. 기본 디렉토리 구조 잡기

packaging_tutorial/
├── LICENSE
├── pyproject.toml
├── README.md
├── src/
│   └── example_package_YOUR_USERNAME_HERE/
│       ├── __init__.py
│       └── example.py
└── tests/

 

2. pyproject.toml 설정 파일 작성

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "arxivai"
version = "0.0.2"
authors = [
  { name="your name", email="your email@gmail.com" },
]
description = "... wrapper for Python."
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
]

[project.urls]
"Homepage" = "https://github.com/....."
"Bug Tracker" = "https://github.com/..../issues"

 

3. Build 하기

python -m pip install --upgrade build

python -m build

 

4. 배포하기

--skip-existing은 이전 버젼이 PyPi 서버에 존재하면 스킵하도록 하는 것이다. 이 옵션을 주지 않으면 계속 에러가 나서 배포할 수가 없으니 꼭 추가해야 한다.

twine upload --skip-existing dist/*

 

반응형

댓글