diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 00000000..094dde96 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,42 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: | + sudo apt-get update + # scipy dependencies + sudo apt-get install -y libopenblas-dev + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@1.8 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 3f29e4d4..927eb8ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ [project] # https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ -name = "selector" +name = "qc-selector" version = "0.0.1" description = "Molecule selection with maximum diversity." readme = "README.md" @@ -49,7 +49,7 @@ keywords = [ classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Console", - "License :: OSI Approved :: GNU (Version 3)", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Natural Language :: English", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", diff --git a/setup.py b/setup.py index ab595352..3d077a98 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ from setuptools import setup -short_description = "Subset selection with maximized diversity".split("\n")[0] +short_description = "Molecule selection with maximum diversity".split("\n")[0] # from https://github.com/pytest-dev/pytest-runner#conditional-requirement needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv) @@ -37,16 +37,15 @@ except ValueError: long_description = short_description - -setup( - name="selector", +package_metadata = dict( + name="qc-selector", author="QC-Devs Community", author_email="qcdevs@gmail.com", description=short_description, long_description=long_description, long_description_content_type="text/markdown", version="0.0.1", - license="GNU (Version 3)", + license="GNU General Public License v3 (GPLv3)", package_dir={"selector": "selector"}, packages=["selector", "selector.methods", "selector.tests", "selector.methods.tests"], # Optional include package data to ship with your package @@ -82,3 +81,17 @@ # zip_safe=False, # todo: add classifiers ) + +# Naming format of the pypi wheel +wheel_name_format = "{name}-{version}-{py_version}-none-any.whl" + +# Modify wheel file name based on the platform and Python version +distname = wheel_name_format.format( + name=package_metadata["name"], + version=package_metadata["version"], + py_version="py" + "".join(map(str, sys.version_info[:2])), +) + +package_metadata["distname"] = distname + +setup(**package_metadata)