본문 바로가기
개발/Python

Python - 내가 만든 모듈, 다른 사람들이 사용하도록 패키징하기

by 보안매크로 2024. 3. 15.
728x90

1. setup.py 를 내 작업공간에 만든다

2. 프로젝트의 메타데이터(이름, 버전 등)을 아래와 같이 작성한다. (패키징 작업)

from setuptools import find_namespace_packages, setup

 

setup(
    name='test',
    version='3.2.1',
    description='Test',
    author='SungJun',
    author_email='xxxxx@naver.com',
    url='깃허브주소', #파일들이 존재하는 깃허브 주소
    packages=find_namespace_packages(where='src', include=['SungJun*']),
    package_dir={'': 'src'},
    install_requires=[
        'numpy',
        'pandas',
        'matplotlib',
        'mplfinance',
        'tqdm',
        'scikit-learn',
        'tensorflow',
        'torch',
    ]
)

 

3. PyPI에 패키지 업로드
PyPI에 로그인하고, twine과 같은 도구를 사용하여 패키지 빌드 후 업로드

4. 다른 유저들이 'pip install 내모듈' 로 다운이 가능하다.

728x90

'개발 > Python' 카테고리의 다른 글

Python 정적 메소드(@staticmethod)  (0) 2024.03.14
파이썬 EXE 파일 만들기  (0) 2023.12.31
파이썬 가상환경 설정법  (0) 2023.12.16
Python @Property  (0) 2023.10.11
파이썬에서 Self란 뭘까?  (0) 2023.09.06