From 4a069aa73d88c236a2752d7645933bc783196d13 Mon Sep 17 00:00:00 2001 From: Israel Fruchter Date: Thu, 23 Jan 2025 23:31:27 +0200 Subject: [PATCH] modernize package setup move to pyproject.toml that supports PEP517/518 this would help us use isolated build env, and avoid all the fragile situation we have with Cython installation dependcy missing in some CI variation --- pyproject.toml | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 59 +----------------------------------- 2 files changed, 82 insertions(+), 58 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..6647b6b65 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,81 @@ +[project] +name = "scylla-driver" +description = "Scylla Driver for Apache Cassandra" +authors = [ + {name = "ScyllaDB"}, +] +keywords = ["cassandra", "cql", "orm", "dse", "graph"] +classifiers = [ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Software Development :: Libraries :: Python Modules' +] +dependencies = [ + 'geomet>=0.1,<0.3', + 'pyyaml > 5.0' +] +dynamic = ["version", "readme"] + +[project.urls] +"Homepage" = "https://github.com/scylladb/python-driver" +"Documentation" = "https://scylladb.github.io/python-driver/" +"Source" = "https://github.com/scylladb/python-driver/" +"Issues" = "https://github.com/scylladb/python-driver/issues" + +[project.optional-dependencies] +graph = ['gremlinpython==3.4.6'] +cle = ['cryptography>=35.0'] +test = [ + "pytest", + "mock>=2.0.0", + "PyYAML", + "pytz", + "sure", + "scales", + "pure-sasl", + "twisted[tls]; python_version >= '3.5'", + "twisted[tls]==19.2.1; python_version < '3.5'", + "gevent>=1.0; python_version < '3.13' and platform_machine != 'i686' and platform_machine != 'win32'", + "gevent==23.9.0; python_version < '3.13' and (platform_machine == 'i686' or platform_machine == 'win32')", + "eventlet>=0.33.3; python_version < '3.13'", + "cython", + "packaging", + "futurist; python_version >= '3.7'", + "asynctest; python_version >= '3.5'", + "pyyaml", +] + +[tool.setuptools] +include-package-data = true +packages=[ + 'cassandra', 'cassandra.io', 'cassandra.cqlengine', 'cassandra.graph', + 'cassandra.datastax', 'cassandra.datastax.insights', 'cassandra.datastax.graph', + 'cassandra.datastax.graph.fluent', 'cassandra.datastax.cloud', 'cassandra.scylla', + 'cassandra.column_encryption' +] + +[tool.setuptools.dynamic] +version = {attr = "cassandra.__version__"} # any module attribute compatible with ast.literal_eval +readme = {file = "README.rst", content-type = "text/x-rst"} + +[build-system] +requires = [ + "setuptools>=42", + "Cython", +] + +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/setup.py b/setup.py index 62c18b501..5b5852b98 100644 --- a/setup.py +++ b/setup.py @@ -42,13 +42,6 @@ except ImportError: has_subprocess = False -from cassandra import __version__ - -long_description = "" -with open("README.rst") as f: - long_description = f.read() - - try: from nose.commands import nosetests except ImportError: @@ -92,6 +85,7 @@ def run(self): path = "docs/_build/doctest" mode = "doctest" else: + from cassandra import __version__ path = "docs/_build/%s" % __version__ mode = "html" @@ -425,59 +419,8 @@ def run_setup(extensions): else: sys.stderr.write("Bypassing Cython setup requirement\n") - dependencies = [ - 'geomet>=0.1,<0.3', - 'pyyaml > 5.0' - ] - - _EXTRAS_REQUIRE = { - 'graph': ['gremlinpython==3.4.6'], - 'cle': ['cryptography>=35.0'] - } - setup( - name='scylla-driver', - version=__version__, - description='Scylla Driver for Apache Cassandra', - long_description=long_description, - long_description_content_type='text/x-rst', - url='https://github.com/scylladb/python-driver', - project_urls={ - 'Documentation': 'https://scylladb.github.io/python-driver/', - 'Source': 'https://github.com/scylladb/python-driver/', - 'Issues': 'https://github.com/scylladb/python-driver/issues', - }, - author='ScyllaDB', - packages=[ - 'cassandra', 'cassandra.io', 'cassandra.cqlengine', 'cassandra.graph', - 'cassandra.datastax', 'cassandra.datastax.insights', 'cassandra.datastax.graph', - 'cassandra.datastax.graph.fluent', 'cassandra.datastax.cloud', 'cassandra.scylla', - 'cassandra.column_encryption' - ], - keywords='cassandra,cql,orm,dse,graph', - include_package_data=True, - install_requires=dependencies, - extras_require=_EXTRAS_REQUIRE, tests_require=['nose', 'mock>=2.0.0', 'PyYAML', 'pytz', 'sure'], - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Programming Language :: Python :: 3.13', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Software Development :: Libraries :: Python Modules' - ], **kw)