Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOTOR-1299 Create separate requirements files #276

Merged
merged 4 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pymongo>=4.5,<5
1 change: 1 addition & 0 deletions requirements/aws.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pymongo[aws]>=4.5,<5
File renamed without changes.
1 change: 1 addition & 0 deletions requirements/encryption.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pymongo[encryption]>=4.5,<5
1 change: 1 addition & 0 deletions requirements/gssapi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pymongo[gssapi]>=4.5,<5
1 change: 1 addition & 0 deletions requirements/ocsp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pymongo[ocsp]>=4.5,<5
1 change: 1 addition & 0 deletions requirements/snappy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pymongo[snappy]>=4.5,<5
1 change: 1 addition & 0 deletions requirements/srv.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pymongo[srv]>=4.5,<5
5 changes: 5 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pytest>=7
mockupdb
tornado>=5
aiohttp!=3.8.6
motor[encryption]
1 change: 1 addition & 0 deletions requirements/zstd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pymongo[zstd]>=4.5,<5
20 changes: 19 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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