From 98f2b9db353485a02bfdddaf7d7cb2bd8878b375 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Wed, 25 Jul 2018 23:32:35 +0200 Subject: [PATCH] Switch to pyscaffold 2.5.11 --- .coveragerc | 4 +- README.rst | 4 +- docs/Makefile | 72 ++++++++++-------------- docs/changelog.rst | 2 - docs/changes.rst | 2 + docs/conf.py | 52 ++++++------------ docs/index.rst | 2 +- setup.cfg | 88 +++++++++++++----------------- setup.py | 17 ++---- sigma0/__init__.py | 7 +++ {src/sigma0 => sigma0}/skeleton.py | 0 src/sigma0/__init__.py | 9 --- test-requirements.txt | 5 ++ tests/conftest.py | 2 +- 14 files changed, 106 insertions(+), 160 deletions(-) delete mode 100644 docs/changelog.rst create mode 100644 docs/changes.rst create mode 100644 sigma0/__init__.py rename {src/sigma0 => sigma0}/skeleton.py (100%) delete mode 100644 src/sigma0/__init__.py create mode 100644 test-requirements.txt diff --git a/.coveragerc b/.coveragerc index 9868ce8..f2a0b0f 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,7 +1,7 @@ # .coveragerc to control coverage.py [run] branch = True -source = */sigma0/* +source = sigma0 # omit = bad_file.py [report] @@ -20,4 +20,4 @@ exclude_lines = # Don't complain if non-runnable code isn't run: if 0: - if __name__ == .__main__.: + if __name__ == .__main__.: \ No newline at end of file diff --git a/README.rst b/README.rst index c1887ca..82ae14b 100644 --- a/README.rst +++ b/README.rst @@ -50,5 +50,5 @@ If you want to contribute please follow these steps: Note ==== -This project has been set up using PyScaffold 3.0.3. For details and usage -information on PyScaffold see http://pyscaffold.org/. +This project has been set up using PyScaffold 2.5.11. For details and usage +information on PyScaffold see http://pyscaffold.readthedocs.org/. diff --git a/docs/Makefile b/docs/Makefile index b7496fa..0067b00 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -6,10 +6,6 @@ SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build -AUTODOCDIR = api -AUTODOCBUILD = sphinx-apidoc -PROJECT = sigma0 -MODULEDIR = ../src/sigma0 # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $?), 1) @@ -23,7 +19,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext doc-requirements +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @@ -51,143 +47,131 @@ help: @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: - rm -rf $(BUILDDIR)/* $(AUTODOCDIR) + rm -rf $(BUILDDIR)/* -$(AUTODOCDIR): $(MODULEDIR) - mkdir -p $@ - $(AUTODOCBUILD) -f -o $@ $^ - -doc-requirements: $(AUTODOCDIR) - -html: doc-requirements +html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." -dirhtml: doc-requirements +dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." -singlehtml: doc-requirements +singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." -pickle: doc-requirements +pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." -json: doc-requirements +json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." -htmlhelp: doc-requirements +htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." -qthelp: doc-requirements +qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/$(PROJECT).qhcp" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/sigma0.qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/$(PROJECT).qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/sigma0.qhc" -devhelp: doc-requirements +devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" - @echo "# mkdir -p $HOME/.local/share/devhelp/$(PROJECT)" - @echo "# ln -s $(BUILDDIR)/devhelp $HOME/.local/share/devhelp/$(PROJEC)" + @echo "# mkdir -p $HOME/.local/share/devhelp/sigma0" + @echo "# ln -s $(BUILDDIR)/devhelp $HOME/.local/share/devhelp/sigma0" @echo "# devhelp" -epub: doc-requirements +epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." -patch-latex: - find _build/latex -iname "*.tex" | xargs -- \ - sed -i'' 's~includegraphics{~includegraphics\[keepaspectratio,max size={\\textwidth}{\\textheight}\]{~g' - -latex: doc-requirements +latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - $(MAKE) patch-latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." -latexpdf: doc-requirements +latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - $(MAKE) patch-latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." -latexpdfja: doc-requirements +latexpdfja: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through platex and dvipdfmx..." $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." -text: doc-requirements +text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." -man: doc-requirements +man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." -texinfo: doc-requirements +texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." -info: doc-requirements +info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." -gettext: doc-requirements +gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." -changes: doc-requirements +changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." -linkcheck: doc-requirements +linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." -doctest: doc-requirements +doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." -xml: doc-requirements +xml: $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo @echo "Build finished. The XML files are in $(BUILDDIR)/xml." -pseudoxml: doc-requirements +pseudoxml: $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/docs/changelog.rst b/docs/changelog.rst deleted file mode 100644 index 871950d..0000000 --- a/docs/changelog.rst +++ /dev/null @@ -1,2 +0,0 @@ -.. _changes: -.. include:: ../CHANGELOG.rst diff --git a/docs/changes.rst b/docs/changes.rst new file mode 100644 index 0000000..257630a --- /dev/null +++ b/docs/changes.rst @@ -0,0 +1,2 @@ +.. _changes: +.. include:: ../CHANGES.rst diff --git a/docs/conf.py b/docs/conf.py index d330007..0f8f994 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -8,53 +8,33 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import os import sys -import inspect -import shutil - -__location__ = os.path.join(os.getcwd(), os.path.dirname( - inspect.getfile(inspect.currentframe()))) # 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. -sys.path.insert(0, os.path.join(__location__, '../src')) +# sys.path.insert(0, os.path.abspath('.')) -# -- Run sphinx-apidoc ------------------------------------------------------ +# -- Hack for ReadTheDocs ------------------------------------------------------ # This hack is necessary since RTD does not issue `sphinx-apidoc` before running # `sphinx-build -b html . _build/html`. See Issue: # https://github.com/rtfd/readthedocs.org/issues/1139 # DON'T FORGET: Check the box "Install your project inside a virtualenv using # setup.py install" in the RTD Advanced Settings. -# Additionally it helps us to avoid running apidoc manually - -try: # for Sphinx >= 1.7 - from sphinx.ext import apidoc -except ImportError: +import os +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' +if on_rtd: + import inspect from sphinx import apidoc -output_dir = os.path.join(__location__, "api") -module_dir = os.path.join(__location__, "../src/sigma0") -try: - shutil.rmtree(output_dir) -except FileNotFoundError: - pass - -try: - import sphinx - from distutils.version import LooseVersion + __location__ = os.path.join(os.getcwd(), os.path.dirname( + inspect.getfile(inspect.currentframe()))) + output_dir = os.path.join(__location__, "../docs/api") + module_dir = os.path.join(__location__, "../sigma0") cmd_line_template = "sphinx-apidoc -f -o {outputdir} {moduledir}" cmd_line = cmd_line_template.format(outputdir=output_dir, moduledir=module_dir) - - args = cmd_line.split(" ") - if LooseVersion(sphinx.__version__) >= LooseVersion('1.7'): - args = args[1:] - - apidoc.main(args) -except Exception as e: - print("Running `sphinx-apidoc` failed!\n{}".format(e)) + apidoc.main(cmd_line.split(" ")) # -- General configuration ----------------------------------------------------- @@ -259,11 +239,11 @@ # -- External mapping ------------------------------------------------------------ python_version = '.'.join(map(str, sys.version_info[0:2])) intersphinx_mapping = { - 'sphinx': ('http://www.sphinx-doc.org/en/stable', None), - 'python': ('https://docs.python.org/' + python_version, None), - 'matplotlib': ('https://matplotlib.org', None), - 'numpy': ('https://docs.scipy.org/doc/numpy', None), + 'sphinx': ('http://sphinx.pocoo.org', None), + 'python': ('http://docs.python.org/' + python_version, None), + 'matplotlib': ('http://matplotlib.sourceforge.net', None), + 'numpy': ('http://docs.scipy.org/doc/numpy', None), 'sklearn': ('http://scikit-learn.org/stable', None), 'pandas': ('http://pandas.pydata.org/pandas-docs/stable', None), - 'scipy': ('https://docs.scipy.org/doc/scipy/reference', None), + 'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None), } diff --git a/docs/index.rst b/docs/index.rst index 3d72eb7..3525390 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -46,7 +46,7 @@ Contents License Authors - Changelog + Changelog Module Reference diff --git a/setup.cfg b/setup.cfg index da1a8f0..93447d2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,44 +1,41 @@ -# This file is used to configure your project. -# Read more about the various options under: -# http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files - [metadata] name = sigma0 -description = Collection of backscatter models +summary = Collection of backscatter models author = TU Wien author-email = remote.sensing@geo.tuwien.ac.at license = mit -url = http://rs.geo.tuwien.ac.at -long-description = file: README.rst -# Change if running only on Windows, Mac or Linux (comma-separated) -platforms = any +home-page = http://rs.geo.tuwien.ac.at +description-file = README.rst # Add here all kinds of additional classifiers as defined under # https://pypi.python.org/pypi?%3Aaction=list_classifiers -classifiers = +classifier = Development Status :: 4 - Beta Programming Language :: Python -[options] -zip_safe = False -packages = find: -include_package_data = True -package_dir = - =src -# Add here dependencies of your project (semicolon-separated), e.g. -# install_requires = numpy; scipy -install_requires = -# Add here test requirements (semicolon-separated) -tests_require = pytest; pytest-cov +[entry_points] +# Add here console scripts like: +# console_scripts = +# script_name = sigma0.module:function +# For example: +# console_scripts = +# fibonacci = sigma0.skeleton:run +# as well as other entry_points. + -[options.packages.find] -where = src -exclude = - tests +[files] +# Add here 'data_files', 'packages' or 'namespace_packages'. +# Additional data files are defined as key value pairs of target directory +# and source location from the root of the repository: +packages = + sigma0 +# data_files = +# share/sigma0_docs = docs/* -[options.extras_require] -# Add here additional requirements for extra features, to install with: -# `pip install sigma0[PDF]` like: -# PDF = ReportLab; RXP +[extras] +# Add here additional requirements for extra features, like: +# PDF = +# ReportLab>=1.2 +# RXP [test] # py.test options when running `python setup.py test` @@ -52,13 +49,9 @@ addopts = tests addopts = --cov sigma0 --cov-report term-missing --verbose -norecursedirs = - dist - build - .tox [aliases] -release = sdist bdist_wheel upload +docs = build_sphinx [bdist_wheel] # Use this option if your package is pure-python @@ -68,23 +61,18 @@ universal = 1 source_dir = docs build_dir = docs/_build +[pbr] +# Let pbr run sphinx-apidoc +autodoc_tree_index_modules = True +# autodoc_tree_excludes = ... +# Let pbr itself generate the apidoc +# autodoc_index_modules = True +# autodoc_exclude_modules = ... +# Convert warnings to errors +# warnerrors = True + [devpi:upload] # Options for the devpi: PyPI server and packaging tool # VCS export must be deactivated since we are using setuptools-scm no-vcs = 1 -formats = bdist_wheel - -[flake8] -# Some sane defaults for the code style checker flake8 -exclude = - .tox - build - dist - .eggs - docs/conf.py - -[pyscaffold] -# PyScaffold's parameters when the project was created. -# This will be used when updating. Do not change! -version = 3.0.3 -package = sigma0 +formats = bdist_wheel \ No newline at end of file diff --git a/setup.py b/setup.py index c899644..baf9b6e 100644 --- a/setup.py +++ b/setup.py @@ -3,28 +3,19 @@ """ Setup file for sigma0. - This file was generated with PyScaffold 3.0.3. - PyScaffold helps you to put up the scaffold of your new Python project. - Learn more under: http://pyscaffold.org/ + This file was generated with PyScaffold 2.5.11, a tool that easily + puts up a scaffold for your new Python project. Learn more under: + http://pyscaffold.readthedocs.org/ """ import sys from setuptools import setup -# Add here console scripts and other entry points in ini-style format -entry_points = """ -[console_scripts] -# script_name = sigma0.module:function -# For example: -# fibonacci = sigma0.skeleton:run -""" - def setup_package(): needs_sphinx = {'build_sphinx', 'upload_docs'}.intersection(sys.argv) sphinx = ['sphinx'] if needs_sphinx else [] - setup(setup_requires=['pyscaffold>=3.0a0,<3.1a0'] + sphinx, - entry_points=entry_points, + setup(setup_requires=['six', 'pyscaffold>=2.5a0,<2.6a0'] + sphinx, use_pyscaffold=True) diff --git a/sigma0/__init__.py b/sigma0/__init__.py new file mode 100644 index 0000000..c280328 --- /dev/null +++ b/sigma0/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +import pkg_resources + +try: + __version__ = pkg_resources.get_distribution(__name__).version +except: + __version__ = 'unknown' diff --git a/src/sigma0/skeleton.py b/sigma0/skeleton.py similarity index 100% rename from src/sigma0/skeleton.py rename to sigma0/skeleton.py diff --git a/src/sigma0/__init__.py b/src/sigma0/__init__.py deleted file mode 100644 index 4bb95dc..0000000 --- a/src/sigma0/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- -from pkg_resources import get_distribution, DistributionNotFound - -try: - # Change here if project is renamed and does not equal the package name - dist_name = __name__ - __version__ = get_distribution(dist_name).version -except DistributionNotFound: - __version__ = 'unknown' diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..468f195 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,5 @@ +# Add requirements only needed for your unittests and during development here. +# They will be installed automatically when running `python setup.py test`. +# ATTENTION: Don't remove pytest-cov and pytest as they are needed. +pytest-cov +pytest diff --git a/tests/conftest.py b/tests/conftest.py index 657eaac..518903f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,4 +9,4 @@ """ from __future__ import print_function, absolute_import, division -# import pytest +import pytest