Skip to content

Commit

Permalink
Rename some stuff and regenerate docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
git-steven committed Mar 4, 2024
1 parent 07d3f6c commit 6d2d540
Show file tree
Hide file tree
Showing 22 changed files with 1,889 additions and 1,869 deletions.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,26 @@ PAO_APP_PACKAGE=yourapp.db
```

In this setup, there should be a `models.py` in the yourapp.db package. For example:

```python
from python_arango_ogm.db import model
from python_arango_ogm.db import pao_model


class FooModel(pao_model.PAOModel):
field_int = pao_model.IntField(index_name='field_int_idx')
field_str = pao_model.StrField(unique=True, index_name='field_str_idx')
bar_edge = pao_model.EdgeTo("BarModel")


class FooModel(model.Model):
field_int = model.IntField(index_name='field_int_idx')
field_str = model.StrField(unique=True, index_name='field_str_idx')
bar_edge = model.EdgeTo("BarModel")
class BarModel(pao_model.PAOModel):
field_int = pao_model.IntField(index_name='field_int_idx', required=True)
field_str = pao_model.StrField(unique=True, index_name='field_str_idx')

class BarModel(model.Model):
field_int = model.IntField(index_name='field_int_idx', required=True)
field_str = model.StrField(unique=True, index_name='field_str_idx')

class BazModel(model.Model):
field_int = model.IntField(index_name='field_int_idx', unique=True, required=True)
field_str = model.StrField(index_name='field_str_idx')
foo_edge = model.EdgeTo(FooModel)
class BazModel(pao_model.PAOModel):
field_int = pao_model.IntField(index_name='field_int_idx', unique=True, required=True)
field_str = pao_model.StrField(index_name='field_str_idx')
foo_edge = pao_model.EdgeTo(FooModel)
```

## Usage:
Expand Down
1 change: 1 addition & 0 deletions bin/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
source ${BASH_SOURCE%/*}/clean.sh
poetry run pdoc python_arango_ogm -o ./docs
poetry build
1 change: 1 addition & 0 deletions bin/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
find . -name __pycache__ | xargs rm -rf
find . -name .ipynb_checkpoints | xargs rm -rf
rm -rf dist
rm -rf docs
rm -rf .pytest_cache
rm -rf .ruff_cache
46 changes: 24 additions & 22 deletions docs/python_arango_ogm.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ <h2>Contents</h2>
<ul>
<li><a href="#python-arango-ogm">Python Arango OGM</a>
<ul>
<li><a href="#github">GitHub</a></li>
<li><a href="#documentation">Documentation</a></li>
<li><a href="#installation">Installation</a></li>
<li><a href="#getting-started">Getting started</a></li>
<li><a href="#usage">Usage:</a></li>
<li><a href="#github">GitHub</a></li>
<li><a href="#documentation">Documentation</a></li>
<li><a href="#development">Development</a></li>
</ul></li>
</ul>
Expand Down Expand Up @@ -58,6 +58,14 @@ <h1 class="modulename">

<p>Python-based package implementing an OGM framework for arango; built on top of python-arango.</p>

<h2 id="github">GitHub</h2>

<p><a href="https://github.com/tangledpath/python-arango-ogm">https://github.com/tangledpath/python-arango-ogm</a></p>

<h2 id="documentation">Documentation</h2>

<p><a href="https://tangledpath.github.io/python-arango-ogm/python_arango_ogm.html">https://tangledpath.github.io/python-arango-ogm/python_arango_ogm.html</a></p>

<h2 id="installation">Installation</h2>

<p>pip install python-arango-ogm</p>
Expand All @@ -81,22 +89,24 @@ <h2 id="getting-started">Getting started</h2>
<p>In this setup, there should be a <code>models.py</code> in the yourapp.db package. For example:</p>

<div class="pdoc-code codehilite">
<pre><span></span><code><span class="kn">from</span> <span class="nn"><a href="python_arango_ogm/db.html">python_arango_ogm.db</a></span> <span class="kn">import</span> <span class="n">model</span>
<pre><span></span><code><span class="kn">from</span> <span class="nn"><a href="python_arango_ogm/db.html">python_arango_ogm.db</a></span> <span class="kn">import</span> <span class="n">pao_model</span>


<span class="k">class</span> <span class="nc">FooModel</span><span class="p">(</span><span class="n">pao_model</span><span class="o">.</span><span class="n">PAOModel</span><span class="p">):</span>
<span class="n">field_int</span> <span class="o">=</span> <span class="n">pao_model</span><span class="o">.</span><span class="n">IntField</span><span class="p">(</span><span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_int_idx&#39;</span><span class="p">)</span>
<span class="n">field_str</span> <span class="o">=</span> <span class="n">pao_model</span><span class="o">.</span><span class="n">StrField</span><span class="p">(</span><span class="n">unique</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_str_idx&#39;</span><span class="p">)</span>
<span class="n">bar_edge</span> <span class="o">=</span> <span class="n">pao_model</span><span class="o">.</span><span class="n">EdgeTo</span><span class="p">(</span><span class="s2">&quot;BarModel&quot;</span><span class="p">)</span>


<span class="k">class</span> <span class="nc">FooModel</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
<span class="n">field_int</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">IntField</span><span class="p">(</span><span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_int_idx&#39;</span><span class="p">)</span>
<span class="n">field_str</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">StrField</span><span class="p">(</span><span class="n">unique</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_str_idx&#39;</span><span class="p">)</span>
<span class="n">bar_edge</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">EdgeTo</span><span class="p">(</span><span class="s2">&quot;BarModel&quot;</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">BarModel</span><span class="p">(</span><span class="n">pao_model</span><span class="o">.</span><span class="n">PAOModel</span><span class="p">):</span>
<span class="n">field_int</span> <span class="o">=</span> <span class="n">pao_model</span><span class="o">.</span><span class="n">IntField</span><span class="p">(</span><span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_int_idx&#39;</span><span class="p">,</span> <span class="n">required</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">field_str</span> <span class="o">=</span> <span class="n">pao_model</span><span class="o">.</span><span class="n">StrField</span><span class="p">(</span><span class="n">unique</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_str_idx&#39;</span><span class="p">)</span>

<span class="k">class</span> <span class="nc">BarModel</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
<span class="n">field_int</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">IntField</span><span class="p">(</span><span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_int_idx&#39;</span><span class="p">,</span> <span class="n">required</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">field_str</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">StrField</span><span class="p">(</span><span class="n">unique</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_str_idx&#39;</span><span class="p">)</span>

<span class="k">class</span> <span class="nc">BazModel</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
<span class="n">field_int</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">IntField</span><span class="p">(</span><span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_int_idx&#39;</span><span class="p">,</span> <span class="n">unique</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">required</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">field_str</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">StrField</span><span class="p">(</span><span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_str_idx&#39;</span><span class="p">)</span>
<span class="n">foo_edge</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">EdgeTo</span><span class="p">(</span><span class="n">FooModel</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">BazModel</span><span class="p">(</span><span class="n">pao_model</span><span class="o">.</span><span class="n">PAOModel</span><span class="p">):</span>
<span class="n">field_int</span> <span class="o">=</span> <span class="n">pao_model</span><span class="o">.</span><span class="n">IntField</span><span class="p">(</span><span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_int_idx&#39;</span><span class="p">,</span> <span class="n">unique</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">required</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">field_str</span> <span class="o">=</span> <span class="n">pao_model</span><span class="o">.</span><span class="n">StrField</span><span class="p">(</span><span class="n">index_name</span><span class="o">=</span><span class="s1">&#39;field_str_idx&#39;</span><span class="p">)</span>
<span class="n">foo_edge</span> <span class="o">=</span> <span class="n">pao_model</span><span class="o">.</span><span class="n">EdgeTo</span><span class="p">(</span><span class="n">FooModel</span><span class="p">)</span>
</code></pre>
</div>

Expand All @@ -120,14 +130,6 @@ <h3 id="in-code">In code</h3>
<p>You may use your models to perform various queries and commands
<strong>TODO</strong>: document this more</p>

<h2 id="github">GitHub</h2>

<p><a href="https://github.com/tangledpath/python-arango-ogm">https://github.com/tangledpath/python-arango-ogm</a></p>

<h2 id="documentation">Documentation</h2>

<p><a href="https://tangledpath.github.io/python-arango-ogm/python_arango_ogm.html">https://tangledpath.github.io/python-arango-ogm/python_arango_ogm.html</a></p>

<h2 id="development">Development</h2>

<h3 id="linting">Linting</h3>
Expand Down
4 changes: 2 additions & 2 deletions docs/python_arango_ogm/db.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@

<h2>Submodules</h2>
<ul>
<li><a href="db/migration_builder.html">migration_builder</a></li>
<li><a href="db/migration_model.html">migration_model</a></li>
<li><a href="db/model.html">model</a></li>
<li><a href="db/model_discovery.html">model_discovery</a></li>
<li><a href="db/pao_database.html">pao_database</a></li>
<li><a href="db/pao_migration_builder.html">pao_migration_builder</a></li>
<li><a href="db/pao_migrator.html">pao_migrator</a></li>
<li><a href="db/pao_model.html">pao_model</a></li>
<li><a href="db/pao_queries.html">pao_queries</a></li>
<li><a href="db/tests.html">tests</a></li>
</ul>
Expand Down
Loading

0 comments on commit 6d2d540

Please sign in to comment.