Skip to content
Myr

update project metadata

Before adoption: this commit came in with the history the project adopted, so no landing records it.

new readme readme as setup.py long_description links in changes git in authors add travis osx env break out docs build in travis remove python_requires for now

authored by David Lord · committed by David Lord · parent f9c6f38 · Browse files · 16 files+309 added−652 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

16 files+309 added−652 removed

  • other:+309 added−652 removed

16 files+309 added−652 removed

modified:docs/index.rst+14 added-19 removed
2 unmodified lines
3Welcome to Flask4================56.. image:: _static/logo-full.png7 :alt: Flask: web development, one drop at a time8 :class: floatingflask7 :alt: Flask: web development, one drop at a time8 :class: floatingflask910Welcome to Flask's documentation. This documentation is divided into11different parts. I recommend that you get started with12:ref:`installation` and then head over to the :ref:`quickstart`.13Besides the quickstart, there is also a more detailed :ref:`tutorial` that14shows how to create a complete (albeit small) application with Flask. If15you'd rather dive into the internals of Flask, check out16the :ref:`api` documentation. Common patterns are described in the17:ref:`patterns` section.10Welcome to Flask's documentation. Get started with :ref:`installation`11and then get an overview with the :ref:`quickstart`. There is also a12more detailed :ref:`tutorial` that shows how to create a small but13complete application with Flask. Common patterns are described in the14:ref:`patterns` section. The rest of the docs desribe each component of15Flask in detail, with a full reference in the :ref:`api` section.1619Flask depends on two external libraries: the `Jinja2`_ template20engine and the `Werkzeug`_ WSGI toolkit. These libraries are not documented21here. If you want to dive into their documentation, check out the22following links:17Flask depends on the `Jinja`_ template engine and the `Werkzeug`_ WSGI18toolkit. The documentation for these libraries can be found at:1924- `Jinja2 Documentation <http://jinja.pocoo.org/docs>`_25- `Werkzeug Documentation <http://werkzeug.pocoo.org/docs>`_20- `Jinja documentation <http://jinja.pocoo.org/docs>`_21- `Werkzeug documentation <http://werkzeug.pocoo.org/docs>`_2223.. _Jinja: https://www.palletsprojects.com/p/jinja/24.. _Werkzeug: https://www.palletsprojects.com/p/werkzeug/2528.. _Jinja2: http://jinja.pocoo.org/29.. _Werkzeug: http://werkzeug.pocoo.org/3026.. include:: contents.rst.inc
deleted:scripts/flaskext_tester.py-309 removed
1# -*- coding: utf-8 -*-2"""3 Flask Extension Tests4 ~~~~~~~~~~~~~~~~~~~~~56 Tests the Flask extensions.78 :copyright: (c) 2015 by Ali Afshar.9 :license: BSD, see LICENSE for more details.10"""1112import os13import sys14import shutil15import urllib216import tempfile17import subprocess18import argparse1920from flask import json2122from setuptools.package_index import PackageIndex23from setuptools.archive_util import unpack_archive2425flask_svc_url = 'http://flask.pocoo.org/extensions/'262728# OS X has awful paths when using mkstemp or gettempdir(). I don't29# care about security or clashes here, so pick something that is30# actually memorable.31if sys.platform == 'darwin':32 _tempdir = '/private/tmp'33else:34 _tempdir = tempfile.gettempdir()35tdir = _tempdir + '/flaskext-test'36flaskdir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))373839# virtualenv hack *cough*40os.environ['PYTHONDONTWRITEBYTECODE'] = ''414243RESULT_TEMPATE = u'''\44<!doctype html>45<title>Flask-Extension Test Results</title>46<style type=text/css>47 body { font-family: 'Georgia', serif; font-size: 17px; color: #000; }48 a { color: #004B6B; }49 a:hover { color: #6D4100; }50 h1, h2, h3 { font-family: 'Garamond', 'Georgia', serif; font-weight: normal; }51 h1 { font-size: 30px; margin: 15px 0 5px 0; }52 h2 { font-size: 24px; margin: 15px 0 5px 0; }53 h3 { font-size: 19px; margin: 15px 0 5px 0; }54 textarea, code,55 pre { font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono',56 'Bitstream Vera Sans Mono', monospace!important; font-size: 15px;57 background: #eee; }58 pre { padding: 7px 15px; line-height: 1.3; }59 p { line-height: 1.4; }60 table { border: 1px solid black; border-collapse: collapse;61 margin: 15px 0; }62 td, th { border: 1px solid black; padding: 4px 10px;63 text-align: left; }64 th { background: #eee; font-weight: normal; }65 tr.success { background: #D3F5CC; }66 tr.failed { background: #F5D2CB; }67</style>68<h1>Flask-Extension Test Results</h1>69<p>70 This page contains the detailed test results for the test run of71 all {{ 'approved' if approved }} Flask extensions.72<h2>Summary</h2>73<table class=results>74 <thead>75 <tr>76 <th>Extension77 <th>Version78 <th>Author79 <th>License80 <th>Outcome81 {%- for iptr, _ in results[0].logs|dictsort %}82 <th>{{ iptr }}83 {%- endfor %}84 </tr>85 </thead>86 <tbody>87 {%- for result in results %}88 {% set outcome = 'success' if result.success else 'failed' %}89 <tr class={{ outcome }}>90 <th>{{ result.name }}91 <td>{{ result.version }}92 <td>{{ result.author }}93 <td>{{ result.license }}94 <td>{{ outcome }}95 {%- for iptr, _ in result.logs|dictsort %}96 <td><a href="#{{ result.name }}-{{ iptr }}">see log</a>97 {%- endfor %}98 </tr>99 {%- endfor %}100 </tbody>101</table>102<h2>Test Logs</h2>103<p>Detailed test logs for all tests on all platforms:104{%- for result in results %}105 {%- for iptr, log in result.logs|dictsort %}106 <h3 id="{{ result.name }}-{{ iptr }}">107 {{ result.name }} - {{ result.version }} [{{ iptr }}]</h3>108 <pre>{{ log }}</pre>109 {%- endfor %}110{%- endfor %}111'''112113114def log(msg, *args):115 print('[EXTTEST] ' + (msg % args))116117118class TestResult(object):119120 def __init__(self, name, folder, statuscode, interpreters):121 intrptr = os.path.join(folder, '.tox/%s/bin/python'122 % interpreters[0])123 self.statuscode = statuscode124 self.folder = folder125 self.success = statuscode == 0126127 def fetch(field):128 try:129 c = subprocess.Popen([intrptr, 'setup.py',130 '--' + field], cwd=folder,131 stdout=subprocess.PIPE)132 return c.communicate()[0].strip()133 except OSError:134 return '?'135 self.name = name136 self.license = fetch('license')137 self.author = fetch('author')138 self.version = fetch('version')139140 self.logs = {}141 for interpreter in interpreters:142 logfile = os.path.join(folder, '.tox/%s/log/test.log'143 % interpreter)144 if os.path.isfile(logfile):145 self.logs[interpreter] = open(logfile).read()146 else:147 self.logs[interpreter] = ''148149150def create_tdir():151 try:152 shutil.rmtree(tdir)153 except Exception:154 pass155 os.mkdir(tdir)156157158def package_flask():159 distfolder = tdir + '/.flask-dist'160 c = subprocess.Popen(['python', 'setup.py', 'sdist', '--formats=gztar',161 '--dist', distfolder], cwd=flaskdir)162 c.wait()163 return os.path.join(distfolder, os.listdir(distfolder)[0])164165166def get_test_command(checkout_dir):167 if os.path.isfile(checkout_dir + '/Makefile'):168 return 'make test'169 return 'python setup.py test'170171172def fetch_extensions_list():173 req = urllib2.Request(flask_svc_url, headers={'accept':'application/json'})174 d = urllib2.urlopen(req).read()175 data = json.loads(d)176 for ext in data['extensions']:177 yield ext178179180def checkout_extension(name):181 log('Downloading extension %s to temporary folder', name)182 root = os.path.join(tdir, name)183 os.mkdir(root)184 checkout_path = PackageIndex().download(name, root)185186 unpack_archive(checkout_path, root)187 path = None188 for fn in os.listdir(root):189 path = os.path.join(root, fn)190 if os.path.isdir(path):191 break192 log('Downloaded to %s', path)193 return path194195196tox_template = """[tox]197envlist=%(env)s198199[testenv]200deps=201 %(deps)s202 distribute203 py204commands=bash flaskext-runtest.sh {envlogdir}/test.log205downloadcache=%(cache)s206"""207208209def create_tox_ini(checkout_path, interpreters, flask_dep):210 tox_path = os.path.join(checkout_path, 'tox-flask-test.ini')211 if not os.path.exists(tox_path):212 with open(tox_path, 'w') as f:213 f.write(tox_template % {214 'env': ','.join(interpreters),215 'cache': tdir,216 'deps': flask_dep217 })218 return tox_path219220221def iter_extensions(only_approved=True):222 for ext in fetch_extensions_list():223 if ext['approved'] or not only_approved:224 yield ext['name']225226227def test_extension(name, interpreters, flask_dep):228 checkout_path = checkout_extension(name)229 log('Running tests with tox in %s', checkout_path)230231 # figure out the test command and write a wrapper script. We232 # can't write that directly into the tox ini because tox does233 # not invoke the command from the shell so we have no chance234 # to pipe the output into a logfile. The /dev/null hack is235 # to trick py.test (if used) into not guessing widths from the236 # invoking terminal.237 test_command = get_test_command(checkout_path)238 log('Test command: %s', test_command)239 f = open(checkout_path + '/flaskext-runtest.sh', 'w')240 f.write(test_command + ' &> "$1" < /dev/null\n')241 f.close()242243 # if there is a tox.ini, remove it, it will cause troubles244 # for us. Remove it if present, we are running tox ourselves245 # afterall.246247 create_tox_ini(checkout_path, interpreters, flask_dep)248 rv = subprocess.call(['tox', '-c', 'tox-flask-test.ini'], cwd=checkout_path)249 return TestResult(name, checkout_path, rv, interpreters)250251252def run_tests(extensions, interpreters):253 results = {}254 create_tdir()255 log('Packaging Flask')256 flask_dep = package_flask()257 log('Running extension tests')258 log('Temporary Environment: %s', tdir)259 for name in extensions:260 log('Testing %s', name)261 result = test_extension(name, interpreters, flask_dep)262 if result.success:263 log('Extension test succeeded')264 else:265 log('Extension test failed')266 results[name] = result267 return results268269270def render_results(results, approved):271 from jinja2 import Template272 items = results.values()273 items.sort(key=lambda x: x.name.lower())274 rv = Template(RESULT_TEMPATE, autoescape=True).render(results=items,275 approved=approved)276 fd, filename = tempfile.mkstemp(suffix='.html')277 os.fdopen(fd, 'w').write(rv.encode('utf-8') + '\n')278 return filename279280281def main():282 parser = argparse.ArgumentParser(description='Runs Flask extension tests')283 parser.add_argument('--all', dest='all', action='store_true',284 help='run against all extensions, not just approved')285 parser.add_argument('--browse', dest='browse', action='store_true',286 help='show browser with the result summary')287 parser.add_argument('--env', dest='env', default='py25,py26,py27',288 help='the tox environments to run against')289 parser.add_argument('--extension=', dest='extension', default=None,290 help='tests a single extension')291 args = parser.parse_args()292293 if args.extension is not None:294 only_approved = False295 extensions = [args.extension]296 else:297 only_approved = not args.all298 extensions = iter_extensions(only_approved)299300 results = run_tests(extensions, [x.strip() for x in args.env.split(',')])301 filename = render_results(results, only_approved)302 if args.browse:303 import webbrowser304 webbrowser.open('file:///' + filename.lstrip('/'))305 print('Results written to {}'.format(filename))306307308if __name__ == '__main__':309 main()
modified:scripts/make-release.py+50 added-32 removed
1#!/usr/bin/env python2# -*- coding: utf-8 -*-3"""4 make-release5 ~~~~~~~~~~~~67 Helper script that performs a release. Does pretty much everything8 automatically for us.910 :copyright: (c) 2015 by Armin Ronacher.11 :license: BSD, see LICENSE for more details.12"""2from __future__ import print_function14import sys34import os5import re6import sys17from datetime import datetime, date18from subprocess import Popen, PIPE7from datetime import date, datetime8from subprocess import PIPE, Popen920_date_clean_re = re.compile(r'(\d+)(st|nd|rd|th)')10_date_strip_re = re.compile(r'(?<=\d)(st|nd|rd|th)')111213def parse_changelog():14 with open('CHANGES.rst') as f:15 lineiter = iter(f)16 for line in lineiter:17 match = re.search('^Version\s+(.*)', line.strip())1819 if match is None:20 continue2122 version = match.group(1).strip()2331 if lineiter.next().count('-') != len(match.group(0)):24 if next(lineiter).count('-') != len(match.group(0)):25 continue2627 while 1:34 change_info = lineiter.next().strip()28 change_info = next(lineiter).strip()2930 if change_info:31 break3238 match = re.search(r'released on (\w+\s+\d+\w+\s+\d+)'39 r'(?:, codename (.*))?(?i)', change_info)33 match = re.search(34 r'released on (\w+\s+\d+\w+\s+\d+)(?:, codename (.*))?',35 change_info,36 flags=re.IGNORECASE37 )3839 if match is None:40 continue4142 datestr, codename = match.groups()
1 unmodified line
444546def bump_version(version):47 try:49 parts = map(int, version.split('.'))48 parts = [int(i) for i in version.split('.')]49 except ValueError:50 fail('Current version is not numeric')5152 parts[-1] += 153 return '.'.join(map(str, parts))545556def parse_date(string):57 string = _date_clean_re.sub(r'\1', string)57 string = _date_strip_re.sub('', string)58 return datetime.strptime(string, '%B %d %Y')596061def set_filename_version(filename, version_number, pattern):
2 unmodified lines
64 def inject_version(match):65 before, old, after = match.groups()66 changed.append(True)67 return before + version_number + after6869 with open(filename) as f:69 contents = re.sub(r"^(\s*%s\s*=\s*')(.+?)(')(?sm)" % pattern,70 inject_version, f.read())70 contents = re.sub(71 r"^(\s*%s\s*=\s*')(.+?)(')" % pattern,72 inject_version, f.read(),73 flags=re.DOTALL | re.MULTILINE74 )7576 if not changed:77 fail('Could not find %s in %s', pattern, filename)78
5 unmodified lines
84 info('Setting __init__.py version to %s', version)85 set_filename_version('flask/__init__.py', version, '__version__')868784def build_and_upload():85 Popen([sys.executable, 'setup.py', 'release', 'sdist', 'bdist_wheel', 'upload']).wait()88def build():89 cmd = [sys.executable, 'setup.py', 'sdist', 'bdist_wheel']90 Popen(cmd).wait()919293def fail(message, *args):94 print('Error:', message % args, file=sys.stderr)
4 unmodified lines
99 print(message % args, file=sys.stderr)100101102def get_git_tags():98 return set(Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines())103 return set(104 Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines()105 )106107108def git_is_clean():109 return Popen(['git', 'diff', '--quiet']).wait() == 0
12 unmodified lines
122def main():123 os.chdir(os.path.join(os.path.dirname(__file__), '..'))124125 rv = parse_changelog()126127 if rv is None:128 fail('Could not parse changelog')129130 version, release_date, codename = rv123 dev_version = bump_version(version) + '-dev'131 dev_version = bump_version(version) + '.dev'132133 info(125 info('Releasing %s (codename %s, release date %s)',126 version, codename, release_date.strftime('%d/%m/%Y'))134 'Releasing %s (codename %s, release date %s)',135 version, codename, release_date.strftime('%d/%m/%Y')136 )137 tags = get_git_tags()138139 if version in tags:140 fail('Version "%s" is already tagged', version)141142 if release_date.date() != date.today():143 fail(132 fail('Release date is not today (%s != %s)',133 release_date.date(), date.today())144 'Release date is not today (%s != %s)',145 release_date.date(), date.today()146 )147148 if not git_is_clean():149 fail('You have uncommitted changes in git')150151 try:152 import wheel # noqa: F401153 except ImportError:154 fail('You need to install the wheel package.')155156 set_init_version(version)157 make_git_commit('Bump version number to %s', version)158 make_git_tag(version)141 build_and_upload()159 build()160 set_init_version(dev_version)161162163if __name__ == '__main__':
1 unmodified line
modified:.gitattributes+1 added-1 removed
1CHANGES merge=union1CHANGES.rst merge=union
modified:.travis.yml+10 added-1 removed
modified:AUTHORS+9 added-37 removed
1Flask is written and maintained by Armin Ronacher and2various contributors:1Flask is developed and maintained by the Pallets team and community2contributors. It was created by Armin Ronacher. The core maintainers3are:44Development Lead5````````````````5- David Lord (davidism)6- Adrian Mönnich (ThiefMaster)7- Armin Ronacher (mitsuhiko)8- Marcus Unterwaditzer (untitaker)97- Armin Ronacher <armin.ronacher@active-4.com>10A full list of contributors is available from git with::119Patches and Suggestions10```````````````````````1112- Adam Byrtek13- Adam Zapletal14- Ali Afshar15- Chris Edgemon16- Chris Grindstaff17- Christopher Grebs18- Daniel Neuhäuser19- Dan Sully20- David Lord @davidism21- Edmond Burnett22- Florent Xicluna23- Georg Brandl24- Hsiaoming Yang @lepture25- Jeff Widman @jeffwidman26- Joshua Bronson @jab27- Justin Quick28- Kenneth Reitz29- Keyan Pishdadian30- Marian Sigler31- Martijn Pieters32- Matt Campell33- Matthew Frazier34- Michael van Tellingen35- Ron DuPlain36- Sebastien Estienne37- Simon Sapin38- Stephane Wirtel39- Thomas Schranz40- Zhao Xiaohong12 git shortlog -sne
modified:CHANGES.rst+113 added-98 removed
1.. currentmodule:: flask23Flask Changelog4===============56
5 unmodified lines
12- **Python 2.6 and 3.3 are no longer supported.** (`pallets/meta#24`_)13- Bump minimum dependency versions to the latest stable versions:14 Werkzeug >= 0.14, Jinja >= 2.10, itsdangerous >= 0.24, Click >= 5.1.15 (`#2586`_)14- Make ``app.run()`` into a noop if a Flask application is run from the15 development server on the command line. This avoids some behavior that16 was confusing to debug for newcomers.17- Change default configuration ``JSONIFY_PRETTYPRINT_REGULAR=False``.18 ``jsonify()`` method returns compressed response by default, and pretty19 response in debug mode. (`#2193`_)20- Change ``Flask.__init__`` to accept two new keyword arguments,21 ``host_matching`` and ``static_host``. This enables ``host_matching`` to be22 set properly by the time the constructor adds the static route, and enables23 the static route to be properly associated with the required host.24 (``#1559``)25- ``send_file`` supports Unicode in ``attachment_filename``. (`#2223`_)26- Pass ``_scheme`` argument from ``url_for`` to ``handle_build_error``.27 (`#2017`_)28- Add support for ``provide_automatic_options`` in ``add_url_rule`` to disable29 adding OPTIONS method when the ``view_func`` argument is not a class.30 (`#1489`_).31- ``MethodView`` can inherit method handlers from base classes. (`#1936`_)32- Errors caused while opening the session at the beginning of the request are33 handled by the app's error handlers. (`#2254`_)34- Blueprints gained ``json_encoder`` and ``json_decoder`` attributes to35 override the app's encoder and decoder. (`#1898`_)36- ``Flask.make_response`` raises ``TypeError`` instead of ``ValueError`` for37 bad response types. The error messages have been improved to describe why the38 type is invalid. (`#2256`_)39- Add ``routes`` CLI command to output routes registered on the application.40 (`#2259`_)16- Skip :meth:`app.run <Flask.run>` when a Flask application is run from17 the command line. This avoids some behavior that was confusing to18 debug.19- Change the default for :data:`JSONIFY_PRETTYPRINT_REGULAR` to20 ``False``. :func:`~json.jsonify` returns a compact format by default,21 and an indented format in debug mode. (`#2193`_)22- :meth:`Flask.__init__ <Flask>` accepts the ``host_matching`` argument23 and sets it on :attr:`~Flask.url_map`. (`#1559`_)24- :meth:`Flask.__init__ <Flask>` accepts the ``static_host`` argument25 and passes it as the ``host`` argument when defining the static route.26 (`#1559`_)27- :func:`send_file` supports Unicode in ``attachment_filename``.28 (`#2223`_)29- Pass ``_scheme`` argument from :func:`url_for` to30 :meth:`~Flask.handle_url_build_error`. (`#2017`_)31- :meth:`~Flask.add_url_rule` accepts the ``provide_automatic_options``32 argument to disable adding the ``OPTIONS`` method. (`#1489`_)33- :class:`~views.MethodView` subclasses inherit method handlers from34 base classes. (`#1936`_)35- Errors caused while opening the session at the beginning of the36 request are handled by the app's error handlers. (`#2254`_)37- Blueprints gained :attr:`~Blueprint.json_encoder` and38 :attr:`~Blueprint.json_decoder` attributes to override the app's39 encoder and decoder. (`#1898`_)40- :meth:`Flask.make_response` raises ``TypeError`` instead of41 ``ValueError`` for bad response types. The error messages have been42 improved to describe why the type is invalid. (`#2256`_)43- Add ``routes`` CLI command to output routes registered on the44 application. (`#2259`_)45- Show warning when session cookie domain is a bare hostname or an IP42 address, as these may not behave properly in some browsers, such as Chrome.43 (`#2282`_)46 address, as these may not behave properly in some browsers, such as47 Chrome. (`#2282`_)48- Allow IP address as exact session cookie domain. (`#2282`_)45- ``SESSION_COOKIE_DOMAIN`` is set if it is detected through ``SERVER_NAME``.46 (`#2282`_)47- Auto-detect zero-argument app factory called ``create_app`` or ``make_app``48 from ``FLASK_APP``. (`#2297`_)49- Factory functions are not required to take a ``script_info`` parameter to50 work with the ``flask`` command. If they take a single parameter or a51 parameter named ``script_info``, the ``ScriptInfo`` object will be passed.52 (`#2319`_)53- FLASK_APP=myproject.app:create_app('dev') support.54- ``FLASK_APP`` can be set to an app factory, with arguments if needed, for55 example ``FLASK_APP=myproject.app:create_app('dev')``. (`#2326`_)56- ``FLASK_APP`` can point to local packages that are not installed in dev mode,57 although `pip install -e` should still be preferred. (`#2414`_)58- ``View.provide_automatic_options = True`` is set on the view function from59 ``View.as_view``, to be detected in ``app.add_url_rule``. (`#2316`_)49- ``SESSION_COOKIE_DOMAIN`` is set if it is detected through50 ``SERVER_NAME``. (`#2282`_)51- Auto-detect zero-argument app factory called ``create_app`` or52 ``make_app`` from ``FLASK_APP``. (`#2297`_)53- Factory functions are not required to take a ``script_info`` parameter54 to work with the ``flask`` command. If they take a single parameter or55 a parameter named ``script_info``, the :class:`~cli.ScriptInfo` object56 will be passed. (`#2319`_)57- ``FLASK_APP`` can be set to an app factory, with arguments if needed,58 for example ``FLASK_APP=myproject.app:create_app('dev')``. (`#2326`_)59- ``FLASK_APP`` can point to local packages that are not installed in60 editable mode, although ``pip install -e`` is still preferred.61 (`#2414`_)62- The :class:`~views.View` class attribute63 :attr:`~views.View.provide_automatic_options` is set in64 :meth:`~views.View.as_view`, to be detected by65 :meth:`~Flask.add_url_rule`. (`#2316`_)66- Error handling will try handlers registered for ``blueprint, code``,61 ``app, code``, ``blueprint, exception``, ``app, exception``. (`#2314`_)62- ``Cookie`` is added to the response's ``Vary`` header if the session is63 accessed at all during the request (and it wasn't deleted). (`#2288`_)64- ``app.test_request_context()`` take ``subdomain`` and ``url_scheme``65 parameters for use when building base URL. (`#1621`_)66- Set ``APPLICATION_ROOT = '/'`` by default. This was already the implicit67 default when it was set to ``None``.68- ``TRAP_BAD_REQUEST_ERRORS`` is enabled by default in debug mode.69 ``BadRequestKeyError`` has a message with the bad key in debug mode instead70 of the generic bad request message. (`#2348`_)71- Allow registering new tags with ``TaggedJSONSerializer`` to support72 storing other types in the session cookie. (`#2352`_)73- Only open the session if the request has not been pushed onto the context74 stack yet. This allows ``stream_with_context`` generators to access the same75 session that the containing view uses. (`#2354`_)76- Add ``json`` keyword argument for the test client request methods. This will77 dump the given object as JSON and set the appropriate content type.78 (`#2358`_)79- Extract JSON handling to a mixin applied to both the request and response80 classes used by Flask. This adds the ``is_json`` and ``get_json`` methods to81 the response to make testing JSON response much easier. (`#2358`_)82- Removed error handler caching because it caused unexpected results for some83 exception inheritance hierarchies. Register handlers explicitly for each84 exception if you don't want to traverse the MRO. (`#2362`_)67 ``app, code``, ``blueprint, exception``, ``app, exception``.68 (`#2314`_)69- ``Cookie`` is added to the response's ``Vary`` header if the session70 is accessed at all during the request (and not deleted). (`#2288`_)71- :meth:`~Flask.test_request_context` accepts ``subdomain`` and72 ``url_scheme`` arguments for use when building the base URL.73 (`#1621`_)74- Set :data:`APPLICATION_ROOT` to ``'/'`` by default. This was already75 the implicit default when it was set to ``None``.76- :data:`TRAP_BAD_REQUEST_ERRORS` is enabled by default in debug mode.77 ``BadRequestKeyError`` has a message with the bad key in debug mode78 instead of the generic bad request message. (`#2348`_)79- Allow registering new tags with80 :class:`~json.tag.TaggedJSONSerializer` to support storing other types81 in the session cookie. (`#2352`_)82- Only open the session if the request has not been pushed onto the83 context stack yet. This allows :func:`~stream_with_context`84 generators to access the same session that the containing view uses.85 (`#2354`_)86- Add ``json`` keyword argument for the test client request methods.87 This will dump the given object as JSON and set the appropriate88 content type. (`#2358`_)89- Extract JSON handling to a mixin applied to both the :class:`Request`90 and :class:`Response` classes. This adds the :meth:`~Response.is_json`91 and :meth:`~Response.get_json` methods to the response to make testing92 JSON response much easier. (`#2358`_)93- Removed error handler caching because it caused unexpected results for94 some exception inheritance hierarchies. Register handlers explicitly95 for each exception if you want to avoid traversing the MRO. (`#2362`_)96- Fix incorrect JSON encoding of aware, non-UTC datetimes. (`#2374`_)86- Template auto reloading will honor the ``run`` command's ``debug`` flag even87 if ``app.jinja_env`` was already accessed. (`#2373`_)97- Template auto reloading will honor debug mode even even if98 :attr:`~Flask.jinja_env` was already accessed. (`#2373`_)99- The following old deprecated code was removed. (`#2385`_)100101 - ``flask.ext`` - import extensions directly by their name instead of102 through the ``flask.ext`` namespace. For example,103 ``import flask.ext.sqlalchemy`` becomes ``import flask_sqlalchemy``.93 - ``Flask.init_jinja_globals`` - extend ``Flask.create_jinja_environment``94 instead.95 - ``Flask.error_handlers`` - tracked by ``Flask.error_handler_spec``,96 use ``@app.errorhandler`` to register handlers.97 - ``Flask.request_globals_class`` - use ``Flask.app_ctx_globals_class``98 instead.99 - ``Flask.static_path`` - use ``Flask.static_url_path`` instead.100 - ``Request.module`` - use ``Request.blueprint`` instead.104 - ``Flask.init_jinja_globals`` - extend105 :meth:`Flask.create_jinja_environment` instead.106 - ``Flask.error_handlers`` - tracked by107 :attr:`Flask.error_handler_spec`, use :meth:`Flask.errorhandler` to108 register handlers.109 - ``Flask.request_globals_class`` - use110 :attr:`Flask.app_ctx_globals_class` instead.111 - ``Flask.static_path`` - use :attr:`Flask.static_url_path` instead.112 - ``Request.module`` - use :attr:`Request.blueprint` instead.113102- The ``request.json`` property is no longer deprecated. (`#1421`_)103- Support passing an existing ``EnvironBuilder`` or ``dict`` to104 ``test_client.open``. (`#2412`_)105- The ``flask`` command and ``app.run`` will load environment variables using106 from ``.env`` and ``.flaskenv`` files if python-dotenv is installed.107 (`#2416`_)108- When passing a full URL to the test client, use the scheme in the URL instead109 of the ``PREFERRED_URL_SCHEME``. (`#2430`_)110- ``app.logger`` has been simplified. ``LOGGER_NAME`` and111 ``LOGGER_HANDLER_POLICY`` config was removed. The logger is always named112 ``flask.app``. The level is only set on first access, it doesn't check113 ``app.debug`` each time. Only one format is used, not different ones114 depending on ``app.debug``. No handlers are removed, and a handler is only115 added if no handlers are already configured. (`#2436`_)116- Blueprint view function name may not contain dots. (`#2450`_)117- Fix a ``ValueError`` caused by invalid Range requests in some cases.118 (`#2526`_)119- The dev server now uses threads by default. (`#2529`_)120- Loading config files with ``silent=True`` will ignore ``ENOTDIR``121 errors. (`#2581`_)114- The :attr:`Request.json` property is no longer deprecated. (`#1421`_)115- Support passing a :class:`~werkzeug.test.EnvironBuilder` or116 ``dict`` to :meth:`test_client.open <werkzeug.test.Client.open>`.117 (`#2412`_)118- The ``flask`` command and :meth:`Flask.run` will load environment119 variables from ``.env`` and ``.flaskenv`` files if python-dotenv is120 installed. (`#2416`_)121- When passing a full URL to the test client, the scheme in the URL is122 used instead of :data:`PREFERRED_URL_SCHEME`. (`#2430`_)123- :attr:`Flask.logger` has been simplified. ``LOGGER_NAME`` and124 ``LOGGER_HANDLER_POLICY`` config was removed. The logger is always125 named ``flask.app``. The level is only set on first access, it doesn't126 check :attr:`Flask.debug` each time. Only one format is used, not127 different ones depending on :attr:`Flask.debug`. No handlers are128 removed, and a handler is only added if no handlers are already129 configured. (`#2436`_)130- Blueprint view function names may not contain dots. (`#2450`_)131- Fix a ``ValueError`` caused by invalid ``Range`` requests in some132 cases. (`#2526`_)133- The development server uses threads by default. (`#2529`_)134- Loading config files with ``silent=True`` will ignore135 :data:`~errno.ENOTDIR` errors. (`#2581`_)136- Pass ``--cert`` and ``--key`` options to ``flask run`` to run the137 development server over HTTPS. (`#2606`_)138- Added :data:`SESSION_COOKIE_SAMESITE` to control the ``SameSite``139 attribute on the session cookie. (`#2607`_)140141.. _pallets/meta#24: https://github.com/pallets/meta/issues/24142.. _#1421: https://github.com/pallets/flask/issues/1421143.. _#1489: https://github.com/pallets/flask/pull/1489144.. _#1559: https://github.com/pallets/flask/issues/1559145.. _#1621: https://github.com/pallets/flask/pull/1621146.. _#1898: https://github.com/pallets/flask/pull/1898147.. _#1936: https://github.com/pallets/flask/pull/1936148.. _#2017: https://github.com/pallets/flask/pull/2017
654 unmodified lines
modified:CONTRIBUTING.rst+16 added-2 removed
129 unmodified lines
130131Running the full test suite with ``tox`` will combine the coverage reports132from all runs.133134``make`` targets135~~~~~~~~~~~~~~~~134135Building the docs136~~~~~~~~~~~~~~~~~137138Build the docs in the ``docs`` directory using Sphinx::139140 cd docs141 make html142143Open ``_build/html/index.html`` in your browser to view the docs.144145Read more about `Sphinx <http://www.sphinx-doc.org>`_.146147148make targets149~~~~~~~~~~~~150151Flask provides a ``Makefile`` with various shortcuts. They will ensure that152all dependencies are installed.153154- ``make test`` runs the basic test suite with ``pytest``
26 unmodified lines
modified:LICENSE+23 added-25 removed
1Copyright (c) 2015 by Armin Ronacher and contributors. See AUTHORS2for more details.1Copyright © 2010 by the Pallets team.23Some rights reserved.46Redistribution and use in source and binary forms of the software as well7as documentation, with or without modification, are permitted provided8that the following conditions are met:5Redistribution and use in source and binary forms of the software as6well as documentation, with or without modification, are permitted7provided that the following conditions are met:810* Redistributions of source code must retain the above copyright11 notice, this list of conditions and the following disclaimer.9* Redistributions of source code must retain the above copyright notice,10 this list of conditions and the following disclaimer.1113* Redistributions in binary form must reproduce the above14 copyright notice, this list of conditions and the following15 disclaimer in the documentation and/or other materials provided16 with the distribution.12* Redistributions in binary form must reproduce the above copyright13 notice, this list of conditions and the following disclaimer in the14 documentation and/or other materials provided with the distribution.1518* The names of the contributors may not be used to endorse or19 promote products derived from this software without specific20 prior written permission.16* Neither the name of the copyright holder nor the names of its17 contributors may be used to endorse or promote products derived from18 this software without specific prior written permission.1920THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND23CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT24NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR25A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER26OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,27EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,28PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR29PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF30LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING31NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS32SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH33DAMAGE.21CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,22BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND23FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE24COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,25INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT26NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF27USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON28ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF30THIS SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF31SUCH DAMAGE.
modified:Makefile-18 removed
7 unmodified lines
8test: clean-pyc install-dev9 pytest1011coverage: clean-pyc install-dev12 pip install -q -e .[test]12 coverage run -m pytest13 coverage report14 coverage html15
16 unmodified lines
32clean-pyc:33 find . -name '*.pyc' -exec rm -f {} +34 find . -name '*.pyo' -exec rm -f {} +35 find . -name '*~' -exec rm -f {} +3738upload-docs:39 $(MAKE) -C docs html dirhtml latex epub40 $(MAKE) -C docs/_build/latex all-pdf41 cd docs/_build/; mv html flask-docs; zip -r flask-docs.zip flask-docs; mv flask-docs html42 rsync -a docs/_build/dirhtml/ flow.srv.pocoo.org:/srv/websites/flask.pocoo.org/docs/43 rsync -a docs/_build/latex/Flask.pdf flow.srv.pocoo.org:/srv/websites/flask.pocoo.org/docs/flask-docs.pdf44 rsync -a docs/_build/flask-docs.zip flow.srv.pocoo.org:/srv/websites/flask.pocoo.org/docs/flask-docs.zip45 rsync -a docs/_build/epub/Flask.epub flow.srv.pocoo.org:/srv/websites/flask.pocoo.org/docs/flask-docs.epub4647# ebook-convert docs: http://manual.calibre-ebook.com/cli/ebook-convert.html48ebook:49 @echo 'Using .epub from `make upload-docs` to create .mobi.'50 @echo 'Command `ebook-covert` is provided by calibre package.'51 @echo 'Requires X-forwarding for Qt features used in conversion (ssh -X).'52 @echo 'Do not mind "Invalid value for ..." CSS errors if .mobi renders.'53 ssh -X pocoo.org ebook-convert /var/www/flask.pocoo.org/docs/flask-docs.epub /var/www/flask.pocoo.org/docs/flask-docs.mobi --cover http://flask.pocoo.org/docs/_images/logo-full.png --authors 'Armin Ronacher'
modified:MANIFEST.in+1 added-1 removed
1include Makefile CHANGES LICENSE AUTHORS tox.ini1include Makefile CHANGES.rst LICENSE AUTHORS tox.ini23graft artwork4graft tests5graft examples
6 unmodified lines
deleted:README-49 removed
123 // Flask //45 web development, one drop at a time678 ~ What is Flask?910 Flask is a microframework for Python based on Werkzeug11 and Jinja2. It's intended for getting started very quickly12 and was developed with best intentions in mind.1314 ~ Is it ready?1516 It's still not 1.0 but it's shaping up nicely and is17 already widely used. Consider the API to slightly18 improve over time but we don't plan on breaking it.1920 ~ What do I need?2122 All dependencies are installed by using `pip install Flask`.23 We encourage you to use a virtualenv. Check the docs for24 complete installation and usage instructions.2526 ~ Where are the docs?2728 Go to http://flask.pocoo.org/docs/ for a prebuilt version29 of the current documentation. Otherwise build them yourself30 from the sphinx sources in the docs folder.3132 ~ Where are the tests?3334 Good that you're asking. The tests are in the35 tests/ folder. To run the tests use the36 `pytest` testing tool:3738 $ pytest3940 Details on contributing can be found in CONTRIBUTING.rst4142 ~ Where can I get help?4344 Either use the #pocoo IRC channel on irc.freenode.net or45 ask on the mailinglist: http://flask.pocoo.org/mailinglist/4647 See http://flask.pocoo.org/community/ for more resources.4849
added:README.rst+62 added
1Flask2=====34Flask is a lightweight `WSGI`_ web application framework. It is designed5to make getting started quick and easy, with the ability to scale up to6complex applications. It began as a simple wrapper around `Werkzeug`_7and `Jinja`_ and has become one of the most popular Python web8application frameworks.910Flask offers suggestions, but doesn't enforce any dependencies or11project layout. It is up to the developer to choose the tools and12libraries they want to use. There are many extensions provided by the13community that make adding new functionality easy.141516Installing17----------1819Install and update using `pip`_:2021.. code-block:: text2223 pip install -U Flask242526A Simple Example27----------------2829.. code-block:: python3031 from flask import Flask3233 app = Flask(__name__)3435 @app.route('/')36 def hello():37 return 'Hello, World!'3839.. code-block:: none4041 $ FLASK_APP=hello.py flask run42 * Running on http://localhost:5000/434445Links46-----4748* Website: https://www.palletsprojects.com/p/flask/49* Releases: https://pypi.org/project/Flask/50* Code: https://github.com/pallets/flask51* Issue tracker: https://github.com/pallets/flask/issues52* Test status:5354 * Linux, Mac: https://travis-ci.org/pallets/flask55 * Windows: https://ci.appveyor.com/project/pallets/flask5657* Test coverage: https://codecov.io/gh/pallets/flask5859.. _WSGI: https://wsgi.readthedocs.io60.. _Werkzeug: https://www.palletsprojects.com/p/werkzeug/61.. _Jinja: https://www.palletsprojects.com/p/jinja/62.. _pip: https://pip.pypa.io/en/stable/quickstart/
modified:setup.cfg+1 added-1 removed
1[aliases]2release = egg_info -RDb ''2release = egg_info -Db ''34[bdist_wheel]5universal = 16
6 unmodified lines
modified:setup.py+9 added-56 removed
1"""2Flask3-----45Flask is a microframework for Python based on Werkzeug, Jinja 2 and good6intentions. And before you ask: It's BSD licensed!78Flask is Fun9````````````1011Save in a hello.py:1213.. code:: python1415 from flask import Flask16 app = Flask(__name__)1718 @app.route("/")19 def hello():20 return "Hello World!"2122 if __name__ == "__main__":23 app.run()2425And Easy to Setup26`````````````````2728And run it:2930.. code:: bash3132 $ pip install Flask33 $ python hello.py34 * Running on http://localhost:5000/3536Ready for production? `Read this first <http://flask.pocoo.org/docs/deploying/>`.3738Links39`````4041* `website <http://flask.pocoo.org/>`_42* `documentation <http://flask.pocoo.org/docs/>`_43* `development version44 <https://github.com/pallets/flask/zipball/master#egg=Flask-dev>`_4546"""1#!/usr/bin/env python2import io3import re48import ast4from setuptools import setup551_version_re = re.compile(r'__version__\s+=\s+(.*)')6with io.open('README.rst', 'rt', encoding='utf8') as f:7 readme = f.read()853with open('flask/__init__.py', 'rb') as f:54 version = str(ast.literal_eval(_version_re.search(55 f.read().decode('utf-8')).group(1)))9with io.open('flask/__init__.py', 'rt', encoding='utf8') as f:10 version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)1112setup(13 name='Flask',14 version=version,60 url='https://github.com/pallets/flask/',15 url='https://www.palletsprojects.com/p/flask/',16 license='BSD',17 author='Armin Ronacher',18 author_email='armin.ronacher@active-4.com',64 description='A microframework based on Werkzeug, Jinja2 '65 'and good intentions',66 long_description=__doc__,19 description='A simple framework for building complex web applications.',20 long_description=readme,21 packages=['flask', 'flask.json'],22 include_package_data=True,23 zip_safe=False,24 platforms='any',71 python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',25 install_requires=[26 'Werkzeug>=0.14',27 'Jinja2>=2.10',28 'itsdangerous>=0.24',
36 unmodified lines
deleted:test-requirements.txt-3 removed
1tox2pytest3pytest-cov