Skip to content

Commit 5b990d6

Browse files
committed
refactor extras in setup file
1 parent 44ae202 commit 5b990d6

File tree

1 file changed

+45
-41
lines changed

1 file changed

+45
-41
lines changed

setup.py

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -28,60 +28,64 @@
2828
)
2929

3030

31+
base_cryptography_require = ["cryptography>=38.0.3"]
32+
33+
python38_cryptography_require = ["cryptography < 39.0.0; python_version <= '3.8'"]
34+
3135
requests_extra_require = ["requests >= 2.20.0, < 3.0.0.dev0"]
32-
aiohttp_extra_require = [
33-
"aiohttp >= 3.6.2, < 4.0.0.dev0",
34-
] + requests_extra_require
36+
37+
aiohttp_extra_require = ["aiohttp >= 3.6.2, < 4.0.0.dev0", *requests_extra_require]
3538

3639
pyjwt_extra_require = [
3740
"pyjwt>=2.0",
38-
"cryptography>=38.0.3",
39-
"cryptography < 39.0.0; python_version == '3.7'",
41+
*base_cryptography_require,
42+
*python38_cryptography_require,
4043
]
4144

4245
reauth_extra_require = ["pyu2f>=0.1.5"]
4346

47+
enterprise_cert_extra_require = [
48+
"cryptography",
49+
"pyopenssl",
50+
*python38_cryptography_require,
51+
]
52+
53+
pyopenssl_extra_require = [
54+
"pyopenssl>=20.0.0",
55+
*base_cryptography_require,
56+
*python38_cryptography_require,
57+
]
58+
4459
# Unit test requirements.
45-
testing_extra_require = (
46-
[
47-
"flask",
48-
"freezegun",
49-
"mock",
50-
"pyopenssl",
51-
"pytest",
52-
"pytest-cov",
53-
"pytest-localserver",
54-
"pyu2f",
55-
"responses",
56-
# TODO(): Remove `grpcio` from testing requirements once an extra is added for `grpcio` dependency.
57-
"grpcio",
58-
# TODO(): Remove `oauth2client` from testing requirements once an extra is added for `grpcio` dependency.
59-
"oauth2client",
60-
# Async Dependencies
61-
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1722): `test_aiohttp_requests` depend on
62-
# aiohttp < 3.10.0 which is a bug. Investigate and remove the pinned aiohttp version and use `aiohttp_extra_require`.
63-
"aiohttp < 3.10.0",
64-
"pytest-asyncio",
65-
"aioresponses",
66-
]
67-
+ pyjwt_extra_require
68-
+ reauth_extra_require
69-
)
60+
testing_extra_require = [
61+
"flask",
62+
"freezegun",
63+
"mock",
64+
"pytest",
65+
"pytest-cov",
66+
"pytest-localserver",
67+
"responses",
68+
"pytest-asyncio",
69+
"aioresponses",
70+
# TODO(): Remove `grpcio` from testing requirements once an extra is added for `grpcio` dependency.
71+
"grpcio",
72+
# TODO(): Remove `oauth2client` from testing requirements once an extra is added for `grpcio` dependency.
73+
"oauth2client",
74+
# Async Dependencies
75+
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1722): `test_aiohttp_requests` depend on
76+
# aiohttp < 3.10.0 which is a bug. Investigate and remove the pinned aiohttp version and use `aiohttp_extra_require`.
77+
"aiohttp < 3.10.0",
78+
*pyjwt_extra_require,
79+
*reauth_extra_require,
80+
*pyopenssl_extra_require,
81+
]
7082

7183
extras = {
7284
"aiohttp": aiohttp_extra_require,
73-
"pyopenssl": [
74-
"pyopenssl>=20.0.0",
75-
"cryptography>=38.0.3",
76-
"cryptography < 39.0.0; python_version == '3.7'",
77-
],
85+
"pyopenssl": pyopenssl_extra_require,
7886
"requests": requests_extra_require,
79-
"reauth": "pyu2f>=0.1.5",
80-
"enterprise_cert": [
81-
"cryptography",
82-
"pyopenssl",
83-
"cryptography < 39.0.0; python_version == '3.7'",
84-
],
87+
"reauth": reauth_extra_require,
88+
"enterprise_cert": enterprise_cert_extra_require,
8589
"pyjwt": pyjwt_extra_require,
8690
"testing": testing_extra_require,
8791
# TODO(): Add an extra for `grpcio` dependency.

0 commit comments

Comments
 (0)