Skip to content

Commit

Permalink
move dependencies from setup.py to project.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
cocolato committed Jul 8, 2024
1 parent 9d89758 commit 1b83daa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 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 = "[email protected]"},
]
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'",
]
25 changes: 7 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@

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
Expand All @@ -25,15 +22,8 @@
# 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
dev_requires += tornado_requires

cmdclass = {}
ext_modules = []

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

0 comments on commit 1b83daa

Please sign in to comment.