diff --git a/.github/workflows/release_pypi.yaml b/.github/workflows/release_pypi.yaml new file mode 100644 index 0000000..dc74fca --- /dev/null +++ b/.github/workflows/release_pypi.yaml @@ -0,0 +1,33 @@ +name: Publish to PyPI + +on: + workflow_dispatch: + pull_request: + paths: + - 'version.txt' + types: + - closed + +jobs: + build-n-publish: + if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI-Platform-CLI' && github.event.pull_request.merged == true && github.base_ref == 'main' + name: Build and publish Python 🐍 distributions 📦 to PyPI + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: '3.8.14' + + - run: python setup.py sdist build + + # publish to PyPI if executed on the main branch + - name: Publish package to PyPI + id: publish + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + verbose: true diff --git a/.github/workflows/test_pypi_before_update.yaml b/.github/workflows/test_pypi_before_update.yaml new file mode 100644 index 0000000..5f79da5 --- /dev/null +++ b/.github/workflows/test_pypi_before_update.yaml @@ -0,0 +1,52 @@ +name: Publish to Test-PyPI Before Merge + +on: + pull_request: + paths: + - 'version.txt' + +jobs: + build-n-publish: + if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI-Platform-CLI' + name: Build and publish Python 🐍 distributions 📦 to Test PyPI + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: '3.8.14' + + - name: add timestamp to the version + id: prep-version + run: | + version=$(cat version.txt) + timestamp=$(date +%s) + new_version="${version}.post${timestamp}" + echo $new_version > ./version.txt + echo "version=$new_version" >> $GITHUB_OUTPUT + + - run: python setup.py sdist build + + # publish to PyPI if executed on the main branch + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + verbose: true + + - name: Wait for Test-PyPI refresh + run: sleep 300s + shell: bash + + - name: Try installation + run: | + # we need to install the requirements.txt first + # as test-pypi may not contain the distributions for libs listed in the txt file + pip install -r requirements/requirements.txt + pip install --index-url https://test.pypi.org/simple/ colossalai-platform-cli==$VERSION + env: + VERSION: ${{ steps.prep-version.outputs.version }} diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..3c1e056 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include *.txt README.md +recursive-include colossalai *.md *.json *.py Dockerfile *.sh diff --git a/README.md b/README.md index 1f9a072..e77546f 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ The CLI is built on top of [Click](https://click.palletsprojects.com/en/8.0.x/), pip install git+https://github.com/hpcaitech/ColossalAI-Platform-CLI@main ``` -2. From PyPI (**Not Available Yet**) +2. From PyPI ```bash pip install colossalai-platform ``` diff --git a/setup.py b/setup.py index 8a0b15f..0609fdf 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ def get_project_files(): setup( - name='colossalai_platform', + name='colossalai-platform', version=get_version(), packages=find_packages(exclude=( 'build', @@ -62,7 +62,7 @@ def get_project_files(): classifiers=[ 'Programming Language :: Python :: 3', 'License :: OSI Approved :: Apache Software License', - 'Topic :: Cloud :: Command Line Tool', - 'Topic :: System :: Distributed Computing', + 'Topic :: Software Development :: Build Tools', + "Topic :: System :: Distributed Computing" ], )