From 24795d44ca965966a0ec059fa7d8e2d14e4b5286 Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Sun, 10 May 2026 20:51:15 +0530 Subject: [PATCH 1/7] chore: upgrade Python 3.8+ and dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Python: 3.4+ → >=3.8 - requests: any → >=2.28.0 - CI: test Python 3.8, 3.9, 3.10, 3.11, 3.12 - GitHub Actions: v2/v3 → v4/v5 Co-Authored-By: Claude Opus 4.7 --- .github/workflows/ci.yml | 43 +++++++++++++++++++++------------------- setup.py | 17 ++++++++-------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd27136..36ed767 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,69 +13,72 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip pip install build python -m build python -m pip install --upgrade twine python -m twine check dist/* - + - name: 'Upload Artifact' uses: actions/upload-artifact@v4 with: name: dist - path: dist/ + path: dist/ test: - name: Test Coverage + name: Test on Python ${{ matrix.python-version }} needs: build runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v3 - - name: Set up Python 3 - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install responses - pip install coverage + pip install coverage python ${{ github.workspace }}/setup.py install - name: Run Tests run: | python -m coverage run -m unittest python -m coverage xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - + if: matrix.python-version == '3.12' + uses: codecov/codecov-action@v4 + publish: if: startsWith(github.ref, 'refs/tags/v') needs: test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Download all workflow run artifacts uses: actions/download-artifact@v4 with: name: dist - path: dist + path: dist - name: Set up Python 3 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - name: Publish packages to PyPi run: | python -m pip install --upgrade twine set -ex - export VERSION=$(python3 setup.py --version) + export VERSION=$(python3 setup.py --version) python -m twine upload --verbose dist/razorpay-$VERSION-py3-none-any.whl dist/razorpay-$VERSION.tar.gz env: TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - diff --git a/setup.py b/setup.py index bc41608..3018894 100644 --- a/setup.py +++ b/setup.py @@ -12,24 +12,23 @@ url="https://github.com/razorpay/razorpay-python", author="Team Razorpay", license="MIT", - install_requires=["requests"], + python_requires='>=3.8', + install_requires=["requests>=2.28.0"], include_package_data=True, package_dir={'razorpay': 'razorpay', 'razorpay.resources': 'razorpay/resources'}, packages=['razorpay', 'razorpay.resources'], keywords='razorpay payment gateway india', classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", - - # List of supported Python versions - # Make sure that this is reflected in .github/workflows/python.yml as well "Programming Language :: Python", 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', "Topic :: Software Development :: Libraries :: Python Modules", ] ) From 6d5306f283605aed41d9d652ab76c663636e0e5b Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Tue, 12 May 2026 04:03:03 +0530 Subject: [PATCH 2/7] chore: remove deprecated pkg_resources, fix fallback version, delete duplicate workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove pkg_resources fallback (deprecated in Python 3.12+, not needed for Python 3.8+) - Use importlib.metadata directly (available since Python 3.8) - Fix hardcoded fallback version 1.4.3 → 2.0.1 - Delete duplicate python.yml workflow (ci.yml is the primary) Co-Authored-By: Claude Opus 4.7 --- .github/workflows/python.yml | 33 --------------------------------- razorpay/client.py | 32 +++++++++----------------------- 2 files changed, 9 insertions(+), 56 deletions(-) delete mode 100644 .github/workflows/python.yml diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml deleted file mode 100644 index e3ea46d..0000000 --- a/.github/workflows/python.yml +++ /dev/null @@ -1,33 +0,0 @@ -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Python Package - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - - -jobs: - deploy: - runs-on: ubuntu-latest # nosemgrep : semgrep.dev/s/swati31196:github_provided_runner - strategy: - max-parallel: 4 - matrix: - python-version: [3, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - - name: Install dependencies - run: | - pip install setuptools - python -m pip install --upgrade pip - pip install responses - python3 setup.py install - - name: Run Tests - run: python3 -m unittest diff --git a/razorpay/client.py b/razorpay/client.py index 6d80e52..5d4f2db 100644 --- a/razorpay/client.py +++ b/razorpay/client.py @@ -98,30 +98,16 @@ def _update_user_agent_header(self, options): def _get_version(self): version = "" - try: # nosemgrep : gitlab.bandit.B110 - # Try importlib.metadata first (modern approach) - try: - import importlib.metadata - from importlib.metadata import PackageNotFoundError - version = importlib.metadata.version("razorpay") - except ImportError: - # Fall back to pkg_resources - import pkg_resources - from pkg_resources import DistributionNotFound - version = pkg_resources.require("razorpay")[0].version - except (PackageNotFoundError, DistributionNotFound, NameError): # pragma: no cover - # PackageNotFoundError: importlib.metadata couldn't find the package - # DistributionNotFound: pkg_resources couldn't find the package - # NameError: in case the exception classes aren't defined due to import issues - - # If all else fails, use the hardcoded version from the package - version = "1.4.3" - + try: + import importlib.metadata + version = importlib.metadata.version("razorpay") + except importlib.metadata.PackageNotFoundError: # pragma: no cover + version = "2.0.1" warnings.warn( - "Could not detect razorpay package version. Using fallback version." - "This may indicate an installation issue.", - UserWarning, - stacklevel=4 + "Could not detect razorpay package version. Using fallback version. " + "This may indicate an installation issue.", + UserWarning, + stacklevel=4 ) return version From 1891105a0e0f5e2b193269cebf64a09fbd168a5e Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Tue, 12 May 2026 04:12:20 +0530 Subject: [PATCH 3/7] fix: use pip install instead of deprecated setup.py install - Replace `python setup.py install` with `pip install .` (modern approach) - Extract version from setup.py using grep instead of `setup.py --version` - setuptools is not pre-installed in Python 3.12+ GitHub runners Co-Authored-By: Claude Opus 4.7 --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36ed767..ab7e853 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,9 +47,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install responses - pip install coverage - python ${{ github.workspace }}/setup.py install + pip install responses coverage + pip install . - name: Run Tests run: | python -m coverage run -m unittest @@ -77,7 +76,7 @@ jobs: run: | python -m pip install --upgrade twine set -ex - export VERSION=$(python3 setup.py --version) + export VERSION=$(grep -m1 'version=' setup.py | cut -d'"' -f2) python -m twine upload --verbose dist/razorpay-$VERSION-py3-none-any.whl dist/razorpay-$VERSION.tar.gz env: TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} From c700f252a98161b071cd8b439163b150618d7f81 Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Tue, 12 May 2026 04:14:07 +0530 Subject: [PATCH 4/7] revert: keep Development Status as Beta Don't change release status in chore PR - that's a release decision. Co-Authored-By: Claude Opus 4.7 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3018894..3d1275f 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ packages=['razorpay', 'razorpay.resources'], keywords='razorpay payment gateway india', classifiers=[ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", From 136a067a1080bc609b21ab298e3636312ee635f0 Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Tue, 12 May 2026 04:25:49 +0530 Subject: [PATCH 5/7] fix: address PR review feedback - Raise minimum Python to 3.10 (3.8/3.9 are EOL) - Add Python 3.13 to test matrix and classifiers - Keep 3.9 in test matrix for broader compatibility testing - Use robust regex for version extraction (handles single/double quotes) Co-Authored-By: Claude Opus 4.7 --- .github/workflows/ci.yml | 6 +++--- setup.py | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab7e853..f8f488b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -54,7 +54,7 @@ jobs: python -m coverage run -m unittest python -m coverage xml - name: Upload coverage to Codecov - if: matrix.python-version == '3.12' + if: matrix.python-version == '3.13' uses: codecov/codecov-action@v4 publish: @@ -76,7 +76,7 @@ jobs: run: | python -m pip install --upgrade twine set -ex - export VERSION=$(grep -m1 'version=' setup.py | cut -d'"' -f2) + export VERSION=$(python3 -c "import re; print(re.search(r'version=[\"\\x27](.*?)[\"\\x27]', open('setup.py').read()).group(1))") python -m twine upload --verbose dist/razorpay-$VERSION-py3-none-any.whl dist/razorpay-$VERSION.tar.gz env: TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} diff --git a/setup.py b/setup.py index 3d1275f..a42cae6 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ url="https://github.com/razorpay/razorpay-python", author="Team Razorpay", license="MIT", - python_requires='>=3.8', + python_requires='>=3.10', install_requires=["requests>=2.28.0"], include_package_data=True, package_dir={'razorpay': 'razorpay', 'razorpay.resources': 'razorpay/resources'}, @@ -24,11 +24,10 @@ "License :: OSI Approved :: MIT License", "Programming Language :: Python", 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', "Topic :: Software Development :: Libraries :: Python Modules", ] ) From f00d15cf8644879291148b20ca138a63293a2caa Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Tue, 12 May 2026 04:28:04 +0530 Subject: [PATCH 6/7] fix: remove Python 3.9 from test matrix Cannot test on 3.9 when python_requires='>=3.10' Co-Authored-By: Claude Opus 4.7 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8f488b..06fa747 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} From 9916caffd86f8c3a226f9ffdef50c70fa2cc77b3 Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Wed, 13 May 2026 09:30:05 +0530 Subject: [PATCH 7/7] chore: set minimum Python to 3.11, add 3.14 support - Minimum: >=3.11 (EOL Oct 2027, gives 1.5 years runway) - Test matrix: 3.11, 3.12, 3.13, 3.14 Co-Authored-By: Claude Opus 4.7 --- .github/workflows/ci.yml | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06fa747..2d5dcd6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] + python-version: ['3.11', '3.12', '3.13', '3.14'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -54,7 +54,7 @@ jobs: python -m coverage run -m unittest python -m coverage xml - name: Upload coverage to Codecov - if: matrix.python-version == '3.13' + if: matrix.python-version == '3.14' uses: codecov/codecov-action@v4 publish: diff --git a/setup.py b/setup.py index a42cae6..df4c977 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ url="https://github.com/razorpay/razorpay-python", author="Team Razorpay", license="MIT", - python_requires='>=3.10', + python_requires='>=3.11', install_requires=["requests>=2.28.0"], include_package_data=True, package_dir={'razorpay': 'razorpay', 'razorpay.resources': 'razorpay/resources'}, @@ -24,10 +24,10 @@ "License :: OSI Approved :: MIT License", "Programming Language :: Python", 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: 3.14', "Topic :: Software Development :: Libraries :: Python Modules", ] )