From ee26961cfcf8e0abb221b7cdea2a8c79e0e28782 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 16 Apr 2020 10:28:36 +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 - Switch to using sphinx-build - Cleanup doc/source/conf.py to remove now obsolete content. - Use newer openstackdocstheme version - Move constraints into deps - Increase warlock dependency, glanceclient blocks version 1.3.0 Change-Id: I8feb2e86281f2250bdc379b7868c5e738c1a19e6 --- api-ref/source/conf.py | 28 ++++--------------------- doc/source/conf.py | 20 ++++++++++++------ doc/source/contributor/devref/index.rst | 2 +- lower-constraints.txt | 7 ++++--- releasenotes/source/conf.py | 4 ---- setup.cfg | 23 +++----------------- setup.py | 9 -------- test-requirements.txt | 7 +++++-- tox.ini | 2 +- 9 files changed, 32 insertions(+), 70 deletions(-) diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index 752c0b40..89cd3fcc 100644 --- a/api-ref/source/conf.py +++ b/api-ref/source/conf.py @@ -25,11 +25,8 @@ # serve to show the default. import os -import subprocess import sys -import openstackdocstheme # noqa - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -43,6 +40,7 @@ sys.path.insert(0, os.path.abspath('./')) # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ + 'openstackdocstheme', 'os_api_ref' ] @@ -60,19 +58,9 @@ master_doc = 'index' project = u'Data Protection API Reference' copyright = u'OpenStack Foundation' -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -from karbor.version import version_info -# The full version, including alpha/beta/rc tags. -release = version_info.release_string() -# The short X.Y version. -version = version_info.version_string() - -# html_context allows us to pass arbitrary values into the html template -html_context = {"bug_tag": "api-ref", - "bug_project": "karbor"} +repository_name = 'openstack/karbor' +bug_project = 'karbor' +bug_tag = 'api-ref' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -117,7 +105,6 @@ pygments_style = 'sphinx' # html_theme = '_theme' html_theme = 'openstackdocs' -html_theme_path = [openstackdocstheme.get_html_theme_path()] html_theme_options = { "sidebar_mode": "toc", } @@ -152,13 +139,6 @@ html_theme_options = { # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' -git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local", - "-n1"] -html_last_updated_fmt = subprocess.check_output(git_cmd).decode('utf-8') - # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True diff --git a/doc/source/conf.py b/doc/source/conf.py index 49f27f31..0692d713 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -20,14 +20,14 @@ sys.path.insert(0, os.path.abspath('../..')) # 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', + 'sphinxcontrib.apidoc', # 'sphinx.ext.intersphinx', 'openstackdocstheme', - 'reno.sphinxext', 'oslo_config.sphinxext', 'oslo_config.sphinxconfiggen', 'oslo_policy.sphinxext', 'oslo_policy.sphinxpolicygen', + 'reno.sphinxext' ] # autodoc generation is a bit aggressive and a nuisance when doing heavy @@ -73,6 +73,18 @@ add_module_names = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' +# -- sphinxcontrib.apidoc configuration -------------------------------------- + +apidoc_module_dir = '../../karbor' +apidoc_output_dir = 'contributor/api' +apidoc_excluded_paths = [ + 'tests', + 'wsgi', + 'services/protection/bank_plugins', + 'services/protection/protectable_plugins', + 'services/protection/protection_plugins', +] + # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with @@ -94,10 +106,6 @@ latex_documents = [ u'OpenStack Foundation', 'manual'), ] -# Example configuration for intersphinx: refer to the Python standard library. -# intersphinx_mapping = {'http://docs.python.org/': None} -html_last_updated_fmt = '%Y-%m-%d %H:%M' - # -- Options for openstackdocstheme ------------------------------------------- repository_name = 'openstack/karbor' bug_project = project.lower() diff --git a/doc/source/contributor/devref/index.rst b/doc/source/contributor/devref/index.rst index aa1c683a..15a9c430 100644 --- a/doc/source/contributor/devref/index.rst +++ b/doc/source/contributor/devref/index.rst @@ -7,4 +7,4 @@ Code Reference .. toctree:: :maxdepth: 1 - ../api/autoindex + ../api/modules diff --git a/lower-constraints.txt b/lower-constraints.txt index 2df43ff9..759512b4 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -60,7 +60,7 @@ netaddr==0.7.19 netifaces==0.10.6 networkx==1.11 oauthlib==2.0.6 -openstackdocstheme==1.18.1 +openstackdocstheme==2.0.0 openstacksdk==0.12.0 os-api-ref==1.4.0 os-client-config==1.29.0 @@ -128,7 +128,8 @@ rsa==3.4.2 simplejson==3.13.2 six==1.10.0 snowballstemmer==1.2.1 -Sphinx==1.6.2 +Sphinx==2.0.0 +sphinxcontrib-apidoc==0.2.0 sphinxcontrib-websupport==1.0.1 sqlalchemy-migrate==0.11.0 SQLAlchemy==1.0.10 @@ -146,7 +147,7 @@ traceback2==1.4.0 unittest2==1.1.0 urllib3==1.22 vine==1.1.4 -warlock==1.3.0 +warlock==1.3.1 WebOb==1.7.1 websocket-client==0.47.0 wrapt==1.10.11 diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 2253b66c..77bbf020 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -130,10 +130,6 @@ html_theme = 'openstackdocs' # directly to the root of the documentation. # html_extra_path = [] -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -html_last_updated_fmt = '%Y-%m-%d %H:%M' - # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True diff --git a/setup.cfg b/setup.cfg index 894222d2..d6db7848 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,7 @@ description-file = author = OpenStack author-email = openstack-discuss@lists.openstack.org home-page = https://docs.openstack.org/karbor/latest/ +python-requires = >=3.6 classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -13,6 +14,8 @@ classifier = License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux 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 @@ -78,15 +81,6 @@ karbor.operationengine.engine.executor = thread_pool = karbor.services.operationengine.engine.executors.thread_pool_executor:ThreadPoolExecutor green_thread = karbor.services.operationengine.engine.executors.green_thread_executor:GreenThreadExecutor -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 -warning-is-error = 1 - -[upload_sphinx] -upload-dir = doc/build/html - [compile_catalog] directory = karbor/locale domain = karbor @@ -100,14 +94,3 @@ input_file = karbor/locale/karbor.pot keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = karbor/locale/karbor.pot - -[pbr] -autodoc_index_modules = true -autodoc_exclude_modules = - karbor.tests.* - karbor.wsgi.* - karbor.services.protection.bank_plugins.* - karbor.services.protection.protectable_plugins.* - karbor.services.protection.protection_plugins.* -api_doc_dir = contributor/api -warnerrors = true diff --git a/setup.py b/setup.py index 566d8443..cd35c3c3 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 8a987312..d25713c9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,7 +7,6 @@ botocore>=1.5.1 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 croniter>=0.3.4 # MIT License python-subunit>=1.0.0 # Apache-2.0/BSD -sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 # BSD oslotest>=3.2.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0 taskflow>=2.16.0 # Apache-2.0 @@ -22,6 +21,10 @@ python-freezerclient>=1.3.0 # Apache-2.0 python-karborclient>=0.6.0 # Apache-2.0 python-neutronclient>=6.7.0 # Apache-2.0 python-troveclient>=2.2.0 # Apache-2.0 + +# Documentation +sphinx>=2.0.0,!=2.1.0 # BSD reno>=2.5.0 # Apache-2.0 -openstackdocstheme>=1.18.1 # Apache-2.0 +openstackdocstheme>=2.0.0 # Apache-2.0 os-api-ref>=1.4.0 # Apache-2.0 +sphinxcontrib-apidoc>=0.2.0 # BSD diff --git a/tox.ini b/tox.ini index ea74009d..09918722 100644 --- a/tox.ini +++ b/tox.ini @@ -50,7 +50,7 @@ commands = whitelist_externals = sh /bin/rm commands = /bin/rm -rf doc/build /bin/rm -rf doc/source/contributor/api - python setup.py build_sphinx + sphinx-build -W -b html doc/source doc/build/html [testenv:debug] commands = oslo_debug_helper -t karbor/tests/unit {posargs}