From 2a61e4c0d69ce731f0cdb121ed47bed8d89a1bcf Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Tue, 18 Oct 2016 13:09:02 +0200 Subject: [PATCH 1/3] Remove scaffold from repo (fixes #388) --- MANIFEST.in | 2 - cornice/scaffolds/__init__.py | 21 --------- cornice/scaffolds/cornice/+package+.ini_tmpl | 45 ------------------- .../cornice/+package+/__init__.py_tmpl | 10 ----- .../scaffolds/cornice/+package+/views.py_tmpl | 12 ----- cornice/scaffolds/cornice/README.rst_tmpl | 4 -- cornice/scaffolds/cornice/setup.py_tmpl | 32 ------------- docs/source/quickstart.rst | 4 +- docs/source/tutorial.rst | 26 ++--------- setup.py | 13 +----- 10 files changed, 8 insertions(+), 161 deletions(-) delete mode 100755 cornice/scaffolds/__init__.py delete mode 100755 cornice/scaffolds/cornice/+package+.ini_tmpl delete mode 100755 cornice/scaffolds/cornice/+package+/__init__.py_tmpl delete mode 100755 cornice/scaffolds/cornice/+package+/views.py_tmpl delete mode 100755 cornice/scaffolds/cornice/README.rst_tmpl delete mode 100755 cornice/scaffolds/cornice/setup.py_tmpl diff --git a/MANIFEST.in b/MANIFEST.in index 95316ce6..22270aee 100755 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,3 @@ include *.txt include *.rst include LICENSE -recursive-include cornice/scaffolds *.* -recursive-include cornice/tests *.rx diff --git a/cornice/scaffolds/__init__.py b/cornice/scaffolds/__init__.py deleted file mode 100755 index 8c70804e..00000000 --- a/cornice/scaffolds/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this file, -# You can obtain one at http://mozilla.org/MPL/2.0/. -try: # pyramid 1.0.X - # "pyramid.paster.paste_script..." doesn't exist past 1.0.X - from pyramid.paster import paste_script_template_renderer - from pyramid.paster import PyramidTemplate -except ImportError: - try: # pyramid 1.1.X, 1.2.X - # trying to import "paste_script_template_renderer" fails on 1.3.X - from pyramid.scaffolds import paste_script_template_renderer - from pyramid.scaffolds import PyramidTemplate - except ImportError: # pyramid >=1.3a2 - paste_script_template_renderer = None # NOQA - from pyramid.scaffolds import PyramidTemplate # NOQA - - -class CorniceTemplate(PyramidTemplate): - _template_dir = 'cornice' - summary = "A Cornice application" - template_renderer = staticmethod(paste_script_template_renderer) diff --git a/cornice/scaffolds/cornice/+package+.ini_tmpl b/cornice/scaffolds/cornice/+package+.ini_tmpl deleted file mode 100755 index a1766653..00000000 --- a/cornice/scaffolds/cornice/+package+.ini_tmpl +++ /dev/null @@ -1,45 +0,0 @@ -[app:main] -use = egg:{{project}} - -pyramid.reload_templates = true -pyramid.debug_authorization = false -pyramid.debug_notfound = false -pyramid.debug_routematch = false -pyramid.debug_templates = true -pyramid.default_locale_name = en - -[server:main] -use = egg:waitress#main -host = 0.0.0.0 -port = 6543 - -# Begin logging configuration - -[loggers] -keys = root, {{project}} - -[handlers] -keys = console - -[formatters] -keys = generic - -[logger_root] -level = INFO -handlers = console - -[logger_{{project}}] -level = DEBUG -handlers = -qualname = {{package}} - -[handler_console] -class = StreamHandler -args = (sys.stderr,) -level = NOTSET -formatter = generic - -[formatter_generic] -format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s - -# End logging configuration diff --git a/cornice/scaffolds/cornice/+package+/__init__.py_tmpl b/cornice/scaffolds/cornice/+package+/__init__.py_tmpl deleted file mode 100755 index 225a2f70..00000000 --- a/cornice/scaffolds/cornice/+package+/__init__.py_tmpl +++ /dev/null @@ -1,10 +0,0 @@ -"""Main entry point -""" -from pyramid.config import Configurator - - -def main(global_config, **settings): - config = Configurator(settings=settings) - config.include("cornice") - config.scan("{{package}}.views") - return config.make_wsgi_app() diff --git a/cornice/scaffolds/cornice/+package+/views.py_tmpl b/cornice/scaffolds/cornice/+package+/views.py_tmpl deleted file mode 100755 index f74c065e..00000000 --- a/cornice/scaffolds/cornice/+package+/views.py_tmpl +++ /dev/null @@ -1,12 +0,0 @@ -""" Cornice services. -""" -from cornice import Service - - -hello = Service(name='hello', path='/', description="Simplest app") - - -@hello.get() -def get_info(request): - """Returns Hello in JSON.""" - return {'Hello': 'World'} diff --git a/cornice/scaffolds/cornice/README.rst_tmpl b/cornice/scaffolds/cornice/README.rst_tmpl deleted file mode 100755 index 32e7e56a..00000000 --- a/cornice/scaffolds/cornice/README.rst_tmpl +++ /dev/null @@ -1,4 +0,0 @@ -Documentation -============= - -Put a brief description of '{{project}}'. diff --git a/cornice/scaffolds/cornice/setup.py_tmpl b/cornice/scaffolds/cornice/setup.py_tmpl deleted file mode 100755 index 363a37f3..00000000 --- a/cornice/scaffolds/cornice/setup.py_tmpl +++ /dev/null @@ -1,32 +0,0 @@ -import os -from setuptools import setup, find_packages - -here = os.path.abspath(os.path.dirname(__file__)) - -with open(os.path.join(here, 'README.rst')) as f: - README = f.read() - - -setup(name='{{project}}', - version=0.1, - description='{{project}}', - long_description=README, - classifiers=[ - "Programming Language :: Python", - "Framework :: Pylons", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Internet :: WWW/HTTP :: WSGI :: Application" - ], - keywords="web services", - author='', - author_email='', - url='', - packages=find_packages(), - include_package_data=True, - zip_safe=False, - install_requires=['cornice', 'waitress'], - entry_points = """\ - [paste.app_factory] - main={{package}}:main - """, - paster_plugins=['pyramid']) diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index f9fb1460..bcc4d831 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -9,9 +9,9 @@ To use Cornice, install it:: $ pip install cornice -That'll give you a Paster template to use:: +You can use a `Cookiecutter `_ project template:: - $ pcreate -t cornice project + $ cookiecutter gh:Cornices/cookiecutter-cornice ... The template creates a working Cornice application. diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 97e329ce..3cc7b105 100755 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -53,29 +53,11 @@ Once you have it, install Cornice in it with Pip:: $ bin/pip install cornice -Cornice provides a Paster Template you can use to create a new -application:: - - $ bin/pcreate -t cornice messaging - Creating directory <...path ...>/messaging - Recursing into +package+ - Creating <...path ...>/messaging/messaging/ - Copying __init__.py_tmpl to <...path ...>/messaging/messaging/__init__.py - Copying views.py_tmpl to <...path ...>/messaging/messaging/views.py - Copying +package+.ini_tmpl to <...path ...>/messaging/messaging.ini - Copying README.rst_tmpl to <...path ...>/messaging/README.rst - Copying setup.py_tmpl to <...path ...>/messaging/setup.py - - =============================================================================== - Tutorials: http://docs.pylonsproject.org/projects/pyramid_tutorials - Documentation: http://docs.pylonsproject.org/projects/pyramid - - Twitter (tips & updates): http://twitter.com/pylons - Mailing List: http://groups.google.com/group/pylons-discuss - - Welcome to Pyramid. Sorry for the convenience. - =============================================================================== +We provide a `Cookiecutter `_ template you +can use to create a new application:: + $ bin/pip install cookiecutter + $ bin/cookiecutter gh:Cornices/cookiecutter-cornice -o messaging Once your application is generated, go there and call *develop* against it:: diff --git a/setup.py b/setup.py index d6e192a5..5aafe2dd 100755 --- a/setup.py +++ b/setup.py @@ -11,17 +11,8 @@ requires = ['pyramid', 'simplejson'] -entry_points = """\ -[paste.paster_create_template] -cornice=cornice.scaffolds:CorniceTemplate -[pyramid.scaffold] -cornice=cornice.scaffolds:CorniceTemplate -""" - -package_data = { - "cornice.scaffolds": [ - "cornice/*.*", - "cornice/+package+/*.*"]} +entry_points = "" +package_data = {} setup(name='cornice', version='1.3.0.dev0', From 4370e7a5982f28ba42aaac59fb2d0c376d69c773 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Tue, 18 Oct 2016 14:55:22 +0200 Subject: [PATCH 2/3] Fix cookiecutter output --- docs/source/tutorial.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 3cc7b105..39f371d2 100755 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -57,7 +57,9 @@ We provide a `Cookiecutter `_ template you can use to create a new application:: $ bin/pip install cookiecutter - $ bin/cookiecutter gh:Cornices/cookiecutter-cornice -o messaging + $ bin/cookiecutter gh:Cornices/cookiecutter-cornice + repo_name [myapp]: messaging + project_title [My Cornice application.]: Cornice tutorial Once your application is generated, go there and call *develop* against it:: From f6cd967d7f5d8f526c58437c1adacf8e41a5d1c8 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Wed, 19 Oct 2016 12:01:19 +0200 Subject: [PATCH 3/3] Mention project template in upgrading docs --- docs/source/upgrading.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/source/upgrading.rst b/docs/source/upgrading.rst index d1949cf4..2e974947 100644 --- a/docs/source/upgrading.rst +++ b/docs/source/upgrading.rst @@ -4,6 +4,14 @@ Upgrading 1.X to 2.X ========== +Project template +---------------- + +We now rely on `Cookiecutter `_ instead of +the deprecated Pyramid scaffolding feature:: + + $ cookiecutter gh:Cornices/cookiecutter-cornice + Validators ---------- @@ -122,4 +130,3 @@ After: schema = [kwargs['schema'] for method, view, kwargs in service.definitions if method == "POST"][0] -