diff options
-rw-r--r-- | doc/build/changelog/migration_11.rst | 36 | ||||
-rw-r--r-- | doc/build/intro.rst | 49 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/distutils_run.py | 11 | ||||
-rw-r--r-- | setup.py | 122 |
4 files changed, 109 insertions, 109 deletions
diff --git a/doc/build/changelog/migration_11.rst b/doc/build/changelog/migration_11.rst index 2775b3d88..9c046ab9e 100644 --- a/doc/build/changelog/migration_11.rst +++ b/doc/build/changelog/migration_11.rst @@ -28,8 +28,40 @@ their applications from the 1.0 series of SQLAlchemy to 1.1. Please carefully review the sections on behavioral changes for potentially backwards-incompatible changes in behavior. -Platform Changes -================ +Platform / Installer Changes +============================ + +Setuptools is now required for install +-------------------------------------- + +SQLAlchemy's ``setup.py`` file has for many years supported operation +both with Setuptools installed and without; supporting a "fallback" mode +that uses straight Distutils. As a Setuptools-less Python environment is +now unheard of, and in order to support the featureset of Setuptools +more fully, in particular to support py.test's integration with it, +``setup.py`` now depends on Setuptools fully. + +.. seealso:: + + :ref:`installation` + +:ticket:`3489` + +Enabling / Disabling C Extension builds is only via environment variable +------------------------------------------------------------------------ + +The C Extensions build by default during install as long as it is possible. +To disable C extension builds, the ``DISABLE_SQLALCHEMY_CEXT`` environment +variable was made available as of SQLAlchemy 0.8.6 / 0.9.4. The previous +approach of using the ``--without-cextensions`` argument has been removed, +as it relies on deprecated features of setuptools. + +.. seealso:: + + :ref:`c_extensions` + +:ticket:`3500` + New Features and Improvements - ORM =================================== diff --git a/doc/build/intro.rst b/doc/build/intro.rst index ed4838bce..ca5662f03 100644 --- a/doc/build/intro.rst +++ b/doc/build/intro.rst @@ -84,18 +84,14 @@ releases as well, depending on the state of Jython itself. Supported Installation Methods ------------------------------- -SQLAlchemy supports installation using standard Python "distutils" or -"setuptools" methodologies. An overview of potential setups is as follows: - -* **Plain Python Distutils** - SQLAlchemy can be installed with a clean - Python install using the services provided via `Python Distutils <http://docs.python.org/distutils/>`_, - using the ``setup.py`` script. The C extensions as well as Python 3 builds are supported. -* **Setuptools or Distribute** - When using `setuptools <http://pypi.python.org/pypi/setuptools/>`_, - SQLAlchemy can be installed via ``setup.py`` or ``easy_install``, and the C - extensions are supported. -* **pip** - `pip <http://pypi.python.org/pypi/pip/>`_ is an installer that - rides on top of ``setuptools`` or ``distribute``, replacing the usage - of ``easy_install``. It is often preferred for its simpler mode of usage. +SQLAlchemy installation is via standard Python methodologies that are +based on `setuptools <http://pypi.python.org/pypi/setuptools/>`_, either +by referring to ``setup.py`` directly or by using +`pip <http://pypi.python.org/pypi/pip/>`_ or other setuptools-compatible +approaches. + +.. versionchanged:: 1.1 setuptools is now required by the setup.py file; + plain distutils installs are no longer supported. Install via pip --------------- @@ -124,6 +120,8 @@ Otherwise, you can install from the distribution using the ``setup.py`` script:: python setup.py install +.. _c_extensions: + Installing the C Extensions ---------------------------------- @@ -131,10 +129,6 @@ SQLAlchemy includes C extensions which provide an extra speed boost for dealing with result sets. The extensions are supported on both the 2.xx and 3.xx series of cPython. -.. versionchanged:: 0.9.0 - - The C extensions now compile on Python 3 as well as Python 2. - ``setup.py`` will automatically build the extensions if an appropriate platform is detected. If the build of the C extensions fails, due to missing compiler or other issue, the setup process will output a warning message, and re-run the @@ -146,26 +140,11 @@ use case for this is either for special testing circumstances, or in the rare case of compatibility/build issues not overcome by the usual "rebuild" mechanism:: - # *** only in SQLAlchemy 0.9.4 / 0.8.6 or greater *** export DISABLE_SQLALCHEMY_CEXT=1; python setup.py install -.. versionadded:: 0.9.4,0.8.6 Support for disabling the build of - C extensions using the ``DISABLE_SQLALCHEMY_CEXT`` environment variable - has been added. This allows control of C extension building whether or not - setuptools is available, and additionally works around the fact that - setuptools will possibly be **removing support** for command-line switches - such as ``--without-extensions`` in a future release. - - For versions of SQLAlchemy prior to 0.9.4 or 0.8.6, the - ``--without-cextensions`` option may be used to disable the attempt to build - C extensions, provided setupools is in use, and provided the ``Feature`` - construct is supported by the installed version of setuptools:: - - python setup.py --without-cextensions install - - Or with pip:: - - pip install --global-option='--without-cextensions' SQLAlchemy +.. versionchanged:: 1.1 The legacy ``--without-cextensions`` flag has been + removed from the installer as it relies on deprecated features of + setuptools. Installing on Python 3 @@ -174,8 +153,6 @@ Installing on Python 3 SQLAlchemy runs directly on Python 2 or Python 3, and can be installed in either environment without any adjustments or code conversion. -.. versionchanged:: 0.9.0 Python 3 is now supported in place with no 2to3 step - required. Installing a Database API diff --git a/lib/sqlalchemy/testing/distutils_run.py b/lib/sqlalchemy/testing/distutils_run.py deleted file mode 100644 index 38de8872c..000000000 --- a/lib/sqlalchemy/testing/distutils_run.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Quick and easy way to get setup.py test to run py.test without any -custom setuptools/distutils code. - -""" -import unittest -import pytest - - -class TestSuite(unittest.TestCase): - def test_sqlalchemy(self): - pytest.main(["-n", "4", "-q"]) @@ -1,29 +1,14 @@ -"""setup.py - -Please see README for basic installation instructions. - -""" - import os +import platform import re import sys from distutils.command.build_ext import build_ext -from distutils.errors import (CCompilerError, DistutilsExecError, - DistutilsPlatformError) - -has_feature = False -try: - from setuptools import setup, Extension - try: - # see - # https://bitbucket.org/pypa/setuptools/issue/65/deprecate-and-remove-features, - # where they may remove Feature. - from setuptools import Feature - has_feature = True - except ImportError: - pass -except ImportError: - from distutils.core import setup, Extension +from distutils.errors import CCompilerError +from distutils.errors import DistutilsExecError +from distutils.errors import DistutilsPlatformError +from setuptools import Extension +from setuptools import setup +from setuptools.command.test import test as TestCommand py3k = False @@ -34,7 +19,6 @@ if sys.version_info < (2, 6): elif sys.version_info >= (3, 0): py3k = True -import platform cpython = platform.python_implementation() == 'CPython' ext_modules = [ @@ -44,7 +28,7 @@ ext_modules = [ sources=['lib/sqlalchemy/cextension/resultproxy.c']), Extension('sqlalchemy.cutils', sources=['lib/sqlalchemy/cextension/utils.c']) - ] +] ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) if sys.platform == 'win32': @@ -82,6 +66,31 @@ class ve_build_ext(build_ext): cmdclass['build_ext'] = ve_build_ext +class PyTest(TestCommand): + # from https://pytest.org/latest/goodpractises.html#integration-with-setuptools-test-commands + user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] + + default_options = ["-n", "4", "-q"] + + def initialize_options(self): + TestCommand.initialize_options(self) + self.pytest_args = "" + + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = [] + self.test_suite = True + + def run_tests(self): + # import here, cause outside the eggs aren't loaded + import pytest + errno = pytest.main( + " ".join(self.default_options) + " " + self.pytest_args) + sys.exit(errno) + +cmdclass['test'] = PyTest + + def status_msgs(*msgs): print('*' * 75) for msg in msgs: @@ -113,42 +122,35 @@ r_file.close() def run_setup(with_cext): kwargs = extra.copy() if with_cext: - if has_feature: - kwargs['features'] = {'cextensions': Feature( - "optional C speed-enhancements", - standard=True, - ext_modules=ext_modules - )} - else: - kwargs['ext_modules'] = ext_modules - - setup(name="SQLAlchemy", - version=VERSION, - description="Database Abstraction Library", - author="Mike Bayer", - author_email="mike_mp@zzzcomputing.com", - url="http://www.sqlalchemy.org", - packages=find_packages('lib'), - package_dir={'': 'lib'}, - license="MIT License", - cmdclass=cmdclass, - tests_require=['pytest >= 2.5.2', 'mock', 'pytest-xdist'], - test_suite="sqlalchemy.testing.distutils_run", - long_description=readme, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: Jython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: Database :: Front-Ends", - "Operating System :: OS Independent", - ], - **kwargs - ) + kwargs['ext_modules'] = ext_modules + + setup( + name="SQLAlchemy", + version=VERSION, + description="Database Abstraction Library", + author="Mike Bayer", + author_email="mike_mp@zzzcomputing.com", + url="http://www.sqlalchemy.org", + packages=find_packages('lib'), + package_dir={'': 'lib'}, + license="MIT License", + cmdclass=cmdclass, + tests_require=['pytest >= 2.5.2', 'mock', 'pytest-xdist'], + long_description=readme, + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: Jython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Database :: Front-Ends", + "Operating System :: OS Independent", + ], + **kwargs + ) if not cpython: run_setup(False) |