Skip to content

Commit

Permalink
Merge pull request #28 from vroncevic/dev
Browse files Browse the repository at this point in the history
[gen_rpc] Updated ATS CLI mechanism, docs
  • Loading branch information
vroncevic authored Jul 9, 2024
2 parents c964fcc + eee92b6 commit 761a6e4
Show file tree
Hide file tree
Showing 39 changed files with 421 additions and 212 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ RUN DEBIAN_FRONTEND=noninteractive \
python3 \
python3-dev \
python3-wheel \
libyaml-dev
libyaml-dev \
libtirpc-dev

RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python3 get-pip.py
Expand Down
49 changes: 31 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,26 +131,39 @@ Generator structure

```bash
gen_rpc/
├── conf/
│   ├── gen_rpc.cfg
│   ├── gen_rpc.logo
│   ├── gen_rpc_util.cfg
│   ├── project.yaml
│   └── template/
│   ├── rpc_client.template
│   ├── rpc_server.template
│   └── rpc_square.template
├── __init__.py
├── log/
│   └── gen_rpc.log
├── pro/
│   ├── __init__.py
│   ├── read_template.py
│   └── write_template.py
└── run/
└── gen_rpc_run.py
├── conf/
│   ├── gen_rpc.cfg
│   ├── gen_rpc.logo
│   ├── gen_rpc_util.cfg
│   ├── project.yaml
│   └── template/
│   ├── rpc_client.template
│   ├── rpc_server.template
│   └── rpc_square.template
├── __init__.py
├── log/
│   └── gen_rpc.log
├── pro/
│   ├── __init__.py
│   ├── read_template.py
│   └── write_template.py
├── py.typed
└── run/
└── gen_rpc_run.py

6 directories, 14 files
```

### Code coverage

| Name | Stmts | Miss | Cover |
|------|-------|------|-------|
| `gen_rpc/__init__.py` | 71 | 12 | 83% |
| `gen_rpc/pro/__init__.py` | 59 | 2 | 97% |
| `gen_rpc/pro/read_template.py` | 53 | 2 | 96% |
| `gen_rpc/pro/write_template.py` | 60 | 5 | 92% |
| **Total** | 243 | 21 | 91% |

### Docs

[![Documentation Status](https://readthedocs.org/projects/gen_rpc/badge/?version=latest)](https://gen-rpc.readthedocs.io/en/latest/?badge=latest)
Expand Down
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/doctrees/gen_rpc.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/gen_rpc.pro.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/gen_rpc.pro.write_template.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/gen_rpc_run.doctree
Binary file not shown.
18 changes: 9 additions & 9 deletions docs/build/html/_modules/gen_rpc.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ <h1>Source code for gen_rpc</h1><div class="highlight"><pre>
<span class="sd">&#39;&#39;&#39;</span>

<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Any</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">Dict</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">List</span><span class="p">,</span> <span class="n">Dict</span><span class="p">,</span> <span class="n">Optional</span>
<span class="kn">from</span> <span class="nn">os.path</span> <span class="kn">import</span> <span class="n">exists</span><span class="p">,</span> <span class="n">dirname</span><span class="p">,</span> <span class="n">realpath</span>
<span class="kn">from</span> <span class="nn">os</span> <span class="kn">import</span> <span class="n">getcwd</span>
<span class="kn">from</span> <span class="nn">argparse</span> <span class="kn">import</span> <span class="n">Namespace</span>

<span class="k">try</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">ats_utilities.splash</span> <span class="kn">import</span> <span class="n">Splash</span>
<span class="kn">from</span> <span class="nn">ats_utilities.logging</span> <span class="kn">import</span> <span class="n">ATSLogger</span>
<span class="kn">from</span> <span class="nn">ats_utilities.cli.cfg_cli</span> <span class="kn">import</span> <span class="n">CfgCLI</span>
<span class="kn">from</span> <span class="nn">ats_utilities.cli</span> <span class="kn">import</span> <span class="n">ATSCli</span>
<span class="kn">from</span> <span class="nn">ats_utilities.console_io.error</span> <span class="kn">import</span> <span class="n">error_message</span>
<span class="kn">from</span> <span class="nn">ats_utilities.console_io.verbose</span> <span class="kn">import</span> <span class="n">verbose_message</span>
<span class="kn">from</span> <span class="nn">ats_utilities.console_io.success</span> <span class="kn">import</span> <span class="n">success_message</span>
Expand All @@ -82,15 +82,15 @@ <h1>Source code for gen_rpc</h1><div class="highlight"><pre>
<span class="n">__copyright__</span> <span class="o">=</span> <span class="s1">&#39;(C) 2024, https://vroncevic.github.io/gen_rpc&#39;</span>
<span class="n">__credits__</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;Vladimir Roncevic&#39;</span><span class="p">,</span> <span class="s1">&#39;Python Software Foundation&#39;</span><span class="p">]</span>
<span class="n">__license__</span> <span class="o">=</span> <span class="s1">&#39;https://github.com/vroncevic/gen_rpc/blob/dev/LICENSE&#39;</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s1">&#39;1.0.2&#39;</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s1">&#39;1.0.3&#39;</span>
<span class="n">__maintainer__</span> <span class="o">=</span> <span class="s1">&#39;Vladimir Roncevic&#39;</span>
<span class="n">__email__</span> <span class="o">=</span> <span class="s1">&#39;[email protected]&#39;</span>
<span class="n">__status__</span> <span class="o">=</span> <span class="s1">&#39;Updated&#39;</span>


<div class="viewcode-block" id="GenRPC">
<a class="viewcode-back" href="../gen_rpc.html#gen_rpc.GenRPC">[docs]</a>
<span class="k">class</span> <span class="nc">GenRPC</span><span class="p">(</span><span class="n">CfgCLI</span><span class="p">):</span>
<span class="k">class</span> <span class="nc">GenRPC</span><span class="p">(</span><span class="n">ATSCli</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Defines class GenRPC with attribute(s) and method(s).</span>
<span class="sd"> Loads base information, creates a CLI interface, and runs operations.</span>
Expand Down Expand Up @@ -138,9 +138,9 @@ <h1>Source code for gen_rpc</h1><div class="highlight"><pre>
<span class="n">verbose</span><span class="p">,</span> <span class="p">[</span><span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s1"> init tool info&#39;</span><span class="p">]</span>
<span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_logger</span><span class="p">:</span> <span class="n">ATSLogger</span> <span class="o">=</span> <span class="n">ATSLogger</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">(),</span> <span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="n">current_dir</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">_LOG</span><span class="si">}</span><span class="s1">&#39;</span><span class="p">,</span> <span class="n">verbose</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">(),</span> <span class="kc">True</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">True</span><span class="p">,</span> <span class="n">verbose</span>
<span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">tool_operational</span><span class="p">:</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_operational</span><span class="p">():</span>
<span class="bp">self</span><span class="o">.</span><span class="n">add_new_option</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_OPS</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_OPS</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">dest</span><span class="o">=</span><span class="s1">&#39;name&#39;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s1">&#39;generate project (provide name)&#39;</span>
Expand All @@ -164,9 +164,9 @@ <h1>Source code for gen_rpc</h1><div class="highlight"><pre>
<span class="sd"> :exceptions: None</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="n">status</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">tool_operational</span><span class="p">:</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_operational</span><span class="p">():</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">args</span><span class="p">:</span> <span class="n">Any</span> <span class="o">|</span> <span class="n">Namespace</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parse_args</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span>
<span class="n">args</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Namespace</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parse_args</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">bool</span><span class="p">(</span><span class="nb">getattr</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="s2">&quot;name&quot;</span><span class="p">)):</span>
<span class="n">error_message</span><span class="p">(</span>
<span class="p">[</span><span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s1"> missing name argument&#39;</span><span class="p">]</span>
Expand Down Expand Up @@ -207,7 +207,7 @@ <h1>Source code for gen_rpc</h1><div class="highlight"><pre>
<span class="p">)</span>
<span class="k">except</span> <span class="ne">SystemExit</span><span class="p">:</span>
<span class="n">error_message</span><span class="p">(</span>
<span class="p">[</span><span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s1"> expected argument -n&#39;</span><span class="p">]</span>
<span class="p">[</span><span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s1"> expected argument name&#39;</span><span class="p">]</span>
<span class="p">)</span>
<span class="k">return</span> <span class="n">status</span>
<span class="k">else</span><span class="p">:</span>
Expand Down
Loading

0 comments on commit 761a6e4

Please sign in to comment.