From 6af9a3d352b653f9f3da0004e863ebccc662c8e4 Mon Sep 17 00:00:00 2001 From: Evgeny Chernyavskiy Date: Wed, 26 Nov 2025 16:04:32 +0700 Subject: [PATCH] Replace deprecated `pkgutil` with `importlib`. Add Python 3.14 to the test matrix. --- .github/workflows/main.yml | 2 +- setup.py | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7bac4a1..06c9ccd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v4 diff --git a/setup.py b/setup.py index 74d5002..0921062 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ # Copyright (c) 2015, Ayun Park. All rights reserved. # For licensing, see LICENSE file included in the package. import sys -import pkgutil +import importlib.util from setuptools import setup from setuptools.command.install import install @@ -13,9 +13,7 @@ class NewInstall(install): @staticmethod def check_pymongo(): - if pkgutil.find_loader('pymongo'): - return True - return False + return importlib.util.find_spec('pymongo') def run(self): install.run(self) @@ -37,12 +35,12 @@ def run(self): keywords="BSON codec", url="http://github.com/py-bson/bson", classifiers=[ - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', + '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', + 'Programming Language :: Python :: 3.14', ], cmdclass={'install': NewInstall} )