diff --git a/.travis.yml b/.travis.yml index f229dfa..cb8e556 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,9 +49,13 @@ env: python: - "2.7" - - "3.3" - - "3.4" - "3.5" + - "pypy" + +matrix: + fast_finish: true + allow_failures: + - python: pypy before_install: - "travis_retry pip install --upgrade pip setuptools py" diff --git a/.tx/config b/.tx/config deleted file mode 100644 index 201cb4d..0000000 --- a/.tx/config +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of Invenio. -# Copyright (C) 2016 CERN. -# -# Invenio is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# Invenio is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Invenio; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307, USA. -# -# In applying this license, CERN does not -# waive the privileges and immunities granted to it by virtue of its status -# as an Intergovernmental Organization or submit itself to any jurisdiction. - - -# TODO: Transifex integration -# -# 1) Create message catalog: -# $ python setup.py extract_messages -# $ python setup.py init_catalog -l -# $ python setup.py compile_catalog -# 2) Ensure project has been created on Transifex under the inveniosoftware -# organisation. -# 3) Install the transifex-client -# $ pip install transifex-client -# 4) Push source (.pot) and translations (.po) to Transifex -# $ tx push -s -t -# 5) Pull translations for a single language from Transifex -# $ tx pull -l -# 6) Pull translations for all languages from Transifex -# $ tx pull -a - -[main] -host = https://www.transifex.com - -[invenio-indexer.messagespot] -file_filter = invenio_indexer/translations//LC_MESSAGES/messages.po -source_file = invenio_indexer/translations/messages.pot -source_lang = en -type = PO diff --git a/AUTHORS.rst b/AUTHORS.rst index babacbc..3e184c6 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -31,3 +31,4 @@ Indexer for Invenio. - Jiri Kuncar - Leonardo Rossi - Javier Martin Montull +- Alizee Pace diff --git a/MANIFEST.in b/MANIFEST.in index dbf9c04..805f755 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -27,8 +27,6 @@ include *.sh include *.txt include .dockerignore include .editorconfig -include .tx/config -include babel.ini include LICENSE include pytest.ini recursive-include docs *.bat @@ -38,7 +36,6 @@ recursive-include docs Makefile recursive-include examples *.json recursive-include examples *.py recursive-include examples *.sh -recursive-include invenio_indexer *.po *.pot *.mo recursive-include invenio_indexer *.py recursive-include tests *.json recursive-include tests *.py diff --git a/babel.ini b/babel.ini deleted file mode 100644 index 97baedf..0000000 --- a/babel.ini +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of Invenio. -# Copyright (C) 2016 CERN. -# -# Invenio is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# Invenio is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Invenio; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307, USA. -# -# In applying this license, CERN does not -# waive the privileges and immunities granted to it by virtue of its status -# as an Intergovernmental Organization or submit itself to any jurisdiction. - -# Extraction from Python source files - -[python: **.py] -encoding = utf-8 - -# Extraction from Jinja2 templates - -[jinja2: **/templates/**.html] -encoding = utf-8 -extensions = jinja2.ext.autoescape, jinja2.ext.with_ - -# Extraction from JavaScript files - -[javascript: **.js] -encoding = utf-8 -extract_messages = $._, jQuery._ diff --git a/docs/conf.py b/docs/conf.py index 8a7ee5c..9cfb69c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -137,8 +137,8 @@ 'github_banner': True, 'show_powered_by': False, 'extra_nav_links': { - 'invenio-indexer@GitHub': 'http://github.com/inveniosoftware/invenio-indexer', - 'invenio-indexer@PyPI': 'http://pypi.python.org/pypi/invenio-indexer/', + 'invenio-indexer@GitHub': 'https://github.com/inveniosoftware/invenio-indexer', + 'invenio-indexer@PyPI': 'https://pypi.python.org/pypi/invenio-indexer/', } } @@ -328,4 +328,9 @@ # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/': None} +intersphinx_mapping = { + 'python': ('https://docs.python.org/', None), + 'kombu': ('http://docs.celeryproject.org/projects/kombu/en/latest/', None), +} +# Autodoc configuraton. +autoclass_content = 'both' diff --git a/docs/index.rst b/docs/index.rst index b1efb1c..5990d92 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -28,7 +28,7 @@ User's Guide ------------ This part of the documentation will show you how to get started in using -Invenio-Base. +Invenio-Indexer. .. toctree:: :maxdepth: 2 diff --git a/examples/app.py b/examples/app.py index 2d0325f..3682445 100644 --- a/examples/app.py +++ b/examples/app.py @@ -48,7 +48,6 @@ from flask import Flask from flask_celeryext import FlaskCeleryExt -from flask_cli import FlaskCLI from invenio_db import InvenioDB, db from invenio_records import InvenioRecords from invenio_records.api import Record @@ -71,7 +70,6 @@ 'sqlite:///app.db'), ) -FlaskCLI(app) FlaskCeleryExt(app) InvenioDB(app) InvenioRecords(app) diff --git a/invenio_indexer/__init__.py b/invenio_indexer/__init__.py index d2e90d7..55cc85c 100644 --- a/invenio_indexer/__init__.py +++ b/invenio_indexer/__init__.py @@ -33,14 +33,11 @@ Initialization -------------- -First create a Flask application (Flask-CLI is not needed for Flask -version 1.0+): +First create a Flask application: >>> from flask import Flask ->>> from flask_cli import FlaskCLI >>> app = Flask('myapp') >>> app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://' ->>> ext_cli = FlaskCLI(app) You initialize Indexer like a normal Flask extension, however Invenio-Indexer is dependent on Invenio-Records and Invenio-Search so you diff --git a/invenio_indexer/cli.py b/invenio_indexer/cli.py index 09e6187..73b654e 100644 --- a/invenio_indexer/cli.py +++ b/invenio_indexer/cli.py @@ -29,7 +29,7 @@ import click from celery.messaging import establish_connection from flask import current_app -from flask_cli import with_appcontext +from flask.cli import with_appcontext from invenio_records.models import RecordMetadata from invenio_search.cli import index diff --git a/setup.cfg b/setup.cfg index 5af0cfb..5ab9cba 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,6 +23,9 @@ # as an Intergovernmental Organization or submit itself to any jurisdiction. +[aliases] +test = pytest + [build_sphinx] source-dir = docs/ build-dir = docs/_build @@ -30,21 +33,3 @@ all_files = 1 [bdist_wheel] universal = 1 - -[compile_catalog] -directory = invenio_indexer/translations/ - -[extract_messages] -copyright_holder = CERN -msgid_bugs_address = info@inveniosoftware.org -mapping-file = babel.ini -output-file = invenio_indexer/translations/messages.pot -add-comments = NOTE - -[init_catalog] -input-file = invenio_indexer/translations/messages.pot -output-dir = invenio_indexer/translations/ - -[update_catalog] -input-file = invenio_indexer/translations/messages.pot -output-dir = invenio_indexer/translations/ diff --git a/setup.py b/setup.py index acc485e..6506b95 100644 --- a/setup.py +++ b/setup.py @@ -25,10 +25,8 @@ """Indexer for Invenio.""" import os -import sys from setuptools import find_packages, setup -from setuptools.command.test import test as TestCommand readme = open('README.rst').read() history = open('CHANGES.rst').read() @@ -58,7 +56,12 @@ for reqs in extras_require.values(): extras_require['all'].extend(reqs) +setup_requires = [ + 'pytest-runner>=2.6.2', +] + install_requires = [ + 'Flask>=0.11.1', 'celery>=3.1.19', 'invenio-records>=1.0.0a8', 'invenio-search>=1.0.0a4', @@ -67,40 +70,6 @@ packages = find_packages() - -class PyTest(TestCommand): - """PyTest Test.""" - - user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] - - def initialize_options(self): - """Init pytest.""" - TestCommand.initialize_options(self) - self.pytest_args = [] - try: - from ConfigParser import ConfigParser - except ImportError: - from configparser import ConfigParser - config = ConfigParser() - config.read('pytest.ini') - self.pytest_args = config.get('pytest', 'addopts').split(' ') - - def finalize_options(self): - """Finalize pytest.""" - TestCommand.finalize_options(self) - if hasattr(self, '_test_args'): - self.test_suite = '' - else: - self.test_args = [] - self.test_suite = True - - def run_tests(self): - """Run tests.""" - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(self.pytest_args) - sys.exit(errno) - # Get the version string. Cannot be done with import! g = {} with open(os.path.join('invenio_indexer', 'version.py'), 'rt') as fp: @@ -134,6 +103,7 @@ def run_tests(self): }, extras_require=extras_require, install_requires=install_requires, + setup_requires=setup_requires, tests_require=tests_require, classifiers=[ 'Environment :: Web Environment', @@ -146,10 +116,9 @@ def run_tests(self): '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 :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', 'Development Status :: 1 - Planning', ], - cmdclass={'test': PyTest}, ) diff --git a/tests/conftest.py b/tests/conftest.py index 81401e7..2808da6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -33,8 +33,8 @@ import pytest from celery.messaging import establish_connection from flask import Flask +from flask.cli import ScriptInfo from flask_celeryext import FlaskCeleryExt -from flask_cli import FlaskCLI, ScriptInfo from invenio_db import InvenioDB, db from invenio_records import InvenioRecords from invenio_search import InvenioSearch @@ -62,7 +62,6 @@ def app(request): SQLALCHEMY_TRACK_MODIFICATIONS=True, TESTING=True, ) - FlaskCLI(app) FlaskCeleryExt(app) InvenioDB(app) InvenioRecords(app) diff --git a/tests/test_utils.py b/tests/test_utils.py index 17446e5..80c82e1 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -28,7 +28,7 @@ from __future__ import absolute_import, print_function from click.testing import CliRunner -from flask_cli import ScriptInfo +from flask.cli import ScriptInfo from flask_sqlalchemy import models_committed from invenio_db import db from invenio_search.cli import index as cmd