Skip to content

Commit

Permalink
MOTOR-1299 Create separate requirements files (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Apr 19, 2024
1 parent 5cf5491 commit e93b969
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Expand Up @@ -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
Expand All @@ -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
Expand Down
31 changes: 1 addition & 30 deletions pyproject.toml
Expand Up @@ -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" }
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
@@ -0,0 +1 @@
pymongo>=4.5,<5
1 change: 1 addition & 0 deletions requirements/aws.txt
@@ -0,0 +1 @@
pymongo[aws]>=4.5,<5
File renamed without changes.
1 change: 1 addition & 0 deletions requirements/encryption.txt
@@ -0,0 +1 @@
pymongo[encryption]>=4.5,<5
1 change: 1 addition & 0 deletions requirements/gssapi.txt
@@ -0,0 +1 @@
pymongo[gssapi]>=4.5,<5
1 change: 1 addition & 0 deletions requirements/ocsp.txt
@@ -0,0 +1 @@
pymongo[ocsp]>=4.5,<5
1 change: 1 addition & 0 deletions requirements/snappy.txt
@@ -0,0 +1 @@
pymongo[snappy]>=4.5,<5
1 change: 1 addition & 0 deletions requirements/srv.txt
@@ -0,0 +1 @@
pymongo[srv]>=4.5,<5
5 changes: 5 additions & 0 deletions requirements/test.txt
@@ -0,0 +1,5 @@
pytest>=7
mockupdb
tornado>=5
aiohttp!=3.8.6
motor[encryption]
1 change: 1 addition & 0 deletions requirements/zstd.txt
@@ -0,0 +1 @@
pymongo[zstd]>=4.5,<5
20 changes: 19 additions & 1 deletion setup.py
@@ -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)
6 changes: 3 additions & 3 deletions tox.ini
Expand Up @@ -76,23 +76,23 @@ 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}

[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}

[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}
Expand Down

0 comments on commit e93b969

Please sign in to comment.