From 3f0595ac2b8f387116a21b8a820b0c99b0147ae6 Mon Sep 17 00:00:00 2001 From: kunikachandra Date: Wed, 6 Mar 2024 22:59:56 +0530 Subject: [PATCH 1/7] Fix GNU license --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3f29e4d4..653ffba8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", From faa47e4886ccb68129ad7b162cc52d214801c701 Mon Sep 17 00:00:00 2001 From: kunikachandra Date: Wed, 6 Mar 2024 23:05:21 +0530 Subject: [PATCH 2/7] Add pypi release workflow --- .github/workflows/python-publish.yml | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 00000000..f1c0f474 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,43 @@ +# 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@v3 + - name: Set up Python + uses: actions/setup-python@v3 + 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@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} From 87a7d94b4dd90e097ce2f6d88f80de004e6fefae Mon Sep 17 00:00:00 2001 From: kunikachandra Date: Wed, 6 Mar 2024 23:37:45 +0530 Subject: [PATCH 3/7] Fix yaml comment indentation error --- .github/workflows/python-publish.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index f1c0f474..2b4e3e4f 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -29,9 +29,8 @@ jobs: - name: Install dependencies run: | sudo apt-get update - # scipy dependencies + # scipy dependencies sudo apt-get install -y libopenblas-dev - python -m pip install --upgrade pip pip install build - name: Build package From 7927fc5d96b6dd359b9ddb348fca81d1e96872c9 Mon Sep 17 00:00:00 2001 From: kunikachandra Date: Fri, 8 Mar 2024 20:25:41 +0530 Subject: [PATCH 4/7] Use latest workflow versions --- .github/workflows/python-publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 2b4e3e4f..094dde96 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -21,9 +21,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies @@ -36,7 +36,7 @@ jobs: - name: Build package run: python -m build - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + uses: pypa/gh-action-pypi-publish@1.8 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} From 5fc4f62cf94816e937905db8b03b5a5413da00b1 Mon Sep 17 00:00:00 2001 From: kunikachandra Date: Tue, 16 Apr 2024 21:55:29 +0530 Subject: [PATCH 5/7] Support dynamic naming of pypi packages using setup.py --- setup.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index ab595352..58403033 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,8 +37,7 @@ except ValueError: long_description = short_description - -setup( +package_metadata = dict( name="selector", author="QC-Devs Community", author_email="qcdevs@gmail.com", @@ -46,7 +45,7 @@ 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) From f3d61b1d5824770d34a879e99cf9dabeefe76421 Mon Sep 17 00:00:00 2001 From: kunikachandra Date: Tue, 16 Apr 2024 21:56:07 +0530 Subject: [PATCH 6/7] Change name to qc-selector --- pyproject.toml | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 653ffba8..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" diff --git a/setup.py b/setup.py index 58403033..ede563b2 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ long_description = short_description package_metadata = dict( - name="selector", + name="qc-selector", author="QC-Devs Community", author_email="qcdevs@gmail.com", description=short_description, From 6cf18ff8279069c7145209922b994c76a60d25d3 Mon Sep 17 00:00:00 2001 From: kunikachandra Date: Tue, 16 Apr 2024 22:02:29 +0530 Subject: [PATCH 7/7] pre-commit formatting --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ede563b2..3d077a98 100644 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ distname = wheel_name_format.format( name=package_metadata["name"], version=package_metadata["version"], - py_version="py" + "".join(map(str, sys.version_info[:2])) + py_version="py" + "".join(map(str, sys.version_info[:2])), ) package_metadata["distname"] = distname