From 5f372ba63a5b0651ccebf432376aa0a2651512a4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 17 Apr 2024 13:08:50 -0500 Subject: [PATCH] PYTHON-4373 Move dependency declaration to setup.py (#1602) --- pyproject.toml | 44 +------------------------------------------- setup.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 40c564689..a48baa09a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pymongo" -dynamic = ["version"] +dynamic = ["version", "dependencies", "optional-dependencies"] description = "Python driver for MongoDB " readme = "README.md" license = {file="LICENSE"} @@ -39,48 +39,6 @@ classifiers = [ "Topic :: Database", "Typing :: Typed", ] -dependencies = [ - "dnspython>=1.16.0,<3.0.0", -] - -[project.optional-dependencies] -aws = [ - "pymongo-auth-aws>=1.1.0,<2.0.0", -] -encryption = [ - "pymongo[aws]", - "pymongocrypt>=1.6.0,<2.0.0", - "certifi;os.name=='nt' or sys_platform=='darwin'", -] -gssapi = [ - "pykerberos;os.name!='nt'", - "winkerberos>=0.5.0;os.name=='nt'" -] -# PyOpenSSL 17.0.0 introduced support for OCSP. 17.1.0 introduced -# a related feature we need. 17.2.0 fixes a bug -# in set_default_verify_paths we should really avoid. -# service_identity 18.1.0 introduced support for IP addr matching. -# Fallback to certifi on Windows if we can't load CA certs from the system -# store and just use certifi on macOS. -# https://www.pyopenssl.org/en/stable/api/ssl.html#OpenSSL.SSL.Context.set_default_verify_paths -ocsp = [ - "certifi;os.name=='nt' or sys_platform=='darwin'", - "pyopenssl>=17.2.0", - "requests<3.0.0", - "cryptography>=2.5", - "service_identity>=18.1.0", -] -snappy = [ - "python-snappy" -] -# PYTHON-3423 Removed in 4.3 but kept here to avoid pip warnings. -srv = [] -tls = [] -# PYTHON-2133 Removed in 4.0 but kept here to avoid pip warnings. -zstd = [ - "zstandard", -] -test = ["pytest>=7"] [project.urls] Homepage = "https://www.mongodb.org" diff --git a/setup.py b/setup.py index a711e246b..b4f78fd72 100644 --- a/setup.py +++ b/setup.py @@ -136,4 +136,49 @@ by this python implementation.\n ) ext_modules = [] -setup(cmdclass={"build_ext": custom_build_ext}, ext_modules=ext_modules) # type:ignore + +dependencies = [ + "dnspython>=1.16.0,<3.0.0", +] + +extras_require = dict( + aws=[ + "pymongo-auth-aws>=1.1.0,<2.0.0", + ], + encryption=[ + "pymongo[aws]", + "pymongocrypt>=1.6.0,<2.0.0", + "certifi;os.name=='nt' or sys_platform=='darwin'", + ], + gssapi=["pykerberos;os.name!='nt'", "winkerberos>=0.5.0;os.name=='nt'"], + # PyOpenSSL 17.0.0 introduced support for OCSP. 17.1.0 introduced + # a related feature we need. 17.2.0 fixes a bug + # in set_default_verify_paths we should really avoid. + # service_identity 18.1.0 introduced support for IP addr matching. + # Fallback to certifi on Windows if we can't load CA certs from the system + # store and just use certifi on macOS. + # https://www.pyopenssl.org/en/stable/api/ssl.html#OpenSSL.SSL.Context.set_default_verify_paths + ocsp=[ + "certifi;os.name=='nt' or sys_platform=='darwin'", + "pyopenssl>=17.2.0", + "requests<3.0.0", + "cryptography>=2.5", + "service_identity>=18.1.0", + ], + snappy=["python-snappy"], + # PYTHON-3423 Removed in 4.3 but kept here to avoid pip warnings. + srv=[], + tls=[], + # PYTHON-2133 Removed in 4.0 but kept here to avoid pip warnings. + zstd=[ + "zstandard", + ], + test=["pytest>=7"], +) + +setup( + cmdclass={"build_ext": custom_build_ext}, + install_requires=dependencies, + extras_require=extras_require, + ext_modules=ext_modules, +) # type:ignore