diff --git a/.github/workflows/publish_to_pypi.yaml b/.github/workflows/publish_to_pypi.yaml new file mode 100644 index 0000000..bfe99f9 --- /dev/null +++ b/.github/workflows/publish_to_pypi.yaml @@ -0,0 +1,41 @@ +name: Publish Python Package to PyPI + +on: + push: + tags: + - "v*" + +jobs: + build-n-publish: + name: Build and publish Python + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install wheel + + - name: Extract tag name + id: tag + run: | + echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3) + + - name: Update version in setup.py + run: | + sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py + + - name: Build a binary wheel + run: | + python setup.py sdist bdist_wheel + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/setup.py b/setup.py index 08ca952..2a301b5 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,31 @@ from setuptools import setup, find_packages +from pathlib import Path + +PY_TGI_VERSION = "0.1.0" + +common_setup_kwargs = { + "author": "Ilyas Moutawwakil", + "author_email": "ilyas.moutawwakil@gmail.com", + "description": "A Python wrapper around TGI", + "keywords": ["python", "tgi", "llm", "huggingface", "docker"], + "url": "https://github.com/IlyasMoutawwakil/py-tgi", + "long_description_content_type": "text/markdown", + "long_description": (Path(__file__).parent / "README.md").read_text( + encoding="UTF-8" + ), + "platforms": ["linux", "windows", "macos"], + "classifiers": [ + "Environment :: GPU :: NVIDIA CUDA :: 11.8", + "Environment :: GPU :: NVIDIA CUDA :: 12", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Natural Language :: English", + ], +} setup( name="py-tgi", - version="0.0.1", + version=PY_TGI_VERSION, packages=find_packages(), install_requires=["docker", "huggingface-hub"], )