summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-08-11 20:22:59 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2021-08-11 20:22:59 +0000
commitabaedb12365f879e2fc4c1b9a7a8b8eeb97dc775 (patch)
tree4e037e69d67702feee89f27cce6701f034a3a958
parentd72c90a1c21d700baf20f6ce3baab5c1f97105cd (diff)
parent214c6d6fc4b90f8f62996dfdbdfa80216d9b0a2f (diff)
downloadsqlalchemy-abaedb12365f879e2fc4c1b9a7a8b8eeb97dc775.tar.gz
Merge "limit greenlet dependency to pypi-listed platforms"
-rw-r--r--doc/build/changelog/unreleased_14/6136.rst19
-rw-r--r--doc/build/intro.rst10
-rw-r--r--doc/build/orm/extensions/asyncio.rst22
-rw-r--r--lib/sqlalchemy/testing/requirements.py12
-rw-r--r--setup.cfg2
-rw-r--r--test/base/test_concurrency_py3k.py4
-rw-r--r--tox.ini2
7 files changed, 64 insertions, 7 deletions
diff --git a/doc/build/changelog/unreleased_14/6136.rst b/doc/build/changelog/unreleased_14/6136.rst
new file mode 100644
index 000000000..de3b2feb1
--- /dev/null
+++ b/doc/build/changelog/unreleased_14/6136.rst
@@ -0,0 +1,19 @@
+.. change::
+ :tags: bug, general
+ :tickets: 6136
+
+ The setup requirements have been modified such ``greenlet`` is a default
+ requirement only for those platforms that are well known for ``greenlet``
+ to be installable and for which there is already a pre-built binary on
+ pypi; the current list is ``x86_64 aarch64 ppc64le amd64 win32``. For other
+ platforms, greenlet will not install by default, which should enable
+ installation and test suite running of SQLAlchemy 1.4 on platforms that
+ don't support ``greenlet``, excluding any asyncio features. In order to
+ install with the ``greenlet`` dependency included on a machine architecture
+ outside of the above list, the ``[asyncio]`` extra may be included by
+ running ``pip install sqlalchemy[asyncio]`` which will then attempt to
+ install ``greenlet``.
+
+ Additionally, the test suite has been repaired so that tests can complete
+ fully when greenlet is not installed, with appropriate skips for
+ asyncio-related tests. \ No newline at end of file
diff --git a/doc/build/intro.rst b/doc/build/intro.rst
index 8b2135b7d..01e33df03 100644
--- a/doc/build/intro.rst
+++ b/doc/build/intro.rst
@@ -109,6 +109,16 @@ SQLAlchemy has been tested against the following platforms:
:ref:`change_5634`
+AsyncIO Support
+----------------
+
+SQLAlchemy's ``asyncio`` support depends upon the
+`greenlet <https://pypi.org/project/greenlet/>`_ project. This dependency
+will be installed by default on common machine platforms, however is not
+supported on every architecture and also may not install by default on
+less common architectures. See the section :ref:`asyncio_install` for
+additional details on ensuring asyncio support is present.
+
Supported Installation Methods
-------------------------------
diff --git a/doc/build/orm/extensions/asyncio.rst b/doc/build/orm/extensions/asyncio.rst
index 4509ee350..c5fc356d1 100644
--- a/doc/build/orm/extensions/asyncio.rst
+++ b/doc/build/orm/extensions/asyncio.rst
@@ -8,14 +8,11 @@ included, using asyncio-compatible dialects.
.. versionadded:: 1.4
-The asyncio extension requires at least Python version 3.6.
-
.. note:: The asyncio extension as of SQLAlchemy 1.4.3 can now be considered to
be **beta level** software. API details are subject to change however at this
point it is unlikely for there to be significant backwards-incompatible
changes.
-
.. seealso::
:ref:`change_3414` - initial feature announcement
@@ -23,6 +20,25 @@ The asyncio extension requires at least Python version 3.6.
:ref:`examples_asyncio` - example scripts illustrating working examples
of Core and ORM use within the asyncio extension.
+.. _asyncio_install:
+
+Asyncio Platform Installation Notes
+------------------------------------
+
+The asyncio extension requires at least Python version 3.6. It also depends
+upon the `greenlet <https://pypi.org/project/greenlet/>`_ library. This
+dependency is installed by default on common machine platforms including::
+
+ x86_64 aarch64 ppc64le amd64 win32
+
+For the above platforms, ``greenlet`` is known to supply pre-built wheel files.
+To ensure the ``greenlet`` dependency is present on other platforms, the
+``[asyncio]`` extra may be installed as follows, which will include an attempt
+to build and install ``greenlet``::
+
+ pip install sqlalchemy[asyncio]
+
+
Synopsis - Core
---------------
diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py
index b1582efe4..f660556eb 100644
--- a/lib/sqlalchemy/testing/requirements.py
+++ b/lib/sqlalchemy/testing/requirements.py
@@ -1326,6 +1326,18 @@ class SuiteRequirements(Requirements):
return exclusions.closed()
@property
+ def greenlet(self):
+ def go(config):
+ try:
+ import greenlet # noqa F401
+ except ImportError:
+ return False
+ else:
+ return True
+
+ return exclusions.only_if(go)
+
+ @property
def computed_columns(self):
"Supports computed columns"
return exclusions.closed()
diff --git a/setup.cfg b/setup.cfg
index 4b238fcad..05feeae6a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -40,7 +40,7 @@ package_dir =
install_requires =
importlib-metadata;python_version<"3.8"
- greenlet != 0.4.17;python_version>="3"
+ greenlet != 0.4.17;python_version>="3" and platform_machine in 'x86_64 aarch64 ppc64le amd64 win32'
[options.extras_require]
asyncio =
diff --git a/test/base/test_concurrency_py3k.py b/test/base/test_concurrency_py3k.py
index 45a0eb90e..0b648aa30 100644
--- a/test/base/test_concurrency_py3k.py
+++ b/test/base/test_concurrency_py3k.py
@@ -33,6 +33,8 @@ def go(*fns):
class TestAsyncioCompat(fixtures.TestBase):
+ __requires__ = ("greenlet",)
+
@async_test
async def test_ok(self):
@@ -186,7 +188,7 @@ class TestAsyncioCompat(fixtures.TestBase):
class TestAsyncAdaptedQueue(fixtures.TestBase):
# uses asyncio.run() in alternate threads which is not available
# in Python 3.6
- __requires__ = ("python37",)
+ __requires__ = ("python37", "greenlet")
def test_lazy_init(self):
run = [False]
diff --git a/tox.ini b/tox.ini
index 6c77ab95c..5df14fe67 100644
--- a/tox.ini
+++ b/tox.ini
@@ -19,9 +19,7 @@ deps=
pytest>=4.6.11,<5.0; python_version < '3'
pytest>=6.2; python_version >= '3'
pytest-xdist
- greenlet != 0.4.17
mock; python_version < '3.3'
- importlib_metadata; python_version < '3.8'
sqlite: .[aiosqlite]
sqlite_file: .[aiosqlite]