pax_global_header 0000666 0000000 0000000 00000000064 14656265100 0014517 g ustar 00root root 0000000 0000000 52 comment=7b8fd614b8c8a5118bcc479450531a08a4293485
klein-24.8.0/ 0000775 0000000 0000000 00000000000 14656265100 0012714 5 ustar 00root root 0000000 0000000 klein-24.8.0/.codecov.yml 0000664 0000000 0000000 00000000612 14656265100 0015136 0 ustar 00root root 0000000 0000000 # Don't add a comment to GitHub conversation if there is no coverage change.
comment:
require_changes: true
# Require 100% diff coverage, only complain about project coverage.
coverage:
status:
project:
default:
informational: true
target: 100%
patch:
default:
informational: false
target: 100%
ignore:
- "src/klein/test/typing_*.py"
klein-24.8.0/.coveragerc 0000664 0000000 0000000 00000000465 14656265100 0015042 0 ustar 00root root 0000000 0000000 [run]
branch = True
parallel = True
source = klein
omit = src/klein/test/typing_*.py
[paths]
source=
src/klein
.tox/*/lib/python*/site-packages/klein
.tox/*/Lib/site-packages/klein
.tox/pypy*/site-packages/klein
[report]
exclude_lines =
pragma: no cover
if TYPE_CHECKING:
\s*\.\.\.$
klein-24.8.0/.flake8 0000664 0000000 0000000 00000003557 14656265100 0014101 0 ustar 00root root 0000000 0000000 [flake8]
# !!! BRING THE PAIN !!!
select = A,B,B9,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
show-source = True
doctests = True
max-line-length = 80
extend-exclude =
.git,
.tox,
__pycache__,
dist
# Codes: https://flake8.pycqa.org/en/latest/user/error-codes.html
extend-ignore =
######## WARNINGS BELOW SHOULD BE FIXED ########
# Missing docstring in public module
D100,
# Missing docstring in public class
D101,
# Missing docstring in public method
D102,
# Missing docstring in public function
D103,
# Missing docstring in public package
D104,
# Missing docstring in magic method
D105,
# Missing docstring in __init__
D107,
# Use """triple double quotes"""
D300,
# First word of the first line should be properly capitalized
D403,
# Additional newline in a group of imports
I202,
######## WARNINGS ABOVE SHOULD BE FIXED ########
# Invalid first argument used for instance method
B902,
# One-line docstring should fit on one line with quotes
D200,
# No blank lines allowed after function docstring
D202,
# 1 blank line required between summary line and description
D205,
# First line should end with a period
D400,
# First line should be in imperative mood
D401,
# missing whitespace after ','
E231,
# function name should be lowercase
N802,
# argument name should be lowercase
N803,
# first argument of a method should be named 'self'
N805,
# variable in function should be lowercase
N806,
# lowercase imported as non lowercase
N812,
# variable in class scope should not be mixedCase
N815,
# variable in global scope should not be mixedCase
N816,
# line break before binary operator
W503,
B901,
B904,
B907,
D419,
N818,
klein-24.8.0/.github/ 0000775 0000000 0000000 00000000000 14656265100 0014254 5 ustar 00root root 0000000 0000000 klein-24.8.0/.github/CODEOWNERS 0000664 0000000 0000000 00000000046 14656265100 0015647 0 ustar 00root root 0000000 0000000 * @twisted/twisted-contributors
klein-24.8.0/.github/dependabot.yml 0000664 0000000 0000000 00000000657 14656265100 0017114 0 ustar 00root root 0000000 0000000 # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
allow:
- dependency-type: "all"
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- "dependencies"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
labels:
- "dependencies"
klein-24.8.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14656265100 0016311 5 ustar 00root root 0000000 0000000 klein-24.8.0/.github/workflows/cicd.yml 0000664 0000000 0000000 00000017112 14656265100 0017740 0 ustar 00root root 0000000 0000000 # Docs:
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions
name: CI
on:
push:
branches: ["trunk"]
pull_request:
branches: ["*"]
jobs:
lint:
name: Linters
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: System Python Information
uses: twisted/python-info-action@v1
- name: Set up Tox environment
run: |
pip install tox
tox run -e lint --notest
- name: Tox Python Information
uses: twisted/python-info-action@v1
with:
python-path: .tox/lint/*/python
- name: Run Linters
run: tox run -e lint
mypy:
name: Mypy (static type checker)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: System Python Information
uses: twisted/python-info-action@v1
- name: Set up Tox environment
run: |
pip install tox
tox run -e mypy --notest
- name: Tox Python Information
uses: twisted/python-info-action@v1
with:
python-path: .tox/mypy/*/python
- name: Run Mypy
run: tox run -e mypy
docs:
name: Build documentation
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: System Python Information
uses: twisted/python-info-action@v1
- name: Set up Tox environment
run: |
pip install tox
tox run -e docs --notest
- name: Tox Python Information
uses: twisted/python-info-action@v1
with:
python-path: .tox/docs/*/python
- name: Build documentation
run: tox run -e docs
docs-linkcheck:
name: Documentation link check
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: System Python Information
uses: twisted/python-info-action@v1
- name: Set up Tox environment
run: |
pip install tox
tox run -e docs-linkcheck --notest
- name: Tox Python Information
uses: twisted/python-info-action@v1
with:
python-path: .tox/docs-linkcheck/*/python
- name: Check for broken links in documentation
run: tox run -e docs-linkcheck
packaging:
name: Packaging
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: System Python Information
uses: twisted/python-info-action@v1
- name: Set up Tox environment
run: |
pip install tox
tox run -e packaging --notest
- name: Tox Python Information
uses: twisted/python-info-action@v1
with:
python-path: .tox/packaging/*/python
- name: Check packaging
run: tox run -e packaging
unit:
name: "Py:${{ matrix.python-version }} - Tw:${{ matrix.twisted-version }} - ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
continue-on-error: ${{ matrix.optional }}
strategy:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7", "3.9", "3.10", "3.11"]
twisted-version: ["21.2", "22.1", "23.8"]
tox-prefix: ["coverage"]
optional: [false]
include:
- os: "ubuntu-latest"
python-version: "pypy-3.8"
twisted-version: "23.8"
tox-prefix: "test"
optional: false
- os: "ubuntu-latest"
python-version: "pypy-3.9"
twisted-version: "23.8"
tox-prefix: "test"
optional: false
# Test Python 3.12 but allow it to fail
- os: "ubuntu-latest"
python-version: "3.12.0"
twisted-version: "23.8"
tox-prefix: "test"
optional: true
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: System Python Information
uses: twisted/python-info-action@v1
- name: Translate Python version to Tox environment
shell: python
run: |
from os import environ
from pathlib import Path
py = "${{ matrix.python-version }}"
py = "".join(py.split(".")[:2]) # Combine major/minor, toss rest
py = py.replace("pypy-", "py") # For Pypy: have a litte less py
tw = "${{ matrix.twisted-version }}"
tw = tw.replace(".", "")
env = f"${{ matrix.tox-prefix }}-py{py}-tw{tw}"
print(f"TOX_ENV={env}")
p = Path(environ["GITHUB_ENV"])
f = p.open(mode="a")
f.write(f"TOX_ENV={env}\n")
- name: Set up Tox environment
run: |
pip install tox
tox run -e ${TOX_ENV} --notest
- name: Tox Python Information
uses: twisted/python-info-action@v1
with:
python-path: .tox/${TOX_ENV}/*/python
- name: Run unit tests
run: tox run -e ${TOX_ENV}
- name: Upload Trial log artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: trial
path: .tox/${TOX_ENV}/log/trial.log
# Use the latest supported Python version for combining coverage to
# prevent parsing errors in older versions when looking at modern code.
- uses: "actions/setup-python@v4"
with:
python-version: "3.11"
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v3"
if: ${{ matrix.tox-prefix == 'coverage' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: GITHUB_REF,GITHUB_COMMIT,GITHUB_USER,GITHUB_WORKFLOW
fail_ci_if_error: true
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_COMMIT: ${{ github.sha }}
GITHUB_USER: ${{ github.actor }}
GITHUB_WORKFLOW: ${{ github.workflow }}
# Helper so that on GitHub repo settings we can configure to single job.
# Then required jobs can be updated directly form the code,
# without having to go the GitHub repo setting -> Protected branch
# and all the clicking.
klein-required:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
# Add here the jobs that should block the merge of a PR.
needs:
- lint
- mypy
- docs
- docs-linkcheck
- packaging
- unit
steps:
- name: Require all successes
shell: python3 {0}
env:
RESULTS: ${{ toJSON(needs.*.result) }}
run: |
import json
import os
import sys
results = json.loads(os.environ["RESULTS"])
sys.exit(0 if all(result == "success" for result in results) else 1)
klein-24.8.0/.gitignore 0000664 0000000 0000000 00000000212 14656265100 0014677 0 ustar 00root root 0000000 0000000 *.pyc
*~
.DS_Store
/.eggs
/.tox/
/apidocs/
/build/
/dist/
/docs/_build/
/htmlcov/
/htmldocs/
/src/*.egg-info
coverage.xml
*/__pycache__/*
klein-24.8.0/.isort.cfg 0000664 0000000 0000000 00000000654 14656265100 0014620 0 ustar 00root root 0000000 0000000 [settings]
# Play nice with Black
profile = black
# Put two blank lines after imports
lines_after_imports = 2
# Match max-line-length in Flake8 config
line_length = 80
# Default puts 1st party before 3rd party, this reverses that and adds
# Twisted as a second party in the middle.
known_secondparty = twisted
sections = FUTURE,STDLIB,THIRDPARTY,SECONDPARTY,FIRSTPARTY,LOCALFOLDER
# Skip generated files
skip = _version.py
klein-24.8.0/.pre-commit-config.yaml 0000664 0000000 0000000 00000005403 14656265100 0017177 0 ustar 00root root 0000000 0000000 ci:
skip:
- check-manifest
repos:
- repo: https://github.com/asottile/pyupgrade
rev: "v3.4.0"
hooks:
- id: pyupgrade
args: ["--py37-plus", "--keep-runtime-typing"]
- repo: https://github.com/psf/black
rev: "23.3.0"
hooks:
- id: black
- repo: https://github.com/PyCQA/autoflake
rev: "v2.1.1"
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
- --expand-star-imports
- --remove-duplicate-keys
- --remove-unused-variables
- repo: https://github.com/PyCQA/flake8
rev: "6.0.0"
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==23.5.9
- flake8-docstrings==1.7.0
- flake8-mutable==1.2.0
- flake8-pep3101==2.0.0
- pep8-naming==0.13.3
- pycodestyle==2.10.0
- pydocstyle==6.3.0
- pyflakes==3.0.1
- repo: https://github.com/asottile/yesqa
rev: "v1.4.0"
hooks:
- id: yesqa
additional_dependencies:
- flake8-bugbear==23.3.23
- flake8-docstrings==1.7.0
- flake8-mutable==1.2.0
- flake8-pep3101==2.0.0
- pep8-naming==0.13.3
- pycodestyle==2.10.0
- pydocstyle==6.3.0
- pyflakes==3.0.1
- repo: https://github.com/PyCQA/isort
rev: "5.12.0"
hooks:
- id: isort
args: ["--filter-files"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.4.0"
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: forbid-new-submodules
- id: mixed-line-ending
# - id: no-commit-to-branch
# args: ["--branch", "master"]
- id: name-tests-test
args:
- --pytest-test-first
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.10.0"
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-eval
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
hooks:
- id: check-manifest
klein-24.8.0/.readthedocs.yml 0000664 0000000 0000000 00000001331 14656265100 0016000 0 ustar 00root root 0000000 0000000 # .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf
# Optionally declare the Python requirements required to build your docs
python:
install:
- path: "."
- requirements: "requirements/sphinx.txt"
klein-24.8.0/AUTHORS 0000664 0000000 0000000 00000000351 14656265100 0013763 0 ustar 00root root 0000000 0000000 Aaron Gallagher
Alex Gaynor
Amber Brown / HawkOwl
Brighid McDonnell
Corbin Simpson
David Reid
Deven Phillips
Glyph Lefkowitz
Hynek Schlawack
Matt Haggard
Moshe Zadka
Paul Hummer
Russel Haering
Tom Most
Wilfredo Sánchez Vega
Evilham
klein-24.8.0/CONTRIBUTING.rst 0000664 0000000 0000000 00000011563 14656265100 0015363 0 ustar 00root root 0000000 0000000 =====================
Contributing to Klein
=====================
Klein is an open source project that welcomes contributions of all kinds coming from the community, including:
- code patches,
- `documentation `_ improvements,
- `bug reports `_,
- reviews for `contributed patches `_.
Getting started
===============
Here is a list of shell commands that will install the dependencies of Klein, run the test suite with Python 3.8 and Twisted 23.8, compile the documentation, and check for coding style issues with flake8.
.. code-block:: shell
pip install --user tox
tox -e py312-tw238
tox -e docs
tox -e flake8
`Tox `_ makes a virtualenv, installs Klein's dependencies into the virtualenv, and then runs a set of commands based on the ``-e`` (environment) argument.
This strategy allows one to make and test changes to Klein without needing to change system-level Python packages.
Next steps
==========
Here are some suggestions to make the contributing process easier for everyone:
Code
----
- Use `Twisted's coding standards `_ as a guideline for code changes you make.
Some parts of Klein (eg. ``klein.resource.ensure_utf8_bytes``) do not adhere to the Twisted style guide, but changing that would break public APIs, which is worse than breaking the style guidelines.
Similarly, if you change existing code, following the Twisted style guide is good, but is less important than not breaking public APIs.
- Compatibility across versions is important: here are `Twisted's compatibility guidelines `_, which Klein shares.
- If you're adding a new feature, please add a file with an example and some explanation to the `examples directory `_, then add your example to ``/docs/index.rst``.
- Please run ``tox -e flake8`` to check for style issues in changed code.
Flake8 and similar tools expose many small-but-common errors early enough that it's easy to remedy the problem.
- Code changes should have tests: untested code is buggy code.
Klein uses `Twisted Trial `_ and `tox `_ for its tests.
The command to run the full test suite is ``tox`` with no arguments.
This will run tests against several versions of Python and Twisted, which can be time-consuming.
To run tests against only one or a few versions, pass a ``-e`` argument with an environment from the envlist in ``tox.ini``: for example, ``tox -e py38-tw238`` will run tests with Python 3.8 and Twisted 23.8.
To run only one or a few specific tests in the suite, add a filename or fully-qualified Python path to the end of the test invocation: for example, ``tox klein.test.test_app.KleinTestCase.test_foo`` will run only the ``test_foo()`` method of the ``KleinTestCase`` class in ``klein/test/test_app.py``.
These two test shortcuts can be combined to give you a quick feedback cycle, but make sure to check on the full test suite from time to time to make sure changes haven't had unexpected side effects.
- Show us your code changes through pull requests sent to `Klein's GitHub repo `_.
This is the best way to make your code visible to others and to get feedback about it.
- If your pull request is a work in progress, please put ``[WIP]`` in its title.
- Add yourself to ``AUTHORS``.
**Your contribution matters.**
Documentation
-------------
Klein uses `Epydoc `_ for docstrings in code and uses `Sphinx `_ for standalone documentation.
- In documents with headers, use this format and order for headers::
========
Header 1
========
Header 2
========
Header 3
--------
Header 4
~~~~~~~~
- In prose, please use gender-neutral pronouns or structure sentences such that using pronouns is unnecessary.
- It's best to put each sentence on a different line: this makes diffs much easier to read.
Sentences that are part of list items need to be indented to be considered part of the same list item.
Reviewing
---------
All code changes added to Klein must be reviewed by at least one other person who is not an author of the code being added.
This helps prevent bugs from slipping through the net, gives another source for improvements, and makes sure that the code productively follows guidelines.
Reviewers should read `Glyph's mailing list post `_ on reviewing -- code and docs don't have to be *perfect*, only *better*.
klein-24.8.0/LICENSE 0000664 0000000 0000000 00000002124 14656265100 0013720 0 ustar 00root root 0000000 0000000 This is the MIT license.
Copyright (c) 2011-2021, Klein Contributors (see AUTHORS)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
klein-24.8.0/MANIFEST.in 0000664 0000000 0000000 00000000776 14656265100 0014464 0 ustar 00root root 0000000 0000000 include .codecov.yml
include .coveragerc
include .flake8
include .isort.cfg
include .pre-commit-config.yaml
include .readthedocs.yml
include .travis/twistedchecker-diff
include AUTHORS
include CONTRIBUTING.rst
include docs/Makefile
include LICENSE
include mypy.ini
include NEWS.rst
include pyproject.toml
include README.rst
include release.py
include tox.ini
recursive-include docs *.py
recursive-include docs *.rst
recursive-include docs *.txt
recursive-exclude docs/_build *
recursive-exclude requirements *
klein-24.8.0/NEWS.rst 0000664 0000000 0000000 00000010354 14656265100 0014225 0 ustar 00root root 0000000 0000000 NEWS
====
23.12.0 - 2023-12-22
--------------------
* Fixed a compatibility issue with Werkzeug versions greater than 2.2. [`#575 `]
* Added explicit support for Python 3.10 and 3.11, although in practice they did work previously in 21.8. [`#578 `]
* Python 3.6 is no longer supported by Klein.
21.8.0 - 2021-08-08
-------------------
* Python 2 is no longer supported by Klein.
* Python 3.5 is no longer supported by Klein.
* Python 3.9 is now supported by Klein. [`#412 `_]
* Fixed a compatibility issue with Twisted versions greater than 20.3.0 in Klein's test suite. [`#383 `]
* Fixed a compatibility issue with Werkzeug versions greater than 2.0 in Klein's test suite. [`#499 `]
* Klein has incomplete, but growing type hints, but ``py.typed`` is not installed, as they might not work well for most clients yet.
* ``Plating`` now sets the ``Content-Type`` header to ``application/json`` instead of ``text/json; charset=utf8``.
20.6.0 - 2020-06-07
-------------------
* This is the last release of Klein expected to support Python 2.
* This is the last release of Klein expected to support Python 3.5.
* Python 3.4 is no longer supported by Klein. [`#284 `_]
* Python 3.8 is now supported by Klein. [`#303 `_]
* ``klein.app.subroute`` is now also available as ``klein.subroute``. [`#293 `_]
* Support for forms and sessions. [`#276 `_]
* The ``Klein`` class now supports deep copy by implementing ``__copy__``. [`#74 `_]
19.6.0 - 2019-06-07
-------------------
New "forms" and "sessions" subsystems provide official support for POST requests, including CSRF protection, form generation to include CSRF tokens, dependency injection to populate parameters from both the request and session, as well as lightweight JSON API support.
17.10.0 - 2017-10-22
--------------------
17.2.0 - 2017-03-03
-------------------
16.12.0 - 2016-12-13
--------------------
15.3.1 - 2015-12-17
-------------------
15.2.0 - 2015-11-30
-------------------
15.1.0 - 2015-07-08
-------------------
15.0.0 - 2015-01-11
-------------------
* [BUG] Klein now includes its test package as part of the distribution. [`#65 `_]
14.0.0 - 2014-12-18
-------------------
* [BUG] Klein now attempts to decode non-ASCII URLs as UTF-8 and serves a 400 if that fails instead of always serving a 500. [`#62 `_]
0.2.3 - 2014-01-14
------------------
* [BUG] Klein now correctly handles producing resources [`#30 `_]
* [ENHANCEMENT] Klein now supports using tox for local testing [`#36 `_]
* [ENHANCEMENT] Klein has improved tests and an expanded range of test platforms [`#33 `_, `#35 `_, `#37 `_]
0.2.2 - 2013-11-21
------------------
* [ENHANCEMENT] Klein.handle_errors now allows the definition of custom error handling behavior. [`#26 `_]
0.2.1 - 2013-07-23
------------------
* [BUG] Klein has been updated to support the latest werkzeug release: [`#21 `_]
* [BUG] request.URLPath inside a handler points to the correct path. [`#15 `_]
* [ENHANCEMENT] IKleinRequest(request).url_for is supported: [`#16 `_]
0.2.0 - 2013-02-27
------------------
* [BUG] Remove support for implicit branch routes. [`#12 `_]
* [FEATURE] Support creating Klein apps that are bound to an instance of a class. [`#9 `_]
0.1.1 - 2013-02-25
------------------
* Include headers when handling werkzeug HTTPExceptions.
0.1.0 - 2013-01-04
------------------
* Initial release
klein-24.8.0/README.rst 0000664 0000000 0000000 00000004240 14656265100 0014403 0 ustar 00root root 0000000 0000000 ============================
Klein, a Web Micro-Framework
============================
.. image:: https://github.com/twisted/klein/workflows/CI/badge.svg?branch=trunk
:target: https://github.com/twisted/klein/actions
:alt: Build Status
.. image:: https://codecov.io/github/twisted/klein/coverage.svg?branch=trunk
:target: https://codecov.io/github/twisted/klein?branch=trunk
:alt: Code Coverage
.. image:: https://img.shields.io/pypi/pyversions/klein.svg
:target: https://pypi.org/project/klein
:alt: Python Version Compatibility
Klein is a micro-framework for developing production-ready web services with Python.
It is 'micro' in that it has an incredibly small API similar to `Bottle `_ and `Flask `_.
It is not 'micro' in that it depends on things outside the standard library.
This is primarily because it is built on widely used and well tested components like `Werkzeug `_ and `Twisted `_.
A `Klein bottle `_ is an example of a non-orientable surface, and a glass Klein bottle looks like a twisted bottle or twisted flask.
This, of course, made it too good of a pun to pass up.
Klein's documentation can be found at `Read The Docs `_.
Example
========
This is a sample Klein application that returns 'Hello, world!', running on port ``8080``.
.. code-block:: python
from klein import run, route
@route('/')
def home(request):
return 'Hello, world!'
run("localhost", 8080)
Contribute
==========
``klein`` is hosted on `GitHub `_ and is an open source project that welcomes contributions of all kinds from the community, including:
- code patches,
- `documentation `_ improvements,
- `bug reports `_,
- reviews for `contributed patches `_.
For more information about contributing, see `the contributor guidelines `_.
klein-24.8.0/docs/ 0000775 0000000 0000000 00000000000 14656265100 0013644 5 ustar 00root root 0000000 0000000 klein-24.8.0/docs/Makefile 0000664 0000000 0000000 00000012670 14656265100 0015312 0 ustar 00root root 0000000 0000000 # Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make ' where is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Klein.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Klein.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Klein"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Klein"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
klein-24.8.0/docs/_extensions/ 0000775 0000000 0000000 00000000000 14656265100 0016202 5 ustar 00root root 0000000 0000000 klein-24.8.0/docs/_extensions/apilinks.py 0000664 0000000 0000000 00000002472 14656265100 0020373 0 ustar 00root root 0000000 0000000 """
Sphinx/docutils extension to create links to pyDoctor documentation using a
RestructuredText interpreted text role that looks like this::
:api:`python_object_to_link_to