From 1a8c1bb370a7584bfde8750ce529aaf0c89e3358 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 16 Apr 2020 18:40:09 +0200 Subject: [PATCH] Cleanup py27 support This repo is now testing only with Python 3, so let's make a few cleanups: - Remove python 2.7 stanza from setup.py - Add requires on python >= 3.6 to setup.cfg so that pypi and pip know about the requirement - Remove obsolete sections from setup.cfg - Update classifiers - Update requirements, no need for python_version anymore - Switch to using sphinx-build with apidoc extension - Use newer openstackdocstheme version - Remove Babel requirement, this is not needed. Change-Id: I4176d8002d45449171aa5f7a7caef196ab7900d0 --- doc/source/conf.py | 12 +++++++++++- doc/source/contributor/index.rst | 2 +- lower-constraints.txt | 3 ++- setup.cfg | 17 +++-------------- setup.py | 9 --------- test-requirements.txt | 7 ++++--- tox.ini | 2 +- 7 files changed, 22 insertions(+), 30 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index be72b5be1..12c8f1e3a 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -5,7 +5,7 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', +extensions = ['sphinxcontrib.apidoc', 'sphinx.ext.viewcode', 'sphinxcontrib.rsvgconverter', 'oslo_policy.sphinxext', @@ -120,3 +120,13 @@ latex_documents = [ # -- Options for seqdiag ------------------------------------------------------ seqdiag_html_image_format = "SVG" + +# -- sphinxcontrib.apidoc configuration -------------------------------------- + +apidoc_module_dir = '../../ironic_inspector' +apidoc_output_dir = 'contributor/api' +apidoc_excluded_paths = [ + 'migrations', + 'test', + 'common/i18n*' +] diff --git a/doc/source/contributor/index.rst b/doc/source/contributor/index.rst index dd81c78c6..2036851ac 100644 --- a/doc/source/contributor/index.rst +++ b/doc/source/contributor/index.rst @@ -8,7 +8,7 @@ Python API .. toctree:: :maxdepth: 1 - api/autoindex + api/modules Ironic Inspector CI ~~~~~~~~~~~~~~~~~~~ diff --git a/lower-constraints.txt b/lower-constraints.txt index 4d40a7bc2..308a61309 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -18,7 +18,7 @@ keystoneauth1==3.14.0 keystonemiddleware==4.18.0 mock==3.0.0 netaddr==0.7.18 -openstackdocstheme==1.20.0 +openstackdocstheme==1.31.2 openstacksdk==0.40.0 os-api-ref==1.4.0 oslo.concurrency==3.26.0 @@ -41,6 +41,7 @@ pytz==2013.6 reno==2.5.0 retrying==1.2.3 sphinx==1.6.2 +sphinxcontrib-apidoc==0.2.0 sphinxcontrib-svg2pdfconverter==0.1.0 SQLAlchemy==1.0.10 stestr==1.0.0 diff --git a/setup.cfg b/setup.cfg index 236601d6c..cc141f340 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,7 @@ author = OpenStack author-email = openstack-discuss@lists.openstack.org home-page = https://docs.openstack.org/ironic-inspector/latest/ license = Apache-2 +python-requires = >=3.6 classifier = Environment :: Console Environment :: OpenStack @@ -14,6 +15,8 @@ classifier = License :: OSI Approved :: Apache Software License Operating System :: OS Independent Programming Language :: Python + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 @@ -95,17 +98,3 @@ input_file = ironic_inspector/locale/ironic_inspector.pot keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = ironic_inspector/locale/ironic_inspector.pot - -[build_sphinx] -all_files = 1 -build-dir = doc/build -source-dir = doc/source -warning-is-error = 1 - -[pbr] -autodoc_index_modules = True -autodoc_exclude_modules = - ironic_inspector.migrations.* - ironic_inspector.test.* - ironic.common.i18n -api_doc_dir = contributor/api diff --git a/setup.py b/setup.py index 566d84432..cd35c3c35 100644 --- a/setup.py +++ b/setup.py @@ -13,17 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - setuptools.setup( setup_requires=['pbr>=2.0.0'], pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index 17dba03e8..ce6c00259 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,15 +1,16 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -Babel!=2.4.0,>=2.3.4 # BSD + bandit!=1.6.0,>=1.1.0,<2.0.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0 flake8-import-order>=0.13 # LGPLv3 hacking>=3.0.0,<3.1.0 # Apache-2.0 -sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD +sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD -openstackdocstheme>=1.20.0 # Apache-2.0 +sphinxcontrib-apidoc>=0.2.0 # BSD +openstackdocstheme>=1.31.2 # Apache-2.0 os-api-ref>=1.4.0 # Apache-2.0 pymemcache!=1.3.0,>=1.2.9 # Apache 2.0 License stestr>=1.0.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index f90693356..90813c55b 100644 --- a/tox.ini +++ b/tox.ini @@ -83,7 +83,7 @@ setenv = PYTHONHASHSEED=0 sitepackages = False deps = -r{toxinidir}/test-requirements.txt commands = - python setup.py build_sphinx + sphinx-build -W -b html doc/source doc/build/html [testenv:pdf-docs] whitelist_externals = make