From d08776194d4bc53ac175e1fe4140b9c0e6da75fe Mon Sep 17 00:00:00 2001 From: Keigh Rim Date: Fri, 25 Jul 2025 23:51:38 -0400 Subject: [PATCH 1/3] updated setup.py to support newer setuptools (in 3.12 and newer) --- .github/workflows/codecov.yml | 4 +-- requirements.dev | 1 + setup.py | 46 ++++++++++++++++++++--------------- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 76f895df..98dc30cb 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11", "3.10"] + python-version: ["3.12", "3.11", "3.10"] env: OS: linux GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -38,7 +38,7 @@ jobs: - name: "๐Ÿงช Run test and generate coverage report" working-directory: . run: | - echo "codecov.dev" > VERSION + echo "0.0.0+codecov.dev" > VERSION make test - name: "๐Ÿ“ฆ Upload coverage artifact" uses: actions/upload-artifact@v4 diff --git a/requirements.dev b/requirements.dev index d12b58da..c5112b9d 100644 --- a/requirements.dev +++ b/requirements.dev @@ -13,3 +13,4 @@ sphinx-autobuild git+https://github.com/clamsproject/sphinx-multiversion.git@master twine m2r2 +setuptools>=70 \ No newline at end of file diff --git a/setup.py b/setup.py index 36f0c7cf..303c7cd1 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,8 @@ from urllib import request import setuptools.command.build_py -import setuptools.command.develop +from setuptools.command.sdist import sdist +from setuptools.command.develop import develop name = "mmif-python" version_fname = "VERSION" @@ -254,15 +255,18 @@ def mod_run(self): return setuptools_cmd +# Modernize cmdclass to ensure compatibility with setuptools >=80 @prep_ext_files -class SdistCommand(setuptools.command.sdist.sdist): - pass - +class SdistCommand(sdist): + def initialize_options(self): + super().initialize_options() + # Add any additional initialization logic here if needed @prep_ext_files -class DevelopCommand(setuptools.command.develop.develop): - pass - +class DevelopCommand(develop): + def initialize_options(self): + super().initialize_options() + # Add any additional initialization logic here if needed cmdclass['sdist'] = SdistCommand cmdclass['develop'] = DevelopCommand @@ -279,6 +283,17 @@ class DevelopCommand(setuptools.command.develop.develop): with open('requirements.seq') as requirements: seq_requires = requirements.readlines() +extras_require = { + 'seq': seq_requires, + 'cv': cv_requires, + 'dev': [ + 'pytest', + 'pytest-pep8', + 'pytest-cov', + 'pytype', + ] +} + setuptools.setup( name=name, version=version, @@ -301,21 +316,12 @@ class DevelopCommand(setuptools.command.develop.develop): 'mmif': [f'{mmif_res_pkg}/*', f'{mmif_ver_pkg}/*', f'{mmif_vocabulary_pkg}/*'], }, install_requires=requires, - extras_require={ - 'seq': seq_requires, - 'cv': cv_requires, - 'dev': [ - 'pytest', - 'pytest-pep8', - 'pytest-cov', - 'pytype', - ] - }, + extras_require=extras_require, python_requires='>=3.10', classifiers=[ - 'Development Status :: 2 - Pre-Alpha', - 'Intended Audience :: Developers ', - 'License :: OSI Approved :: Apache Software License', + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'License :: Apache-2.0', 'Programming Language :: Python :: 3 :: Only', ] ) From e3f6aa5ebffae76ee632991d8a5d9eac471c2cae Mon Sep 17 00:00:00 2001 From: Keigh Rim Date: Sat, 26 Jul 2025 00:11:33 -0400 Subject: [PATCH 2/3] reverted test GHA to call common sdk workflow --- .github/workflows/codecov.yml | 57 +++-------------------------------- requirements.dev | 2 +- 2 files changed, 6 insertions(+), 53 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 98dc30cb..d95f3521 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -17,55 +17,8 @@ on: default: "develop" jobs: - test: - name: "๐Ÿงช Test with coverage" - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12", "3.11", "3.10"] - env: - OS: linux - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: "๐Ÿ›๏ธ Checkout repository" - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.branch || github.ref }} - - name: "๐Ÿ Setup Python" - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: "๐Ÿงช Run test and generate coverage report" - working-directory: . - run: | - echo "0.0.0+codecov.dev" > VERSION - make test - - name: "๐Ÿ“ฆ Upload coverage artifact" - uses: actions/upload-artifact@v4 - with: - name: coverage-report-${{ matrix.python-version }} - path: ./coverage.xml - - upload: - name: "โ˜๏ธ Upload coverage to Codecov" - runs-on: ubuntu-latest - needs: test - steps: - - name: "๐Ÿ›๏ธ Checkout repository" - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.branch || github.ref }} - - name: "๐Ÿ“ฅ Download coverage artifact" - uses: actions/download-artifact@v4 - with: - name: coverage-report-3.10 - - name: "โ˜๏ธ Upload coverage to Codecov" - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_UPLOAD_TOKEN_MMIF_PYTHON }} - files: ./coverage.xml - flags: unittests - env_vars: OS,PYTHON - name: coverage - fail_ci_if_error: true - + test-and-codecov: + name: "๐Ÿค™ Call SDK test workflow" + uses: clamsproject/.github/.github/workflows/sdk-codecov.yml@main + secrets: + CC_REPO_UPLOAD_TOKEN: ${{ secrets.CODECOV_UPLOAD_TOKEN_MMIF_PYTHON }} diff --git a/requirements.dev b/requirements.dev index c5112b9d..ec6113f7 100644 --- a/requirements.dev +++ b/requirements.dev @@ -13,4 +13,4 @@ sphinx-autobuild git+https://github.com/clamsproject/sphinx-multiversion.git@master twine m2r2 -setuptools>=70 \ No newline at end of file +setuptools>=70 # arbitrarily recent version \ No newline at end of file From 88e7479397878e03f7caa2eb39a6264d7566a44a Mon Sep 17 00:00:00 2001 From: Keigh Rim Date: Sat, 26 Jul 2025 00:20:05 -0400 Subject: [PATCH 3/3] reverted publish GHA to call common sdk workflow --- .github/workflows/publish.yml | 51 +++-------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 999294da..6be5812e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,50 +6,7 @@ on: - '[0-9]+.[0-9]+.[0-9]+' jobs: - build-and-upload: - name: "๐Ÿ“ฆ Upload documentation, PyPI distribution" - runs-on: ubuntu-latest - env: - OS: linux - PYTHON: '3.10' - steps: - - name: "๐Ÿท Prepare package metadata" - run: | - echo "VERSION=$(echo "${{ github.ref }}" | cut -d/ -f3)" >> $GITHUB_ENV - echo "PACKAGE=$(echo "${{ github.repository }}" | cut -d/ -f2 | tr '-' '_')" >> $GITHUB_ENV - - name: "๐Ÿ› Checkout repository" - uses: actions/checkout@v4 - with: - ref: ${{ env.VERSION }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: "๐Ÿ Setup Python" - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: "๐Ÿ— Build sdist" - run: | - echo ${{ env.VERSION }} > VERSION - python3 -c "import setuptools; print(setuptools.__version__)" - python3 -m pip install setuptools~=69.3 # this version fully conforms PEP-625 and applies wheel name convention to sdist as well - make package - make test - - name: "๐Ÿ—ž๏ธ Build HTML documentation" - run: | - make docs - - name: "๐Ÿ““ Generate changelog" - run: | - for pr in $(gh pr list -L 1000 -s merged | grep -E "^[0-9]+\s+releas" | cut -f 1 ); do gh pr view $pr --json title,body,mergedAt --template '{{printf "\n"}}## {{.title}} ({{timefmt "2006-01-02" .mergedAt}}){{printf "\n"}}{{.body}}{{printf "\n"}}'; done > CHANGELOG.md - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: "๐Ÿซ™ Commit and push documentation files" - run: | - git config --local user.email "admin@clams.ai" - git config --local user.name "clams-bot" - for f in docs documentation CHANGELOG.md; do if [ -e $f ]; then git add $f; fi; done - git add -u docs - git commit -m 'adding HTML documentation for publication' - git push origin HEAD:main - - name: "โ˜๏ธ Upload to PyPI" - run: | - if [ -d dist ]; then twine upload -u __token__ -p ${{ secrets.PYPITOKEN }} dist/${{ env.PACKAGE }}-${{ env.VERSION }}.tar.gz ; fi + package-and-upload: + name: "๐Ÿค™ Call SDK publish workflow" + uses: clamsproject/.github/.github/workflows/sdk-publish.yml@main + secrets: inherit