MOTOR-1299 Create separate requirements files (#276)

This commit is contained in:
Steven Silvester 2024-04-18 19:45:31 -05:00 committed by GitHub
parent 5cf54914f5
commit e93b9693d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 39 additions and 35 deletions

View File

@ -15,7 +15,7 @@ python:
# Install motor 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 tox.ini
include pyproject.toml
include requirements.txt
include doc/Makefile
include doc/examples/tornado_change_stream_templates/index.html
recursive-include doc *.rst
@ -18,6 +19,7 @@ recursive-include synchro *.py
recursive-include motor *.pyi
recursive-include motor *.typed
recursive-include motor *.py
recursive-include requirements *.txt
exclude .readthedocs.yaml
exclude .git-blame-ignore-revs

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "motor"
dynamic = ["version"]
dynamic = ["version", "dependencies", "optional-dependencies"]
description = "Non-blocking MongoDB driver for Tornado or asyncio"
readme = "README.md"
license = { file = "LICENSE" }
@ -42,35 +42,6 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"pymongo>=4.5,<5",
]
[project.optional-dependencies]
aws = [
"pymongo[aws]>=4.5,<5",
]
encryption = [
"pymongo[encryption]>=4.5,<5",
]
gssapi = [
"pymongo[gssapi]>=4.5,<5",
]
ocsp = [
"pymongo[ocsp]>=4.5,<5",
]
snappy = [
"pymongo[snappy]>=4.5,<5",
]
srv = [
"pymongo[srv]>=4.5,<5",
]
test = [
"pytest>=7", "mockupdb", "tornado>=5", "aiohttp!=3.8.6", "motor[encryption]"
]
zstd = [
"pymongo[zstd]>=4.5,<5",
]
[project.urls]
Homepage = "https://www.mongodb.org"

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
pymongo>=4.5,<5

1
requirements/aws.txt Normal file
View File

@ -0,0 +1 @@
pymongo[aws]>=4.5,<5

View File

@ -0,0 +1 @@
pymongo[encryption]>=4.5,<5

1
requirements/gssapi.txt Normal file
View File

@ -0,0 +1 @@
pymongo[gssapi]>=4.5,<5

1
requirements/ocsp.txt Normal file
View File

@ -0,0 +1 @@
pymongo[ocsp]>=4.5,<5

1
requirements/snappy.txt Normal file
View File

@ -0,0 +1 @@
pymongo[snappy]>=4.5,<5

1
requirements/srv.txt Normal file
View File

@ -0,0 +1 @@
pymongo[srv]>=4.5,<5

5
requirements/test.txt Normal file
View File

@ -0,0 +1,5 @@
pytest>=7
mockupdb
tornado>=5
aiohttp!=3.8.6
motor[encryption]

1
requirements/zstd.txt Normal file
View File

@ -0,0 +1 @@
pymongo[zstd]>=4.5,<5

View File

@ -1,3 +1,21 @@
from setuptools import setup
setup()
def parse_reqs_file(fname):
with open(fname) as fid: # noqa:PTH123
lines = [li.strip() for li in fid.readlines()]
return [li for li in lines if li and not li.startswith("#")]
extras_require = dict( # noqa:C408
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"),
srv=parse_reqs_file("requirements/srv.txt"),
test=parse_reqs_file("requirements/test.txt"),
zstd=parse_reqs_file("requirements/zstd.txt"),
)
setup(install_requires=parse_reqs_file("requirements.txt"), extras_require=extras_require)

View File

@ -76,7 +76,7 @@ extras =
[testenv:docs]
setenv = PYTHONWARNINGS=
deps =
-rdoc/docs-requirements.txt
-rrequirements/docs.txt
changedir = doc
commands =
python -m sphinx -q -E -W -b html . {envtmpdir}/html {posargs}
@ -84,7 +84,7 @@ commands =
[testenv:doctest]
setenv = PYTHONHASHSEED=0
deps =
-rdoc/docs-requirements.txt
-rrequirements/docs.txt
changedir = doc
commands =
python -m sphinx -q -E -b doctest . {envtmpdir}/doctest {posargs}
@ -92,7 +92,7 @@ commands =
[testenv:linkcheck]
setenv = PYTHONHASHSEED=0
deps =
-rdoc/docs-requirements.txt
-rrequirements/docs.txt
changedir = doc
commands =
python -m sphinx -q -E -b linkcheck . {envtmpdir}/linkcheck {posargs}