Skip to content

Commit

Permalink
Update Doc
Browse files Browse the repository at this point in the history
  • Loading branch information
AliRn76 committed Jan 4, 2024
1 parent b13d793 commit 20fd36c
Show file tree
Hide file tree
Showing 24 changed files with 362 additions and 169 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


<link rel="icon" href="/assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.2">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.3">



Expand Down
2 changes: 1 addition & 1 deletion authentications/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.2">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.3">



Expand Down
2 changes: 1 addition & 1 deletion background_tasks/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.2">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.3">



Expand Down
2 changes: 1 addition & 1 deletion caching/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.2">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.3">



Expand Down
2 changes: 1 addition & 1 deletion class_first_crud/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.2">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.3">



Expand Down
2 changes: 1 addition & 1 deletion configs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.2">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.3">



Expand Down
2 changes: 1 addition & 1 deletion function_first_crud/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.2">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.3">



Expand Down
Binary file modified images/roadmap.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
173 changes: 73 additions & 100 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


<link rel="icon" href="assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.2">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.3">



Expand Down Expand Up @@ -311,6 +311,15 @@
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#supported-by" class="md-nav__link">
<span class="md-ellipsis">
Supported by
</span>
</a>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -383,28 +392,18 @@
</li>

<li class="md-nav__item">
<a href="#example" class="md-nav__link">
<a href="#single-file-structure-example" class="md-nav__link">
<span class="md-ellipsis">
Example
</span>
</a>

<nav class="md-nav" aria-label="Example">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#you-can-create-project-with" class="md-nav__link">
<span class="md-ellipsis">
You can create project with
Single-File Structure Example
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#or-create-it-yourself" class="md-nav__link">
<a href="#roadmap" class="md-nav__link">
<span class="md-ellipsis">
or create it yourself:
Roadmap
</span>
</a>

Expand All @@ -413,11 +412,6 @@
</ul>
</nav>

</li>

</ul>
</nav>

</li>

</ul>
Expand Down Expand Up @@ -835,6 +829,15 @@
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#supported-by" class="md-nav__link">
<span class="md-ellipsis">
Supported by
</span>
</a>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -907,28 +910,18 @@
</li>

<li class="md-nav__item">
<a href="#example" class="md-nav__link">
<span class="md-ellipsis">
Example
</span>
</a>

<nav class="md-nav" aria-label="Example">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#you-can-create-project-with" class="md-nav__link">
<a href="#single-file-structure-example" class="md-nav__link">
<span class="md-ellipsis">
You can create project with
Single-File Structure Example
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#or-create-it-yourself" class="md-nav__link">
<a href="#roadmap" class="md-nav__link">
<span class="md-ellipsis">
or create it yourself:
Roadmap
</span>
</a>

Expand All @@ -937,11 +930,6 @@
</ul>
</nav>

</li>

</ul>
</nav>

</li>

</ul>
Expand All @@ -965,16 +953,11 @@
<h1>Introduction</h1>

<h2 id="panther">Panther<a class="headerlink" href="#panther" title="Permanent link">#</a></h2>
<p><b>Is A Fast &amp; Friendly Web Framework For Building Async APIs With Python 3.11+</b> </p>
<p align=center>
<p><b>Is A Fast &amp; Friendly Web Framework For Building Async APIs With Python 3.10+</b> </p>
<p align="center">
<img src="https://github.com/AliRn76/panther/raw/master/docs/docs/images/logo-vertical.png" alt="logo" style="width: 450px">
</p>

<p>
<img alt="logo" style="width: 50px" src="https://github.com/AliRn76/panther/raw/master/docs/docs/images/jb_beam_50x50.png">
<b>Supported by </b><a href="https://drive.google.com/file/d/17xe1hicIiRF7SQ-clg9SETdc19SktCbV/view?usp=sharing">JetBrains</a>
</p>

<p><center></p>
<p><a href="https://pypi.org/project/panther/"><img alt="PyPI" src="https://img.shields.io/pypi/v/panther?label=PyPI" /></a> <a href="https://pypi.org/project/panther/"><img alt="PyVersion" src="https://img.shields.io/pypi/pyversions/panther.svg" /></a> <a href="https://codecov.io/github/AliRn76/panther"><img alt="codecov" src="https://codecov.io/github/AliRn76/panther/graph/badge.svg?token=YWFQA43GSP" /></a> <a href="https://pepy.tech/project/panther"><img alt="Downloads" src="https://static.pepy.tech/badge/panther/month" /></a> <a href="https://github.com/alirn76/panther/blob/main/LICENSE"><img alt="license" src="https://img.shields.io/github/license/alirn76/panther.svg" /></a></p>
<p></center></p>
Expand All @@ -991,6 +974,13 @@ <h3 id="why-use-panther">Why Use Panther ?<a class="headerlink" href="#why-use-p
<li>Visual API Monitoring (In Terminal)</li>
</ul>
<hr />
<h3 id="supported-by">Supported by<a class="headerlink" href="#supported-by" title="Permanent link">#</a></h3>
<p><center>
<a href="https://drive.google.com/file/d/17xe1hicIiRF7SQ-clg9SETdc19SktCbV/view?usp=sharing">
<img alt="jetbrains" src="https://github.com/AliRn76/panther/raw/master/docs/docs/images/jb_beam_50x50.png">
</a>
</center></p>
<hr />
<h3 id="benchmark">Benchmark<a class="headerlink" href="#benchmark" title="Permanent link">#</a></h3>
<table>
<thead>
Expand Down Expand Up @@ -1039,32 +1029,33 @@ <h3 id="benchmark">Benchmark<a class="headerlink" href="#benchmark" title="Perma
</tbody>
</table>
<blockquote>
<p><strong>More Detail:</strong> https://github.com/PantherPy/frameworks-benchmark</p>
<p><strong>More Detail:</strong> <a href="https://GitHub.com/PantherPy/frameworks-benchmark">https://GitHub.com/PantherPy/frameworks-benchmark</a></p>
</blockquote>
<hr />
<h3 id="installation">Installation<a class="headerlink" href="#installation" title="Permanent link">#</a></h3>
<ul>
<li><details open>
<summary>Create a Virtual Environment</summary>
<li><details>
<summary>1. Create a Virtual Environment</summary>
<pre>$ python3 -m venv .venv</pre></li>
</ul>
</details>
<ul>
<li><details open>
<summary>Active The Environment</summary><ul>
<li><details>
<summary>2. Active The Environment</summary><ul>
<li>Linux &amp; Mac
<pre>$ source .venv/bin/activate</pre></li>
<li>Windows
<pre>$ .\.venv\Scripts\activate</pre></li>
<pre>$ ..venv\Scripts\activate</pre></li>
</ul>
</li>
</ul>
</details>
<ul>
<li><details open>
<summary>Install Panther</summary><ul>
<li>Normal
<pre>$ pip install panther</pre></li>
<li>Include MongoDB Requirements
<summary>3. <b>Install Panther</b></summary><ul>
<li>Normal Installation
<pre><b>$ pip install panther</b></pre></li>
<li>Include full requirements (MongoDB, JWTAuth, Ruff, Redis, bpython)
<pre>$ pip install panther[full]</pre>
</details></li>
</ul>
Expand All @@ -1075,14 +1066,14 @@ <h3 id="usage">Usage<a class="headerlink" href="#usage" title="Permanent link">#
<ul>
<li>
<h4 id="create-project">Create Project<a class="headerlink" href="#create-project" title="Permanent link">#</a></h4>
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>panther<span class="w"> </span>create<span class="w"> </span>&lt;project_name&gt;<span class="w"> </span>&lt;directory&gt;
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>panther<span class="w"> </span>create
</code></pre></div>
</li>
<li>
<h4 id="run-project">Run Project<a class="headerlink" href="#run-project" title="Permanent link">#</a></h4>
<p>Panther uses <a href="https://github.com/encode/uvicorn">Uvicorn</a> as ASGI (Asynchronous Server Gateway Interface)</p>
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>panther<span class="w"> </span>run<span class="w"> </span>
<p><div class="highlight"><pre><span></span><code><span class="gp">$ </span>panther<span class="w"> </span>run<span class="w"> </span>--reload
</code></pre></div>
<em>* Panther uses <a href="https://github.com/encode/uvicorn">Uvicorn</a> as ASGI (Asynchronous Server Gateway Interface) but you can run the project with <a href="https://pypi.org/project/granian/">Granian</a>, <a href="https://pypi.org/project/daphne/">daphne</a> or any ASGI server too</em></p>
</li>
<li>
<h4 id="monitoring-requests">Monitoring Requests<a class="headerlink" href="#monitoring-requests" title="Permanent link">#</a></h4>
Expand All @@ -1091,50 +1082,26 @@ <h4 id="monitoring-requests">Monitoring Requests<a class="headerlink" href="#mon
</li>
<li>
<h4 id="python-shell">Python Shell<a class="headerlink" href="#python-shell" title="Permanent link">#</a></h4>
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>panther<span class="w"> </span>shell<span class="w"> </span>
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>panther<span class="w"> </span>shell
</code></pre></div>
</li>
</ul>
<hr />
<h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">#</a></h3>
<h3 id="single-file-structure-example">Single-File Structure Example<a class="headerlink" href="#single-file-structure-example" title="Permanent link">#</a></h3>
<ul>
<li>
<h4 id="you-can-create-project-with">You can create project with<a class="headerlink" href="#you-can-create-project-with" title="Permanent link">#</a></h4>
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>panther<span class="w"> </span>create<span class="w"> </span>myproject
</code></pre></div>
</li>
<li>
<h4 id="or-create-it-yourself">or create it yourself:<a class="headerlink" href="#or-create-it-yourself" title="Permanent link">#</a></h4>
<p><strong>core/configs.py</strong>:</p>
<div class="highlight"><pre><span></span><code><span class="n">URLs</span> <span class="o">=</span> <span class="s1">&#39;core.urls.url_routing&#39;</span>
</code></pre></div>
<p><strong>core/urls.py</strong>:</p>
<div class="highlight"><pre><span></span><code><span class="kn">from</span> <span class="nn">app.urls</span> <span class="kn">import</span> <span class="n">urls</span> <span class="k">as</span> <span class="n">app_urls</span>

<span class="n">url_routing</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">&#39;/&#39;</span><span class="p">:</span> <span class="n">app_urls</span><span class="p">,</span>
<span class="p">}</span>
</code></pre></div>
<p><strong>app/urls.py</strong>:</p>
<div class="highlight"><pre><span></span><code><span class="kn">from</span> <span class="nn">app.apis</span> <span class="kn">import</span> <span class="n">hello_world</span><span class="p">,</span> <span class="n">info</span>

<span class="n">urls</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">&#39;&#39;</span><span class="p">:</span> <span class="n">hello_world</span><span class="p">,</span>
<span class="s1">&#39;info/&#39;</span><span class="p">:</span> <span class="n">info</span><span class="p">,</span>
<span class="p">}</span>
</code></pre></div>
<p><strong>app/apis.py</strong>:</p>
<p>Create <code>main.py</code></p>
<div class="highlight"><pre><span></span><code><span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span><span class="p">,</span> <span class="n">timedelta</span>

<span class="kn">from</span> <span class="nn">panther</span> <span class="kn">import</span> <span class="n">version</span><span class="p">,</span> <span class="n">status</span><span class="p">,</span> <span class="n">Panther</span>
<span class="kn">from</span> <span class="nn">panther.app</span> <span class="kn">import</span> <span class="n">API</span>
<span class="kn">from</span> <span class="nn">panther</span> <span class="kn">import</span> <span class="n">version</span><span class="p">,</span> <span class="n">status</span>
<span class="kn">from</span> <span class="nn">panther.request</span> <span class="kn">import</span> <span class="n">Request</span>
<span class="kn">from</span> <span class="nn">panther.response</span> <span class="kn">import</span> <span class="n">Response</span>
<span class="kn">from</span> <span class="nn">panther.throttling</span> <span class="kn">import</span> <span class="n">Throttling</span>


<span class="n">InfoThrottling</span> <span class="o">=</span> <span class="n">Throttling</span><span class="p">(</span><span class="n">rate</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">duration</span><span class="o">=</span><span class="n">timedelta</span><span class="p">(</span><span class="n">minutes</span><span class="o">=</span><span class="mi">1</span><span class="p">))</span>


<span class="nd">@API</span><span class="p">()</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">hello_world</span><span class="p">():</span>
<span class="k">return</span> <span class="p">{</span><span class="s1">&#39;detail&#39;</span><span class="p">:</span> <span class="s1">&#39;Hello World&#39;</span><span class="p">}</span>
Expand All @@ -1148,31 +1115,37 @@ <h4 id="or-create-it-yourself">or create it yourself:<a class="headerlink" href=
<span class="s1">&#39;user_agent&#39;</span><span class="p">:</span> <span class="n">request</span><span class="o">.</span><span class="n">headers</span><span class="o">.</span><span class="n">user_agent</span>
<span class="p">}</span>
<span class="k">return</span> <span class="n">Response</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="n">status_code</span><span class="o">=</span><span class="n">status</span><span class="o">.</span><span class="n">HTTP_202_ACCEPTED</span><span class="p">)</span>


<span class="n">url_routing</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">&#39;&#39;</span><span class="p">:</span> <span class="n">hello_world</span><span class="p">,</span>
<span class="s1">&#39;info&#39;</span><span class="p">:</span> <span class="n">info</span><span class="p">,</span>
<span class="p">}</span>

<span class="n">app</span> <span class="o">=</span> <span class="n">Panther</span><span class="p">(</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">configs</span><span class="o">=</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">urls</span><span class="o">=</span><span class="n">url_routing</span><span class="p">)</span>
</code></pre></div>
</li>
<li>
<p>Then <strong>run</strong> the project:</p>
<p>Run the project:</p>
<ul>
<li><code>$ panther run --reload</code> </li>
</ul>
</li>
<li>
<p><code>$ cd myproject</code></p>
</li>
<li><code>$ panther run</code> or <code>$ panther run --reload</code> </li>
</ul>
<p>now you can see these two urls:</b></p>
<ul>
<li>
<p><a href="http://127.0.0.1:8000/">http://127.0.0.1:8000/</a></p>
</li>
<li>
<p><a href="http://127.0.0.1:8000/info/">http://127.0.0.1:8000/info/</a></p>
<li><a href="http://127.0.0.1:8000/">http://127.0.0.1:8000/</a></li>
<li><a href="http://127.0.0.1:8000/info/">http://127.0.0.1:8000/info/</a></li>
</ul>
</li>
</ul>
<blockquote>
<p><strong>Writing Your First CRUD: <a href="https://pantherpy.github.io/function_first_crud/">First CRUD</a></strong></p>
<p><strong>Next Step: <a href="https://pantherpy.github.io/function_first_crud">First CRUD</a></strong></p>
<p><strong>Real Word Example: <a href="https://GitHub.com/PantherPy/panther-example">Https://GitHub.com/PantherPy/panther-example</a></strong></p>
</blockquote>
<hr />
<h3 id="roadmap">Roadmap<a class="headerlink" href="#roadmap" title="Permanent link">#</a></h3>
<p><img alt="roadmap" src="https://raw.githubusercontent.com/AliRn76/panther/master/docs/docs/images/roadmap.jpg" /></p>
<hr />



Expand Down
Loading

0 comments on commit 20fd36c

Please sign in to comment.