diff --git a/.ciocheck b/.ciocheck new file mode 100644 index 00000000..6c06a602 --- /dev/null +++ b/.ciocheck @@ -0,0 +1,107 @@ +# ----------------------------------------------------------------------------- +# ciocheck +# https://github.com/ContinuumIO/ciocheck +# ----------------------------------------------------------------------------- +[ciocheck] +branch = origin/master +diff_mode = commited +file_mode = all +check = pep8,pydocstyle,flake8,pylint + +# Python (pyformat) +add_copyright = true +add_header = true +add_init = true + +# ----------------------------------------------------------------------------- +# pep8 +# http://pep8.readthedocs.io/en/latest/intro.html#configuration +# ----------------------------------------------------------------------------- +[pep8] +exclude = */tests/* +ignore = E126 +max-line-length = 79 + +# ----------------------------------------------------------------------------- +# pydocstyle +# http://www.pydocstyle.org/en/latest/usage.html#example +# ----------------------------------------------------------------------------- +[pydocstyle] +add-ignore = D203 +inherit = false + +# ----------------------------------------------------------------------------- +# Flake 8 +# http://flake8.readthedocs.io/en/latest/config.html +# ----------------------------------------------------------------------------- +[flake8] +exclude = */tests/* +ignore = E126,F401 +max-line-length = 79 +max-complexity = 64 + +# ----------------------------------------------------------------------------- +# pylint +# https://pylint.readthedocs.io/en/latest/ +# ----------------------------------------------------------------------------- +[pylint:messages] +disable=unused-import + +# ----------------------------------------------------------------------------- +# isort +# https://github.com/timothycrosley/isort/wiki/isort-Settings +# ----------------------------------------------------------------------------- +[isort] +from_first = true +import_heading_stdlib = Standard library imports +import_heading_firstparty = Local imports +import_heading_thirdparty = Third party imports +indent = ' ' +known_first_party = qtpy +known_third_party = PySide, PyQt4, PyQt5 +line_length = 79 +sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER + +# ----------------------------------------------------------------------------- +# yapf +# https://github.com/google/yapf#formatting-style +# ----------------------------------------------------------------------------- +[yapf:style] +based_on_style = pep8 +column_limit = 79 +spaces_before_comment = 2 + +# ----------------------------------------------------------------------------- +# autopep8 +# http://pep8.readthedocs.io/en/latest/intro.html#configuration +# ----------------------------------------------------------------------------- +[autopep8] +exclude = */tests/* +ignore = E126, +max-line-length = 79 + +# ----------------------------------------------------------------------------- +# Coverage +# http://coverage.readthedocs.io/en/latest/config.html +# ----------------------------------------------------------------------------- +[coverage:run] +omit = + */tests/* + */build/* + +[coverage:report] +fail_under = 0 +show_missing = true +skip_covered = true +exclude_lines = + pragma: no cover + def test(): + if __name__ == .__main__.: + +# ----------------------------------------------------------------------------- +# pytest +# http://doc.pytest.org/en/latest/usage.html +# ----------------------------------------------------------------------------- +[pytest] +addopts = -rfew --durations=10 +python_functions = test_* \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index bc3c5323..15573370 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,12 @@ branches: - master os: - - linux - osx env: global: - SETUP_XVFB=True - - CONDA_CHANNELS="qttesting" + - CONDA_CHANNELS="conda-forge" - CONDA_DEPENDENCIES="pytest pytest-cov" - PIP_DEPENDENCIES="coveralls" @@ -43,11 +42,10 @@ before_install: install: - git clone git://github.com/astropy/ci-helpers.git - source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh - - python setup.py install + - python setup.py develop script: - python qtpy/tests/runtests.py after_success: - coveralls - diff --git a/LICENSE.txt b/LICENSE.txt index 4152f523..4a791817 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Gonzalo Peña-Castellanos +Copyright (c) The Spyder Development Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..f7532292 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include AUTHORS.md +include CHANGELOG.md +include LICENSE.txt +include README.md \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 52ce588e..be164b79 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -34,6 +34,15 @@ platform: -x64 install: + # If there is a newer build queued for the same PR, cancel this one. + # The AppVeyor 'rollout builds' option is supposed to serve the same + # purpose but it is problematic because it tends to cancel builds pushed + # directly to master instead of just PR builds (or the converse). + # credits: JuliaLang developers. + - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` + https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` + Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` + throw "There are newer queued builds for this pull request, failing early." } - "git clone git://github.com/astropy/ci-helpers.git" - "powershell ci-helpers/appveyor/install-miniconda.ps1" - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" @@ -45,4 +54,3 @@ build: false test_script: - "%CMD_IN_ENV% python qtpy/tests/runtests.py" - diff --git a/circle.yml b/circle.yml index ef97c02c..16332260 100644 --- a/circle.yml +++ b/circle.yml @@ -1,34 +1,42 @@ # https://circleci.com/gh/spyder-ide/qtpy/ - machine: environment: # Used by test scripts TEST_CI: "True" - PYTHON_TEST: "$HOME/miniconda/envs/test/bin/python" - PYTEST: "$HOME/miniconda/envs/test/bin/py.test" - PATH: "$HOME/miniconda/bin:$PATH" # To avoid prepending this to the commands on circle-ci # Python versions to test (Maximum of 4 different versions for now) - PY_VERSIONS: "2.7 3.4 3.5" + PY_VERSIONS: "3.5 3.4 2.7" # Used by astropy-ci helpers TRAVIS_OS_NAME: "linux" - CONDA_CHANNELS: "qttesting" - CONDA_DEPENDENCIES: "pyqt pytest pytest-cov qt" PIP_DEPENDENCIES: "coveralls" dependencies: override: - # First convert PY_VERSIONS to an array and then select the Python version based on the - # CIRCLE_NODE_INDEX + # First convert PY_VERSIONS to an array and then select the Python version + # based on the CIRCLE_NODE_INDEX - PY_VERSIONS=($PY_VERSIONS) && TRAVIS_PYTHON_VERSION=${PY_VERSIONS[$CIRCLE_NODE_INDEX]} && echo -e "PYTHON = $TRAVIS_PYTHON_VERSION \n============" && git clone git://github.com/astropy/ci-helpers.git && source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh && - "$PYTHON_TEST" setup.py install; + export PATH="$HOME/miniconda/bin:$PATH" && + source activate test && + conda install -q ciocheck -c spyder-ide && + python setup.py develop; test: override: - - conda info --json: # note the colon + # Check style + - export PATH="$HOME/miniconda/bin:$PATH" && source activate test && ciocheck qtpy: # note the colon + parallel: true + # Check PyQt5 + - export PATH="$HOME/miniconda/bin:$PATH" && source activate test && conda install -q qt=5.* pyqt=5.* && python qtpy/tests/runtests.py: # note the colon parallel: true - - "$PYTHON_TEST qtpy/tests/runtests.py": # note the colon + # Check PySide2 +# - export PATH="$HOME/miniconda/bin:$PATH" && source activate test && conda install -q qt=5.* pyside2 && python qtpy/tests/runtests.py: # note the colon +# parallel: true + # Check PyQt4 + - export PATH="$HOME/miniconda/bin:$PATH" && source activate test && conda install -q qt=4.* pyqt=4.* && python qtpy/tests/runtests.py: # note the colon parallel: true + # Check Pyside + #- export PATH="$HOME/miniconda/bin:$PATH" && source activate test && conda remove -q qt pyqt && conda install -c conda-forge qt=4.* pyside && python qtpy/tests/runtests.py: # note the colon + # parallel: true diff --git a/qtpy/QtSvg.py b/qtpy/QtSvg.py index 3cf76113..0bc73205 100644 --- a/qtpy/QtSvg.py +++ b/qtpy/QtSvg.py @@ -11,14 +11,11 @@ from . import PYQT4, PYQT5, PYSIDE, PythonQtError if PYQT5: - from PyQt5.QtSvg import (QGraphicsSvgItem, QSvgGenerator, QSvgRenderer, - QSvgWidget) + from PyQt5.QtSvg import * elif PYQT4: - from PyQt4.QtSvg import (QGraphicsSvgItem, QSvgGenerator, QSvgRenderer, - QSvgWidget) + from PyQt4.QtSvg import * elif PYSIDE: - from PySide.QtSvg import (QGraphicsSvgItem, QSvgGenerator, QSvgRenderer, - QSvgWidget) + from PySide.QtSvg import * else: raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/_patch/qheaderview.py b/qtpy/_patch/qheaderview.py index 8bef8395..99cd20a7 100644 --- a/qtpy/_patch/qheaderview.py +++ b/qtpy/_patch/qheaderview.py @@ -1,3 +1,10 @@ +# -*- coding: utf-8 -*- +# +# Copyright © The Spyder Development Team +# +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) + def introduce_renamed_methods_qheaderview(QHeaderView): _isClickable = QHeaderView.isClickable