diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..4041f4c --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,7 @@ +languages: + Ruby: false + JavaScript: false + PHP: false + Python: true +exclude_paths: + - "tests/*" diff --git a/.travis.yml b/.travis.yml index cc0a1b0..b1c0c82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,6 @@ language: python -python: - - "2.7" - - "3.2" - - "3.3" - - "3.4" - - "pypy" - - "pypy3" +sudo: false install: - - pip install . - - pip install coveralls + - pip install 'tox>=2.0,<2.1' script: - - coverage run setup.py test -after_success: - - coveralls + - tox diff --git a/README.md b/README.md index 94f25c8..a41c495 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # python-gyazo [![PyPI version](https://badge.fury.io/py/python-gyazo.svg)](http://badge.fury.io/py/python-gyazo) +[![Downloads](https://pypip.in/download/python-gyazo/badge.svg)](https://pypi.python.org/pypi/python-gyazo/) [![Build Status](https://travis-ci.org/ymyzk/python-gyazo.svg?branch=master)](https://travis-ci.org/ymyzk/python-gyazo) +[![Code Climate](https://codeclimate.com/github/ymyzk/python-gyazo/badges/gpa.svg)](https://codeclimate.com/github/ymyzk/python-gyazo) [![Coverage Status](https://coveralls.io/repos/ymyzk/python-gyazo/badge.svg?branch=master)](https://coveralls.io/r/ymyzk/python-gyazo?branch=master) A Python wrapper for Gyazo API. @@ -8,6 +10,7 @@ A Python wrapper for Gyazo API. ## Requirements * Python 2.7 * Python 3.2+ +* PyPy ## Installation `pip install python-gyazo` diff --git a/docs/Makefile b/docs/Makefile index 264e897..9e97ce9 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -5,7 +5,7 @@ SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = -BUILDDIR = _build +BUILDDIR = build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) @@ -15,11 +15,11 @@ endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source # the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext help: @echo "Please use \`make ' where is one of" @@ -30,6 +30,7 @@ help: @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" + @echo " applehelp to make an Apple Help Book" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @@ -45,6 +46,7 @@ help: @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " coverage to run coverage check of the documentation (if enabled)" clean: rm -rf $(BUILDDIR)/* @@ -89,6 +91,14 @@ qthelp: @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/python-gyazo.qhc" +applehelp: + $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp + @echo + @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." + @echo "N.B. You won't be able to view it unless you put it in" \ + "~/Library/Documentation/Help or install it in your application" \ + "bundle." + devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @@ -166,6 +176,11 @@ doctest: @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." +coverage: + $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage + @echo "Testing of coverage in the sources finished, look at the " \ + "results in $(BUILDDIR)/coverage/python.txt." + xml: $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo diff --git a/docs/make.bat b/docs/make.bat index fc3c435..72f57f6 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -5,9 +5,9 @@ REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) -set BUILDDIR=_build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . -set I18NSPHINXOPTS=%SPHINXOPTS% . +set BUILDDIR=build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source +set I18NSPHINXOPTS=%SPHINXOPTS% source if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% @@ -37,6 +37,7 @@ if "%1" == "help" ( echo. pseudoxml to make pseudoxml-XML files for display purposes echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled + echo. coverage to run coverage check of the documentation if enabled goto end ) @@ -47,6 +48,14 @@ if "%1" == "clean" ( ) +REM Check if sphinx-build is available and fallback to Python version if any +%SPHINXBUILD% 2> nul +if errorlevel 9009 goto sphinx_python +goto sphinx_ok + +:sphinx_python + +set SPHINXBUILD=python -m sphinx.__init__ %SPHINXBUILD% 2> nul if errorlevel 9009 ( echo. @@ -60,6 +69,9 @@ if errorlevel 9009 ( exit /b 1 ) +:sphinx_ok + + if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 @@ -149,7 +161,7 @@ if "%1" == "latexpdf" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf - cd %BUILDDIR%/.. + cd %~dp0 echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end @@ -159,7 +171,7 @@ if "%1" == "latexpdfja" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf-ja - cd %BUILDDIR%/.. + cd %~dp0 echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end @@ -223,6 +235,15 @@ results in %BUILDDIR%/doctest/output.txt. goto end ) +if "%1" == "coverage" ( + %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage + if errorlevel 1 exit /b 1 + echo. + echo.Testing of coverage in the sources finished, look at the ^ +results in %BUILDDIR%/coverage/python.txt. + goto end +) + if "%1" == "xml" ( %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml if errorlevel 1 exit /b 1 diff --git a/docs/conf.py b/docs/source/conf.py similarity index 83% rename from docs/conf.py rename to docs/source/conf.py index 1ef129d..631b50c 100644 --- a/docs/conf.py +++ b/docs/source/conf.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # python-gyazo documentation build configuration file, created by -# sphinx-quickstart on Mon Jan 26 09:08:54 2015. +# sphinx-quickstart on Fri May 15 14:17:23 2015. # # This file is execfile()d with the current directory set to its # containing dir. @@ -14,6 +14,7 @@ import sys import os +import shlex # 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 @@ -35,7 +36,9 @@ # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] -# The suffix of source filenames. +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# source_suffix = ['.rst', '.md'] source_suffix = '.rst' # The encoding of source files. @@ -46,20 +49,24 @@ # General information about the project. project = u'python-gyazo' -copyright = u'2015, Yusuke Miyazaki' +copyright = u'2014-2015, Yusuke Miyazaki' +author = u'Yusuke Miyazaki' # 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. # # The short X.Y version. -version = '0.5.0' +version = '0.7.1' # The full version, including alpha/beta/rc tags. -release = '0.5.0' +release = '0.7.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -69,7 +76,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build'] +exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -95,12 +102,15 @@ # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = 'alabaster' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -177,10 +187,23 @@ # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +#html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +#html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +#html_search_scorer = 'scorer.js' + # Output file base name for HTML help builder. htmlhelp_basename = 'python-gyazodoc' - # -- Options for LaTeX output --------------------------------------------- latex_elements = { @@ -192,13 +215,16 @@ # Additional stuff for the LaTeX preamble. #'preamble': '', + +# Latex figure (float) alignment +#'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'python-gyazo.tex', u'python-gyazo Documentation', + (master_doc, 'python-gyazo.tex', u'python-gyazo Documentation', u'Yusuke Miyazaki', 'manual'), ] @@ -228,8 +254,8 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'python-gyazo', u'python-gyazo Documentation', - [u'Yusuke Miyazaki'], 1) + (master_doc, 'python-gyazo', u'python-gyazo Documentation', + [author], 1) ] # If true, show URL addresses after external links. @@ -242,8 +268,8 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'python-gyazo', u'python-gyazo Documentation', - u'Yusuke Miyazaki', 'python-gyazo', 'One line description of project.', + (master_doc, 'python-gyazo', u'python-gyazo Documentation', + author, 'python-gyazo', 'One line description of project.', 'Miscellaneous'), ] @@ -258,5 +284,3 @@ # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False - -autoclass_content = 'both' diff --git a/docs/index.rst b/docs/source/index.rst similarity index 100% rename from docs/index.rst rename to docs/source/index.rst diff --git a/docs/reference.rst b/docs/source/reference.rst similarity index 100% rename from docs/reference.rst rename to docs/source/reference.rst diff --git a/gyazo/__init__.py b/gyazo/__init__.py index 07e64cf..35e12ee 100644 --- a/gyazo/__init__.py +++ b/gyazo/__init__.py @@ -6,3 +6,6 @@ from .api import Api from .error import GyazoError from .image import Image, ImageList + + +__all__ = [Api, GyazoError, Image, ImageList] diff --git a/setup.py b/setup.py index ef44273..7a8cebf 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python - import sys try: @@ -9,18 +8,24 @@ __author__ = 'Yusuke Miyazaki ' -__version__ = '0.7.0' +__version__ = '0.7.1' requires = [ 'Jinja2>=2.7.0', 'progress>=1.2', 'python-dateutil>=2.4', - 'requests>=2.5.0', + 'requests>=2.7.0', 'six>=1.9.0' ] +extras_require = { + 'docs': [ + 'Sphinx>=1.3' + ] +} + if sys.version_info < (3, 2): - requires.append('futures>=2.2.0') + requires.append('futures>=3.0.0') classifiers = [ 'Development Status :: 4 - Beta', @@ -35,6 +40,7 @@ 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Internet', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Utilities' @@ -43,7 +49,7 @@ setup(name='python-gyazo', version=__version__, description='A Python wrapper for Gyazo API', - author=__author__, + author='Yusuke Miyazaki', author_email='miyazaki.dev@gmail.com', url='https://github.com/ymyzk/python-gyazo', license='MIT', @@ -52,4 +58,5 @@ scripts=['scripts/gyazo-backup'], test_suite='tests', install_requires=requires, + extras_require=extras_require, classifiers=classifiers) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..2d465d6 --- /dev/null +++ b/tox.ini @@ -0,0 +1,30 @@ +[tox] +envlist = py27, py32, py33, py34, pypy, pypy3, coverage, docs, flake8 + +[testenv] +commands = + pip install -e . + python setup.py test + +[testenv:coverage] +basepython = python2.7 +deps = + coveralls + coverage +commands = + pip install -e . + coverage run --source gyazo/ setup.py test + coverage report + coveralls + +[testenv:docs] +basepython = python2.7 +changedir = docs +commands = + pip install -e ..[docs] + make html + +[testenv:flake8] +basepython = python2.7 +deps = flake8 +commands = flake8 gyazo/