diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index d26a3fa395..45b89bb1db 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -18,19 +18,14 @@ jobs: run: | python -m pip install --upgrade pip pip install setuptools wheel twine - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y%m%d')" - name: Build package run: | - version=$(python setup.py --version) - new_version="${version}.dev${{ steps.date.outputs.date }}" - sed -i "s/version=.*/version='${new_version}',/" setup.py + export TORCHAO_NIGHTLY=1 python setup.py sdist bdist_wheel - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} - repository_url: https://pypi.org/project/torchao-nightly/ + repository_url: https://upload.pypi.org/legacy/ packages_dir: dist/ diff --git a/requirements.txt b/requirements.txt index f7a4d821ed..e62b709c4c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ +torch numpy -sentencepiece \ No newline at end of file +sentencepiece diff --git a/setup.py b/setup.py index fad6c316d2..b478c807ca 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,30 @@ # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. - # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. +import os +from datetime import datetime from setuptools import setup, find_packages +current_date = datetime.now().strftime('%Y.%m.%d') + + +def read_requirements(file_path): + with open(file_path, 'r') as file: + return file.read().splitlines() + +# Determine the package name based on the presence of an environment variable +package_name = 'torchao-nightly' if os.environ.get('TORCHAO_NIGHTLY') else 'torchao' + +# Version is year.month.date if using nightlies +version = current_date if package_name == 'torchao-nightly' else '0.0.3' + setup( - name='torchao', - version='0.0.3', + name=package_name, + version=version, packages=find_packages(), - install_requires=[ - 'torch', - ], + install_requires=read_requirements('requirements.txt'), description='Package for applying ao techniques to GPU models', long_description=open('README.md').read(), long_description_content_type='text/markdown',