Skip to content

Commit 8e226b1

Browse files
authored
move dependencies from setup.py to project.toml (#291)
1 parent 9d89758 commit 8e226b1

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

pyproject.toml

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools", "cython>=0.28.4,<4"]
2+
requires = ["setuptools", "cython>=0.28.4,<4", "toml"]
33

44
[project]
55
name = "thriftpy2"
@@ -9,7 +9,6 @@ authors = [
99
{name = "ThriftPy Organization", email = "[email protected]"},
1010
]
1111
dependencies = [
12-
"Cython>=3.0.10",
1312
"ply>=3.4,<4.0",
1413
"six~=1.15",
1514
]
@@ -37,3 +36,19 @@ classifiers = [
3736
[project.urls]
3837
Homepage = "https://thriftpy2.readthedocs.io/"
3938
Source = "https://github.com/Thriftpy/thriftpy2"
39+
40+
[project.optional-dependencies]
41+
dev = [
42+
"flake8>=2.5",
43+
"sphinx-rtd-theme>=0.1.9",
44+
"sphinx>=1.3",
45+
"pytest-reraise",
46+
"pytest>=6.1.1,<8.2.0",
47+
"tornado>=4.0,<7.0; python_version>='3.12'",
48+
"tornado>=4.0,<6.0; python_version<'3.12'",
49+
]
50+
51+
tornado = [
52+
"tornado>=4.0,<7.0; python_version>='3.12'",
53+
"tornado>=4.0,<6.0; python_version<'3.12'",
54+
]

setup.py

+7-19
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,26 @@
33

44
import sys
55
import platform
6+
import toml
67

8+
from os.path import join, dirname
79
from setuptools import setup, find_packages, Extension
810

911

10-
install_requires = [
11-
"ply>=3.4,<4.0",
12-
"six~=1.15",
13-
]
14-
15-
tornado_requires = [
16-
"tornado>=4.0,<7.0; python_version>='3.12'",
17-
"tornado>=4.0,<6.0; python_version<'3.12'",
18-
]
12+
meta = toml.load(join(dirname(__file__), 'pyproject.toml') )
13+
install_requires = meta["project"]["dependencies"]
14+
dev_requires = meta["project"]["optional-dependencies"]["dev"]
15+
tornado_requires = meta["project"]["optional-dependencies"]["tornado"]
1916

2017
try:
2118
from tornado import version as tornado_version
2219
if tornado_version < '5.0':
2320
tornado_requires.append("toro>=0.6")
21+
dev_requires.append("toro>=0.6")
2422
except ImportError:
2523
# tornado will now only get installed and we'll get the newer one
2624
pass
2725

28-
dev_requires = [
29-
"flake8>=2.5",
30-
"sphinx-rtd-theme>=0.1.9",
31-
"sphinx>=1.3",
32-
"pytest-reraise",
33-
"pytest>=6.1.1,<8.2.0",
34-
] + tornado_requires
35-
36-
cmdclass = {}
3726
ext_modules = []
3827

3928
# pypy detection
@@ -76,7 +65,6 @@
7665
"dev": dev_requires,
7766
"tornado": tornado_requires
7867
},
79-
cmdclass=cmdclass,
8068
ext_modules=ext_modules,
8169
include_package_data=True,
8270
)

0 commit comments

Comments
 (0)