Skip to content

Commit

Permalink
move dependencies from setup.py to project.toml (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
cocolato authored Jul 10, 2024
1 parent 9d89758 commit 8e226b1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
19 changes: 17 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "cython>=0.28.4,<4"]
requires = ["setuptools", "cython>=0.28.4,<4", "toml"]

[project]
name = "thriftpy2"
Expand All @@ -9,7 +9,6 @@ authors = [
{name = "ThriftPy Organization", email = "gotzehsing@gmail.com"},
]
dependencies = [
"Cython>=3.0.10",
"ply>=3.4,<4.0",
"six~=1.15",
]
Expand Down Expand Up @@ -37,3 +36,19 @@ classifiers = [
[project.urls]
Homepage = "https://thriftpy2.readthedocs.io/"
Source = "https://github.com/Thriftpy/thriftpy2"

[project.optional-dependencies]
dev = [
"flake8>=2.5",
"sphinx-rtd-theme>=0.1.9",
"sphinx>=1.3",
"pytest-reraise",
"pytest>=6.1.1,<8.2.0",
"tornado>=4.0,<7.0; python_version>='3.12'",
"tornado>=4.0,<6.0; python_version<'3.12'",
]

tornado = [
"tornado>=4.0,<7.0; python_version>='3.12'",
"tornado>=4.0,<6.0; python_version<'3.12'",
]
26 changes: 7 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,26 @@

import sys
import platform
import toml

from os.path import join, dirname
from setuptools import setup, find_packages, Extension


install_requires = [
"ply>=3.4,<4.0",
"six~=1.15",
]

tornado_requires = [
"tornado>=4.0,<7.0; python_version>='3.12'",
"tornado>=4.0,<6.0; python_version<'3.12'",
]
meta = toml.load(join(dirname(__file__), 'pyproject.toml') )
install_requires = meta["project"]["dependencies"]
dev_requires = meta["project"]["optional-dependencies"]["dev"]
tornado_requires = meta["project"]["optional-dependencies"]["tornado"]

try:
from tornado import version as tornado_version
if tornado_version < '5.0':
tornado_requires.append("toro>=0.6")
dev_requires.append("toro>=0.6")
except ImportError:
# tornado will now only get installed and we'll get the newer one
pass

dev_requires = [
"flake8>=2.5",
"sphinx-rtd-theme>=0.1.9",
"sphinx>=1.3",
"pytest-reraise",
"pytest>=6.1.1,<8.2.0",
] + tornado_requires

cmdclass = {}
ext_modules = []

# pypy detection
Expand Down Expand Up @@ -76,7 +65,6 @@
"dev": dev_requires,
"tornado": tornado_requires
},
cmdclass=cmdclass,
ext_modules=ext_modules,
include_package_data=True,
)

0 comments on commit 8e226b1

Please sign in to comment.