Skip to content

Commit

Permalink
global: preparation for beta release
Browse files Browse the repository at this point in the history
* Requires Flask>=0.11 and removes dependency on Flask-CLI.

* Adds missing deployment condition.

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
  • Loading branch information
jirikuncar committed Aug 10, 2016
1 parent e30d56a commit 3510345
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio-DB
# Copyright (C) 2015 CERN
# This file is part of Invenio.
# Copyright (C) 2015, 2016 CERN
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio-DB
# Copyright (C) 2015 CERN
# This file is part of Invenio.
# Copyright (C) 2015, 2016 CERN
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -85,3 +85,4 @@ deploy:
on:
tags: true
python: "2.7"
condition: $REQUIREMENTS = release
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
..
This file is part of Invenio.
Copyright (C) 2015 CERN.
Copyright (C) 2015, 2016 CERN.
Invenio is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
Expand Down
21 changes: 16 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand All @@ -27,7 +27,7 @@
import os

import sphinx.environment
from docutils.utils import get_source_line


# -- General configuration ------------------------------------------------

Expand Down Expand Up @@ -65,7 +65,7 @@
# General information about the project.
project = u'Invenio-DB'
copyright = u'2015, CERN'
author = u'Invenio Collaboration'
author = u'CERN'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -189,7 +189,15 @@
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html',
'searchbox.html',
'donate.html',
]
}

# Additional templates that should be rendered to pages, maps page names to
# template names.
Expand Down Expand Up @@ -259,7 +267,7 @@
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'invenio-db.tex', u'invenio-db Documentation',
u'Invenio Collaboration', 'manual'),
u'CERN', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -322,3 +330,6 @@

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}

# Autodoc configuraton.
autoclass_content = 'both'
5 changes: 0 additions & 5 deletions example/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,4 @@
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get(
'SQLALCHEMY_DATABASE_URI', 'sqlite:///test.db'
)

if not hasattr(app, 'cli'):
from flask_cli import FlaskCLI
FlaskCLI(app)

InvenioDB(app)
8 changes: 2 additions & 6 deletions invenio_db/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand All @@ -25,20 +25,16 @@
"""Database management for Invenio.
First make sure you have Flask application with Click support (meaning
Flask 1.0+ or alternatively use the Flask-CLI extension):
Flask 0.11+):
>>> from flask import Flask
>>> app = Flask('myapp')
>>> if not hasattr(app, 'cli'):
... from flask_cli import FlaskCLI
... cli = FlaskCLI(app)
Next, initialize your extension:
>>> from invenio_db import InvenioDB
>>> db = InvenioDB(app)
Command-line interface
~~~~~~~~~~~~~~~~~~~~~~
Invenio-DB installs the ``db`` command group on your application with the
Expand Down
6 changes: 1 addition & 5 deletions invenio_db/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,11 @@
import click
from click import _termui_impl
from flask import current_app
from flask.cli import with_appcontext
from sqlalchemy_utils.functions import create_database, database_exists, \
drop_database
from werkzeug.local import LocalProxy

try:
from flask.cli import with_appcontext
except ImportError: # pragma: no cover
from flask_cli import with_appcontext

_db = LocalProxy(lambda: current_app.extensions['sqlalchemy'].db)

# Fix Python 3 compatibility issue in click
Expand Down
2 changes: 1 addition & 1 deletion invenio_db/ext.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand Down
2 changes: 1 addition & 1 deletion invenio_db/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@

from __future__ import absolute_import, print_function

__version__ = "1.0.0a11.dev20160704"
__version__ = "1.0.0b1.dev20160809"
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
]

install_requires = [
'Flask-CLI>=0.2.1',
'Flask>=0.11',
'Flask-SQLAlchemy>=2.0',
'SQLAlchemy>=1.0',
'SQLAlchemy-Utils>=0.31.0',
Expand Down Expand Up @@ -125,6 +125,6 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Development Status :: 1 - Planning',
'Development Status :: 4 - Beta',
],
)
9 changes: 1 addition & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@

import pytest
from flask import Flask

try:
from flask.cli import ScriptInfo
except ImportError:
from flask_cli import ScriptInfo
from flask.cli import ScriptInfo


@pytest.fixture()
Expand All @@ -56,9 +52,6 @@ def app():
SQLALCHEMY_DATABASE_URI=os.environ.get('SQLALCHEMY_DATABASE_URI',
'sqlite:///test.db')
)
if not hasattr(app, 'cli'):
from flask_cli import FlaskCLI
FlaskCLI(app)
return app


Expand Down

0 comments on commit 3510345

Please sign in to comment.