From c7a1749e6e328f77a163b0d41c4104f5d3e5637d Mon Sep 17 00:00:00 2001 From: Mubaraq Sani <55236862+SamDewriter@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:55:57 +0100 Subject: [PATCH] PyPI automatic deployment through GitHub Action (#59) * Packaging SimulEval * Create publish-to-test-pypi.yml for packaging * Change the version * Update publish-to-test-pypi.yml * change version for testing * Add change to test * Update publish-to-test-pypi.yml * Change version to trigger action * Add config to setup.py * set up circleci * Change version and name of the package * Update config.yml * Delete publish-to-test-pypi.yml * Delete pyproject.toml * Circleci setup * CircleCi * Test github action * Test github action * Change version to test Github action * PyPi workflow * update guthub action to trusted publisher config * add license * use black to format. Fixes #52 * Use black to format. #52 * change name and version to initial. (#52) * remove circleci. (#52) * Update setup.py to remove author email Co-authored-by: Abinesh Ramakrishnan <3632454+ibanesh@users.noreply.github.com> * Remove author_email * remove twine (#52) * remove author email (#52) * remove testpypi-publish. (#52) --------- Co-authored-by: Mubaraq Sani <{ID}+{username}@users.noreply.github.com> Co-authored-by: Abinesh Ramakrishnan <3632454+ibanesh@users.noreply.github.com> --- .github/workflows/pypi-publish.yml | 37 +++++++++++++++++++++++++ setup.py | 44 ++++++++++++++++++++++++++++-- 2 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pypi-publish.yml diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 00000000..16e60fb6 --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,37 @@ +name: PyPI Publish + +on: + push: + branches: + - main + tags: + - v* +jobs: + pypi_publish: + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/simuleval + permissions: + id-token: write + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.x + + - name: Install dependencies + run: pip install --upgrade pip setuptools wheel + + - name: Build package + run: python setup.py sdist bdist_wheel + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + args: "--use-feature=fast-deploy" \ No newline at end of file diff --git a/setup.py b/setup.py index 64aae337..b7b0b779 100644 --- a/setup.py +++ b/setup.py @@ -4,13 +4,22 @@ # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. -import setuptools +from setuptools import setup, find_packages -setuptools.setup( +with open("README.md", "r") as readme_file: + long_description = readme_file.read() + +setup( python_requires=">3.7.0", name="simuleval", version="1.1.0", author="Xutai Ma", + description="SimulEval: A Flexible Toolkit for Automated Machine Translation Evaluation", + long_description=long_description, + long_description_content_type="text/markdown", + homepage="https://github.com/facebookresearch/SimulEval.git", + documentation="https://simuleval.readthedocs.io/en/v1.1.0/quick_start.html", + license="LICENSE", entry_points={ "console_scripts": [ "simuleval = simuleval.cli:main", @@ -32,7 +41,34 @@ "yt-dlp", "pydub", ], - package=setuptools.find_packages( + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Development Status :: 4 - Beta", + ], + keywords=[ + "SimulEval", + "Machine Translation", + "Evaluation", + "Metrics", + "BLEU", + "TER", + "METEOR", + "chrF", + "RIBES", + "WMD", + "Embedding Average", + "Embedding Extrema", + "Embedding Greedy", + "Embedding Average", + "SimulEval", + "SimulEval_Testing_Package_1", + "facebookresearch", + "facebook", + "Meta-Evaluation", + ], + packages=find_packages( exclude=[ "examples", "examples.*", @@ -40,4 +76,6 @@ "docs.*", ] ), + setup_requires=["setuptools_scm"], + use_scm_version=True, )