Create Django Package 3 - Tirrilee/TechTalk GitHub Wiki
ν¨ν€μ§
- https://code.tutsplus.com/ko/tutorials/how-to-share-your-python-packages--cms-26114
λ€λ₯Έ ν¨ν€μ§ μ²λΌ λ³ΈμΈμ΄ μμ±ν κ°μνκ²½ ν΄λ νμμ μλ
/libν΄λμ ν¨ν€μ§λ₯Ό μΆκ°νκΈ° μν΄μ setup.pyλ₯Ό λ§λ€μ΄μΌ νλ€.
setup.pyμλ μ΄λ¦, λ²μ , μ€λͺ , νμν ν¨ν€μ§μ κ°μ ν¨ν€μ§μ μ λ³΄κ° λ€μ΄κ°κ² λλ€.
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
setup(
name='Tirrilee-Contact-Form',
version='0.1',
packages=['Tirrilee_Contact_Form/templates','Tirrilee_Contact_Form/templatetags', 'Tirrilee_Contact_Form'],
description='Contact Form Package From Tirrilee',
long_description=README,
author='Aiden',
author_email='[email protected]',
url='https://github.com/Tirrilee/Django-Packages/Contact-Form/',
license='MIT',
include_package_data=True, # html νμΌ
install_requires=[
'Django>=2.0',
]
)
- name :
pip installν λ μ¬μ©λμ΄μ§λ μ΄λ¦ - version : ν΄λΉ ν¨ν€μ§μ λ²μ
- packages : ν¨ν€μ§λ₯Ό μν΄ μμ±ν μ±μ μ΄λ¦
- description : ν¨ν€μ§μ λν κ°λ¨ μ€λͺ
- long_description : README νμΌλ‘λΆν° μ½μ΄μ¨ μμΈ μ€λͺ
- author : ν¨ν€μ§ μ μμ
- author_email : ν¨ν€μ§ μ μμ λ©μΌ
- url : κΉν μ£Όμ
- license : λΌμ΄μΌμ€ (MIT)
- install_requires : μ¬μ© κ°λ₯ν Django λ²μ
setup.py νμΌμ λ§λ€κ³ λλ©΄, λ°°ν¬ν νμΌμ μ§μ νλ MANIFEST.in νμΌμ μμ±νλ€.
include *.txt *.ini *.cfg *.md
include Tirrilee_Contact_Form/templates/tirrilee_contact_form/*.*
recursive-include myapp *.ico *.png *.css *.gif *.jpg *.txt *.js *.html *.xml
μ€μ μ΄ μλ£λλ©΄, μλ ν¨ν€μ§λ€μ μ€μΉνλ€.
$ pip install setuptools wheel
setup.py νμΌμ΄ μλ κ²½λ‘μμ μλμ κ°μ΄ μ
λ ₯ν΄ ν¨ν€μ§μ μ§ννλ€.
$ python3 setup.py sdist # bdist_wheel
ν¨ν€μ§μ΄ μ’ λ£λλ©΄ dist ν΄λμ μλμ κ°μ΄ 2κ°μ νμΌμ΄ μμ±λ κ²μ νμΈ ν μ μλ€.
dist
βββ Tirrilee-Contact-Form-0.1-py3-none-any.whl
βββ Tirrilee-Contact-Form-0.1.tar.gz
λ±λ‘
μ΄μ ν¨ν€μ§λ₯Ό PyPIμ¬μ΄νΈμ λ±λ‘μ ν κ² μ΄λ€. PyPIλ μμ©μ¬μ΄νΈμ ν μ€νΈμ¬μ΄νΈλ‘ λλ μ§λ©°, μ°μ ν μ€νΈ μ¬μ΄νΈμ ν¨ν€μ§λ₯Ό μ λ‘λνκ³ ν μ€νΈ ν΄λ³΄λλ‘νμ.
$ pip install twine
twineμ ν¨ν€μ§ μ λ‘λλ₯Ό λμμ£Όλ λΌμ΄λΈλ¬λ¦¬μ΄λ€.
$ twine upload --repository-url https://test.pypi.org/legacy/ dist/*
μ€μ λ°°ν¬ : twine upload --repository-url https://upload.pypi.org/legacy/ dist/* http 400 μ€λ₯μ : twine upload --skip-existing --repository-url https://upload.pypi.org/legacy/ dist/*
μμ κ°μ΄ μ
λ‘λλ₯Ό νκ³ , ν
μ€νΈ μ¬μ΄νΈμ λ€μ΄κ°λ©΄ ν¨ν€μ§κ° λ±λ‘λ κ²μ νμΈ ν μ μλ€.
