mirror of
https://github.com/kennethreitz/responder.git
synced 2026-10-24 05:59:12 +00:00
230 lines
13 KiB
HTML
230 lines
13 KiB
HTML
<!DOCTYPE html>
|
||
|
||
<html lang="en" data-content_root="./">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
||
<title>Development Sandbox — responder 9.2.0 documentation</title>
|
||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=5ecbeea2" />
|
||
<link rel="stylesheet" type="text/css" href="_static/basic.css?v=b08954a9" />
|
||
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=eb4102c5" />
|
||
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
|
||
<link rel="stylesheet" type="text/css" href="_static/sphinx-design.min.css?v=95c83b7e" />
|
||
<link rel="stylesheet" type="text/css" href="_static/design-elements.e5416f61bae5d36adc6d722a2b6f8cff.css?v=452a8e97" />
|
||
<script src="_static/documentation_options.js?v=e8b940be"></script>
|
||
<script src="_static/doctools.js?v=fd6eb6e6"></script>
|
||
<script src="_static/sphinx_highlight.js?v=6ffebe34"></script>
|
||
<script src="_static/clipboard.min.js?v=a7894cd8"></script>
|
||
<script src="_static/copybutton.js?v=fd10adb8"></script>
|
||
<script>
|
||
</script>
|
||
<script src="_static/design-tabs.js?v=f930bc37"></script>
|
||
<script src="_static/design-elements.bbdccc18c4abea9397628f9fea3d48c2.js?v=03c7770e"></script>
|
||
<link rel="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
<link rel="next" title="Backlog" href="backlog.html" />
|
||
<link rel="prev" title="Migrating to Responder 5.0" href="migration-v5.html" />
|
||
|
||
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
|
||
|
||
|
||
|
||
|
||
|
||
</head><body>
|
||
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
|
||
|
||
<div class="body" role="main">
|
||
|
||
<section id="development-sandbox">
|
||
<span id="sandbox"></span><h1>Development Sandbox<a class="headerlink" href="#development-sandbox" title="Link to this heading">¶</a></h1>
|
||
<section id="setup">
|
||
<h2>Setup<a class="headerlink" href="#setup" title="Link to this heading">¶</a></h2>
|
||
<p>Clone the repo and install all dependencies:</p>
|
||
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/kennethreitz/responder.git
|
||
<span class="nb">cd</span><span class="w"> </span>responder
|
||
uv<span class="w"> </span>venv<span class="w"> </span><span class="o">&&</span><span class="w"> </span><span class="nb">source</span><span class="w"> </span>.venv/bin/activate
|
||
uv<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>--upgrade<span class="w"> </span>--editable<span class="w"> </span><span class="s1">'.[develop,docs,release,test]'</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Working on the CLI or GraphQL extensions? Add their extras too:</p>
|
||
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>uv<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>--upgrade<span class="w"> </span>--editable<span class="w"> </span><span class="s1">'.[cli,graphql]'</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>The commands below assume the venv is activated. If you’d rather not activate it,
|
||
prefix any command with <code class="docutils literal notranslate"><span class="pre">uv</span> <span class="pre">run</span></code> (e.g. <code class="docutils literal notranslate"><span class="pre">uv</span> <span class="pre">run</span> <span class="pre">pytest</span></code>, <code class="docutils literal notranslate"><span class="pre">uv</span> <span class="pre">run</span> <span class="pre">ruff</span> <span class="pre">check</span> <span class="pre">.</span></code>,
|
||
<code class="docutils literal notranslate"><span class="pre">uv</span> <span class="pre">run</span> <span class="pre">mypy</span></code>) and uv resolves the environment for you.</p>
|
||
</section>
|
||
<section id="running-tests">
|
||
<h2>Running Tests<a class="headerlink" href="#running-tests" title="Link to this heading">¶</a></h2>
|
||
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pytest<span class="w"> </span><span class="c1"># full suite with coverage</span>
|
||
pytest<span class="w"> </span>tests/test_responder.py<span class="w"> </span>-xvs<span class="w"> </span><span class="c1"># single file, stop on first failure</span>
|
||
pytest<span class="w"> </span>-k<span class="w"> </span><span class="s2">"test_mount"</span><span class="w"> </span><span class="c1"># run tests matching a pattern</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="code-formatting">
|
||
<h2>Code Formatting<a class="headerlink" href="#code-formatting" title="Link to this heading">¶</a></h2>
|
||
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>ruff<span class="w"> </span>format<span class="w"> </span>.<span class="w"> </span><span class="c1"># auto-format</span>
|
||
ruff<span class="w"> </span>check<span class="w"> </span>--fix<span class="w"> </span>.<span class="w"> </span><span class="c1"># lint and auto-fix</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="type-checking">
|
||
<h2>Type Checking<a class="headerlink" href="#type-checking" title="Link to this heading">¶</a></h2>
|
||
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>mypy
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="documentation">
|
||
<h2>Documentation<a class="headerlink" href="#documentation" title="Link to this heading">¶</a></h2>
|
||
<p>Live-reloading doc server (opens in browser):</p>
|
||
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span>docs
|
||
sphinx-autobuild<span class="w"> </span>--open-browser<span class="w"> </span>--watch<span class="w"> </span><span class="nb">source</span><span class="w"> </span><span class="nb">source</span><span class="w"> </span>build
|
||
</pre></div>
|
||
</div>
|
||
<p>Or build once:</p>
|
||
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span>docs
|
||
make<span class="w"> </span>html
|
||
<span class="c1"># open build/html/index.html</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="project-layout">
|
||
<h2>Project Layout<a class="headerlink" href="#project-layout" title="Link to this heading">¶</a></h2>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>responder/
|
||
├── responder/ # main package
|
||
│ ├── api.py # API class — the entry point
|
||
│ ├── core.py # public API surface (re-exports)
|
||
│ ├── routes.py # Router, Route, WebSocketRoute, dependency injection
|
||
│ ├── models.py # Request and Response wrappers
|
||
│ ├── params.py # typed parameter markers (Query/Header/Cookie/Path)
|
||
│ ├── types.py # public type aliases (Handler, Hook, Dependency)
|
||
│ ├── background.py # background task queue
|
||
│ ├── formats.py # content negotiation (JSON, YAML, msgpack)
|
||
│ ├── templates.py # Jinja2 template rendering
|
||
│ ├── staticfiles.py # static file serving
|
||
│ ├── status_codes.py # HTTP status-code table
|
||
│ └── ext/ # extensions
|
||
│ ├── cli.py # command-line interface
|
||
│ ├── sessions.py # cookie & server-side sessions, backends
|
||
│ ├── logging.py # request logging + request-id middleware
|
||
│ ├── metrics.py # Prometheus-style metrics endpoint
|
||
│ ├── ratelimit.py # rate limiting
|
||
│ ├── openapi/ # OpenAPI schema + interactive docs
|
||
│ └── graphql/ # GraphQL support
|
||
├── tests/ # pytest test suite
|
||
├── examples/ # runnable example apps
|
||
├── docs/source/ # Sphinx documentation
|
||
└── pyproject.toml # project metadata and tool config
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
||
<div class="sphinxsidebarwrapper"><p class="logo">
|
||
<a href="index.html">
|
||
<img class="logo" src="_static/responder.png" />
|
||
</a>
|
||
</p>
|
||
<p>
|
||
<strong>Responder</strong> — a familiar HTTP service framework for Python.
|
||
<br />
|
||
<small>v9.2.0</small>
|
||
</p>
|
||
<h3>Useful Links</h3>
|
||
<ul>
|
||
<li><a href="https://github.com/kennethreitz/responder">Responder @ GitHub</a></li>
|
||
<li><a href="https://pypi.org/project/responder/">Responder @ PyPI</a></li>
|
||
<li><a href="https://github.com/kennethreitz/responder/issues">Issue Tracker</a></li>
|
||
</ul><h3>Navigation</h3>
|
||
<p class="caption" role="heading"><span class="caption-text">User Guide</span></p>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quick Start</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tour.html">Feature Tour</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="routers.html">Composing Apps with Routers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="guide-config.html">Configuration</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="clientgen.html">Generated Clients</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="deployment.html">Deployment</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="testing.html">Testing</a></li>
|
||
</ul>
|
||
<p class="caption" role="heading"><span class="caption-text">Tutorials</span></p>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-rest.html">Building a REST API</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-sqlalchemy.html">Using SQLAlchemy</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-auth.html">Authentication</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-websockets.html">WebSocket Tutorial</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-middleware.html">Writing Middleware</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-flask.html">Migrating from Flask</a></li>
|
||
</ul>
|
||
<p class="caption" role="heading"><span class="caption-text">Reference</span></p>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="api.html">API Reference</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="cli.html">Command Line Interface</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="runtime-contracts.html">Runtime Contracts</a></li>
|
||
</ul>
|
||
<p class="caption" role="heading"><span class="caption-text">Project</span></p>
|
||
<ul class="current">
|
||
<li class="toctree-l1"><a class="reference internal" href="changes.html">Changelog</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="migration-v9.html">Migrating to v9</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="migration-v8.html">Migrating to v8</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="migration-v7.html">Migrating to v7</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="migration-v6.html">Migrating to v6</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="migration-v5.html">Migrating to v5</a></li>
|
||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Sandbox</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="backlog.html">Backlog</a></li>
|
||
</ul>
|
||
|
||
<div class="relations">
|
||
<h3>Related Topics</h3>
|
||
<ul>
|
||
<li><a href="index.html">Documentation overview</a><ul>
|
||
<li>Previous: <a href="migration-v5.html" title="previous chapter">Migrating to Responder 5.0</a></li>
|
||
<li>Next: <a href="backlog.html" title="next chapter">Backlog</a></li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
<search id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</search>
|
||
<script>document.getElementById('searchbox').style.display = "block"</script>
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="footer">
|
||
©2018-2026, Kenneth Reitz.
|
||
|
||
|
|
||
<a href="_sources/sandbox.md.txt"
|
||
rel="nofollow">Page source</a>
|
||
</div>
|
||
|
||
|
||
<a href="https://github.com/kennethreitz/responder" class="github">
|
||
<img src="_static/forkme_right_darkblue.png" alt="Fork me on GitHub" class="github"/>
|
||
</a>
|
||
|
||
|
||
|
||
</body>
|
||
</html> |