PYTHON-4373 Use requirements files for deps (#1605)

This commit is contained in:
Steven Silvester 2024-04-17 17:58:35 -05:00 committed by GitHub
parent aa8322e1ce
commit a421c662e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 40 additions and 34 deletions

View File

@ -16,7 +16,7 @@ python:
# Install pymongo itself.
- method: pip
path: .
- requirements: doc/docs-requirements.txt
- requirements: requirements/docs.txt
build:
os: ubuntu-22.04

View File

@ -2,6 +2,7 @@ include README.md
include LICENSE
include THIRD-PARTY-NOTICES
include *.ini
include requirements.txt
exclude .coveragerc
exclude .git-blame-ignore-revs
exclude .pre-commit-config.yaml
@ -16,9 +17,9 @@ recursive-include doc *.js
recursive-include doc *.png
include doc/Makefile
include doc/_templates/layout.html
include doc/docs-requirements.txt
include doc/make.bat
include doc/static/periodic-executor-refs.dot
recursive-include requirements *.txt
recursive-include tools *.py
include tools/README.rst
include green_framework_test.py

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
dnspython>=1.16.0,<3.0.0

1
requirements/aws.txt Normal file
View File

@ -0,0 +1 @@
pymongo-auth-aws>=1.1.0,<2.0.0

View File

@ -0,0 +1,3 @@
pymongo-auth-aws>=1.1.0,<2.0.0
pymongocrypt>=1.6.0,<2.0.0
certifi;os.name=='nt' or sys_platform=='darwin'

2
requirements/gssapi.txt Normal file
View File

@ -0,0 +1,2 @@
pykerberos;os.name!='nt'
winkerberos>=0.5.0;os.name=='nt'

12
requirements/ocsp.txt Normal file
View File

@ -0,0 +1,12 @@
# 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
certifi;os.name=='nt' or sys_platform=='darwin'
pyopenssl>=17.2.0
requests<3.0.0
cryptography>=2.5
service_identity>=18.1.0

1
requirements/snappy.txt Normal file
View File

@ -0,0 +1 @@
python-snappy

1
requirements/test.txt Normal file
View File

@ -0,0 +1 @@
pytest>=7

1
requirements/zstd.txt Normal file
View File

@ -0,0 +1 @@
zstandard

View File

@ -137,43 +137,26 @@ by this python implementation.\n
ext_modules = []
dependencies = [
"dnspython>=1.16.0,<3.0.0",
]
def parse_reqs_file(fname):
with open(fname) as fid:
lines = [li.strip() for li in fid.readlines()]
return [li for li in lines if li and not li.startswith("#")]
dependencies = parse_reqs_file("requirements.txt")
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"],
aws=parse_reqs_file("requirements/aws.txt"),
encryption=parse_reqs_file("requirements/encryption.txt"),
gssapi=parse_reqs_file("requirements/gssapi.txt"),
ocsp=parse_reqs_file("requirements/ocsp.txt"),
snappy=parse_reqs_file("requirements/snappy.txt"),
# 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"],
zstd=parse_reqs_file("requirements/zstd.txt"),
test=parse_reqs_file("requirements/test.txt"),
)
setup(

View File

@ -144,7 +144,7 @@ commands =
[testenv:doc]
description = build sphinx docs
deps =
-rdoc/docs-requirements.txt
-rrequirements/docs.txt
commands =
sphinx-build -W -b html doc ./doc/_build/html