Skip to content

Commit

Permalink
Merge pull request #30 from spyder-ide/ci_tests_integration
Browse files Browse the repository at this point in the history
PR: Enable CircleCI and first tests addition
  • Loading branch information
andfoy committed Aug 19, 2017
2 parents 0bfd56a + e54528d commit 9819e58
Show file tree
Hide file tree
Showing 15 changed files with 1,244 additions and 119 deletions.
83 changes: 83 additions & 0 deletions .ciocheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# -----------------------------------------------------------------------------
# ciocheck
# https://github.com/ContinuumIO/ciocheck
# -----------------------------------------------------------------------------
[ciocheck]
branch = origin/master
diff_mode = commited
file_mode = all
check = pep8,pydocstyle
enforce = pep8,pydocstyle

# 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, E402,
max-line-length = 79

# -----------------------------------------------------------------------------
# pydocstyle
# http://www.pydocstyle.org/en/latest/usage.html#example
# -----------------------------------------------------------------------------
[pydocstyle]
exclude = */tests/foo.py
add-ignore = D203, D400
inherit = false

# -----------------------------------------------------------------------------
# Flake 8
# http://flake8.readthedocs.io/en/latest/config.html
# -----------------------------------------------------------------------------
[flake8]
exclude = */tests/*
ignore = E126, E402,
max-line-length = 79
max-complexity = 64

# -----------------------------------------------------------------------------
# pylint
# https://pylint.readthedocs.io/en/latest/
# -----------------------------------------------------------------------------
#[pylint:messages]

# -----------------------------------------------------------------------------
# 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 = spyder_notebook
known_third_party = qtpy, spyder
known_standard_library = mimetypes
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
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
omit = */tests/*

[report]
fail_under=0
File renamed without changes.
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include CHANGELOG.md
include CONTRIBUTORS.md
include LICENSE.txt
include README.rst
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# spyder-terminal
Spyder Plugin for executing Vim commands inside the code editor. We currently support the following keybindings and commands: https://github.com/spyder-ide/spyder-vim/issues/1

## Project Info
[![Project License](https://img.shields.io/pypi/l/spyder-vim.svg)](./LICENSE.txt)
[![pypi version](https://img.shields.io/pypi/v/spyder-vim.svg)](https://pypi.python.org/pypi/spyder-vim)

## Build status
[![CircleCI](https://circleci.com/gh/spyder-ide/spyder-vim.svg?style=svg)](https://circleci.com/gh/spyder-ide/spyder-vim)
[![Coverage Status](https://coveralls.io/repos/github/spyder-ide/spyder-vim/badge.svg?branch=master)](https://coveralls.io/github/spyder-ide/spyder-vim?branch=master)

## Installation
To install this plugin, you can use either ``pip`` or ``conda`` package managers, as it follows:

Using pip:
```
pip install spyder-vim
```

Using conda:
```
conda install spyder-vim -c spyder-ide
```

## Dependencies
This project depends on [Spyder](https://github.com/spyder-ide/spyder).

## Changelog
Visit our [CHANGELOG](CHANGELOG.md) file to know more about our new features and improvements.

## Development and contribution
Do you want to request a new keybind for the plugin? Please submit it to our [Commands](https://github.com/spyder-ide/spyder-vim/issues/1) issue page. Feel free to open a PR to implement it.

To start contributing to this project, you can execute ``pip install -U .`` to test your changes on Spyder. We follow PEP8 and PEP257 style guidelines.

# Overview
![alt tag](/doc/example.gif)
50 changes: 50 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# https://circleci.com/gh/spyder-ide/spyder-vim/

machine:
environment:
# Python versions to tests (Maximum of 4 different versions)
# The last container is used to test with pyqt5 wheels
PY_VERSIONS: "2.7 3.6 3.5"
# Environment variables used by astropy helpers
TRAVIS_OS_NAME: "linux"
CONDA_DEPENDENCIES_FLAGS: "--quiet"
CONDA_DEPENDENCIES: "pytest pytest-cov mock"
PIP_DEPENDENCIES: "coveralls coloredlogs pytest-qt pytest-xvfb flaky"

dependencies:
pre:
# We need to run a window manager to avoid focus problems when running our tests.
# See https://github.com/TestFX/TestFX/issues/158#issuecomment-62421691
- sudo apt-get install matchbox-window-manager
override:
# First convert PY_VERSIONS to an array and then select the python version based on the CIRCLE_NODE_INDEX
- export PY_VERSIONS=($PY_VERSIONS) &&
export TRAVIS_PYTHON_VERSION=${PY_VERSIONS[$CIRCLE_NODE_INDEX]} &&
echo -e "PYTHON = $TRAVIS_PYTHON_VERSION \n============" &&
git clone git://github.com/astropy/ci-helpers.git > /dev/null &&
source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh &&
export PATH="$HOME/miniconda/bin:$PATH" &&
source activate test &&
conda install -q ciocheck -c spyder-ide --no-update-deps &&
if [ "$CIRCLE_NODE_INDEX" = "2" ]; then pip install -q spyder pyqt5; else conda install -q -y spyder; fi &&
if [ "$CIRCLE_NODE_INDEX" = "2" ]; then pip uninstall -q -y spyder; else conda remove -q -y spyder; fi &&
mkdir spyder-source && cd spyder-source &&
wget -q https://github.com/spyder-ide/spyder/archive/3.x.zip && unzip -q 3.x.zip &&
cd spyder-3.x && python setup.py install > /dev/null &&
cd ../../ &&
pip install .;
- DISPLAY=:99 /usr/bin/matchbox-window-manager:
background: true
- sleep 5

test:
override:
# Style checks
- export PATH="$HOME/miniconda/bin:$PATH" && source activate test && ciocheck spyder_vim: # note the colon
parallel: true
# Tests
- export PATH="$HOME/miniconda/bin:$PATH" && source activate test && python runtests.py: # note the colon
parallel: true
# Coveralls
- export PATH="$HOME/miniconda/bin:$PATH" && source activate test && coveralls: # note the colon
parallel: true
Binary file added doc/example.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions runtests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#

"""
File for running tests programmatically.
"""

# Third party imports
import pytest


def main():
"""
Run pytest tests.
"""
errno = pytest.main(['-x', 'spyder_vim', '-v',
'-rw', '--durations=10',
'--cov=spyder_vim', '--cov-report=term-missing'])

# sys.exit doesn't work here because some things could be running
# in the background (e.g. closing the main window) when this point
# is reached. And if that's the case, sys.exit does't stop the
# script (as you would expected).
if errno != 0:
raise SystemExit(errno)


if __name__ == '__main__':
main()
61 changes: 45 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,67 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup script for spyderplugins.p_autopep8
"""
from setuptools import setup, find_packages
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------

"""Setup script for spyder_vim"""

def readme():
return str(open('README.rst').read())
# Standard library imports
import ast
import os

# Third party imports
from setuptools import find_packages, setup

HERE = os.path.abspath(os.path.dirname(__file__))


def get_version(module='spyder_vim'):
"""Get version."""
with open(os.path.join(HERE, module, '__init__.py'), 'r') as f:
data = f.read()
lines = data.split('\n')
for line in lines:
if line.startswith('VERSION_INFO'):
version_tuple = ast.literal_eval(line.split('=')[-1].strip())
version = '.'.join(map(str, version_tuple))
break
return version


def get_description():
"""Get long description."""
with open(os.path.join(HERE, 'README.rst'), 'r') as f:
data = f.read()
return data


REQUIREMENTS = ['spyder>=3.2.0']

setup(
name='spyder.vim',
version="0.1.0",
name='spyder-vim',
version=get_version(),
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
keywords=["spyder ide plugin addon vi vim"],
url='https://github.com/Nodd/spyderplugins.vim',
keywords=['Spyder', 'Plugin', 'Vim'],
url='https://github.com/spyder-ide/spyder-vim',
license='MIT',
author='Joseph Martinot-Lagarde',
author_email='contrebasse@gmail.com',
description='A plugin to enable vim keybingins to the spyder editor',
long_description=readme(),
install_requires=['spyder>=2.3'],
long_description=get_description(),
install_requires=REQUIREMENTS,
include_package_data=True,
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: X11 Applications :: Qt',
'Environment :: Win32 (MS Windows)',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Software Development :: Widget Sets'])
13 changes: 12 additions & 1 deletion spyder_vim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# -*- coding: utf-8 -*-
# The following statement is required to register this 3rd party plugin
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Spyder Vim Plugin."""

from .vim import Vim as PLUGIN_CLASS # pylint: disable=C0103
PLUGIN_CLASS

VERSION_INFO = (0, 1, 0, 'dev0')
__version__ = '.'.join(map(str, VERSION_INFO))
40 changes: 0 additions & 40 deletions spyder_vim/test/test_vim.py

This file was deleted.

5 changes: 5 additions & 0 deletions spyder_vim/tests/foo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
123
line 1
line 2
line 3
line 4

0 comments on commit 9819e58

Please sign in to comment.