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

Move dependencies from setup.py to project.toml #291

Merged
merged 1 commit into from
Jul 10, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'",
]
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")
Comment on lines 17 to +21
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aisk Do you think this implementation makes sense now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tornado support will be deprecated, so I think this is ok for me.

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,
)
Loading