From e7885499dd10e92aa460ddeadfc427d418a76fe1 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Fri, 5 Jun 2020 09:51:28 +0200 Subject: [PATCH] Cleanup py27 and docs 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 - Remove obsolete sections from setup.cfg - Update classifiers - Update requirements, no need for python_version anymore - Cleanup doc/source/conf.py to remove now obsolete content, use sphinxcontrib.apidoc to build module index again (this seems to have been broken when switching to sphinx-build). - Remove install_command from tox.ini, the default is fine - Use TOX_CONSTRAINTS_FILE instead of obsolete UPPER_CONSTRAINTS_FILE. - Update tox.ini for python3 only support. Change-Id: Id8738ecfb0f578d2a7953c63ffe10779f835bcaf --- .gitignore | 1 + doc/requirements.txt | 4 ++-- doc/source/conf.py | 29 ++++++++++++++++------------- doc/source/developer/index.rst | 7 ++++--- requirements.txt | 5 ++--- setup.cfg | 18 +----------------- setup.py | 9 --------- test-requirements.txt | 3 +-- tox.ini | 18 +++++++++--------- 9 files changed, 36 insertions(+), 58 deletions(-) diff --git a/.gitignore b/.gitignore index 439a7194e..d22ee0518 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .coverage coverage.xml cover/* +doc/source/developer/api/ *~ .testrepository *.sw? diff --git a/doc/requirements.txt b/doc/requirements.txt index a7dd2358f..dadd98df2 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -3,6 +3,6 @@ # process, which may cause wedges in the gate later. openstackdocstheme>=1.18.1 # Apache-2.0 -sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD -sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD +sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 # BSD reno>=2.5.0 # Apache-2.0 +sphinxcontrib-apidoc>=0.2.0 # BSD diff --git a/doc/source/conf.py b/doc/source/conf.py index 0792f5619..9202175c2 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -5,7 +5,11 @@ import os # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. sys.path.append(os.path.abspath('../lib')) -extensions = ['openstackdocstheme', 'element_deps', 'sphinx.ext.autodoc'] +extensions = ['openstackdocstheme', + 'element_deps', + 'sphinx.ext.autodoc', + 'sphinxcontrib.apidoc' +] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -29,18 +33,6 @@ bug_project = 'diskimage-builder' bug_tag = '' html_last_updated_fmt = '%Y-%m-%d %H:%M' -# 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. -# - -import pbr.version - -version_info = pbr.version.VersionInfo('diskimage-builder') -# The short X.Y version. -release = version_info.release_string() -# The full version, including alpha/beta/rc tags. -version = version_info.version_string() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -244,3 +236,14 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False + +# -- sphinxcontrib.apidoc configuration -------------------------------------- + +apidoc_module_dir = '../../diskimage_builder' +apidoc_output_dir = 'developer/api' +apidoc_excluded_paths = [ + 'tests', + 'block_device.tests', + 'elements', + 'lib', +] diff --git a/doc/source/developer/index.rst b/doc/source/developer/index.rst index 857df0895..37dca620b 100644 --- a/doc/source/developer/index.rst +++ b/doc/source/developer/index.rst @@ -12,6 +12,7 @@ Developer Guide dib_lint stable_interfaces vhd_creation + Module index This documentation explains how to get started with creating your own disk-image-builder elements as well as some high level concepts for element @@ -40,7 +41,7 @@ Python module documentation --------------------------- For internal documentation on the DIB python components, see the -:ref:`modindex` +:ref:`modindex`. Finding Work @@ -48,5 +49,5 @@ Finding Work We maintain a list of low-hanging-fruit tags on launchpad: - * `https://bugs.launchpad.net/diskimage-builder/+bugs?field.tag=low-hanging-fruit` - +* `https://bugs.launchpad.net/diskimage-builder/+bugs?field.tag=low-hanging-fruit + `_ diff --git a/requirements.txt b/requirements.txt index f4db11840..b009ed84c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,8 @@ # 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. -# NOTE(fdegir): NetworkX 2.3 dropped support for Python 2 -networkx>=1.10,<2.3;python_version<'3.0' # BSD -networkx>=1.10;python_version>='3.4' # BSD + +networkx>=1.10 # BSD pbr!=2.1.0,>=2.0.0 # Apache-2.0 PyYAML>=3.12 # MIT six>=1.10.0 # MIT diff --git a/setup.cfg b/setup.cfg index 52c35b39b..b1a444a8d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,26 +15,10 @@ classifier = Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 Environment :: Console python-requires = >=3.5 -[build_sphinx] -all_files = 1 -build-dir = doc/build -source-dir = doc/source -warning-is-error = 1 - -[pbr] -autodoc_index_modules = 1 -autodoc_exclude_modules = - setup.py - diskimage_builder.tests.* - diskimage_builder.block_device.tests.* - # elements are a weird mix of scripts & python - diskimage_builder.elements.* - # this is non-pythony stuff - diskimage_builder.lib.* - [files] packages = diskimage_builder 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 31ac5c985..a719c94f5 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,8 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -pylint==1.7.6;python_version=='2.7' # GPLv2 -pylint;python_version>'3.0' #GPLv2 +pylint>=1.7.1 #GPLv2 fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0.0 # BSD diff --git a/tox.ini b/tox.ini index 984a064fb..e57d626ae 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,14 @@ [tox] envlist = pep8,pylint,py35,py36,py37,py38 -minversion = 2.0 +minversion = 3.1.1 skipsdist = True +ignore_basepython_conflict = True [testenv] usedevelop = True -install_command = pip install {opts} {packages} +basepython = python3 deps= - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= @@ -20,17 +21,14 @@ deps = bindep commands = bindep test [testenv:pep8] -basepython = python3 commands = flake8 {posargs} dib-lint [testenv:pylint] -basepython = python3 commands = pylint --rcfile pylint.cfg diskimage_builder [testenv:venv] -basepython = python3 commands = {posargs} [testenv:func] @@ -45,7 +43,11 @@ basepython = python3 commands = python setup.py test --coverage --coverage-package-name diskimage_builder --testr-args='{posargs}' [testenv:docs] -deps= -r{toxinidir}/doc/requirements.txt +deps= + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/doc/requirements.txt basepython = python3 whitelist_externals = rm @@ -55,7 +57,6 @@ commands = [testenv:releasenotes] deps = {[testenv:docs]deps} -basepython = python3 commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [flake8] @@ -63,7 +64,6 @@ ignore = E125,E126,E127,H202,H803,W503,W504 exclude = .venv,.git,.tox,dist,doc/build,doc/source,*lib/python*,*egg,build,conf.py [testenv:lower-constraints] -basepython = python3 deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt