Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type hints to the whole project and mypy testing setup and CI #123

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ jobs:
run: "poetry run invoke bandit"
needs:
- "black"
mypy:
runs-on: "ubuntu-20.04"
env:
INVOKE_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
- name: "Type-Hints: mypy"
run: "poetry run invoke mypy"
needs:
- "black"
pydocstyle:
runs-on: "ubuntu-20.04"
env:
Expand Down Expand Up @@ -103,6 +116,7 @@ jobs:
PYTHON_VER=${{ env.PYTHON_VER }}
needs:
- "bandit"
- "mypy"
- "pydocstyle"
- "flake8"
- "yamllint"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Except for unit tests, testing is only supported on Python 3.7.
The project is packaged with a light development environment based on `docker-compose` to help with the local development of the project and to run tests within TravisCI.

The project is following Network to Code software development guidelines and are leveraging the following:
- Black, Pylint, Bandit, flake8, and pydocstyle for Python linting and formatting.
- Black, Pylint, Bandit, Mypy, flake8, and pydocstyle for Python linting and formatting.
- pytest, coverage, and unittest for unit tests.

There are a number of things that are required in order to have a successful PR.
Expand Down Expand Up @@ -219,6 +219,7 @@ Each command can be executed with `invoke <command>`. Each command also has its
black Run black to check that Python files adhere to its style standards.
coverage Run the coverage report against pytest.
flake8 Run flake8 to check that Python files adhere to its style standards.
mypy Run mypy to validate typing-hints.
pylint Run pylint code analysis.
pydocstyle Run pydocstyle to validate docstring formatting adheres to NTC defined standards.
pytest Run pytest for the specified name and Python version.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/contributing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Contributing

.. mdinclude:: ../../../README.md
:start-line: 148
:end-line: 233
:end-line: 234

78 changes: 78 additions & 0 deletions docs/source/netutils/lib_mapping/ANSIBLE_reverse_table.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.. raw:: html

<table border="1" class="docutils">
<th>NORMALIZED</th><th>ANSIBLE</th>

<tr>
<td>arista_eos</td><td>arista.eos.eos</td>
</tr>
<tr>
<td>ciena_saos</td><td>ciena.saos6.saos6</td>
</tr>
<tr>
<td>cisco_asa</td><td>cisco.asa.asa</td>
</tr>
<tr>
<td>cisco_ios</td><td>cisco.ios.ios</td>
</tr>
<tr>
<td>cisco_xr</td><td>cisco.iosxr.iosxr</td>
</tr>
<tr>
<td>cisco_nxos</td><td>cisco.nxos.nxos</td>
</tr>
<tr>
<td>huawei</td><td>community.network.ce</td>
</tr>
<tr>
<td>dell_os6</td><td>dellemc.os6.os6</td>
</tr>
<tr>
<td>dell_os9</td><td>dellemc.os9.os9</td>
</tr>
<tr>
<td>dell_os10</td><td>dellemc.os10.0s10</td>
</tr>
<tr>
<td>ericsson_ipos</td><td>community.network.eric_eccli</td>
</tr>
<tr>
<td>extreme_exos</td><td>community.network.exos</td>
</tr>
<tr>
<td>extreme_netiron</td><td>community.network.ironware</td>
</tr>
<tr>
<td>extreme_nos</td><td>community.network.nos</td>
</tr>
<tr>
<td>extreme_slx</td><td>community.network.slxos</td>
</tr>
<tr>
<td>extreme_vsp</td><td>community.network.voss</td>
</tr>
<tr>
<td>juniper_junos</td><td>junipernetworks.junos.junos</td>
</tr>
<tr>
<td>lenovo_cnos</td><td>community.network.cnos</td>
</tr>
<tr>
<td>lenovo_enos</td><td>community.network.enos</td>
</tr>
<tr>
<td>mikrotik_routeros</td><td>community.network.routeros</td>
</tr>
<tr>
<td>nokia_sros</td><td>community.network.sros</td>
</tr>
<tr>
<td>pluribus</td><td>community.network.netvisor</td>
</tr>
<tr>
<td>ruckus_icx</td><td>community.network.icx</td>
</tr>
<tr>
<td>vyos</td><td>vyos.vyos.vyos</td>
</tr>
</table>
78 changes: 78 additions & 0 deletions docs/source/netutils/lib_mapping/ANSIBLE_table.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.. raw:: html

<table border="1" class="docutils">
<th>ANSIBLE</th><th>NORMALIZED</th>

<tr>
<td>arista.eos.eos</td><td>arista_eos</td>
</tr>
<tr>
<td>ciena.saos6.saos6</td><td>ciena_saos</td>
</tr>
<tr>
<td>cisco.asa.asa</td><td>cisco_asa</td>
</tr>
<tr>
<td>cisco.ios.ios</td><td>cisco_ios</td>
</tr>
<tr>
<td>cisco.iosxr.iosxr</td><td>cisco_xr</td>
</tr>
<tr>
<td>cisco.nxos.nxos</td><td>cisco_nxos</td>
</tr>
<tr>
<td>community.network.ce</td><td>huawei</td>
</tr>
<tr>
<td>dellemc.os6.os6</td><td>dell_os6</td>
</tr>
<tr>
<td>dellemc.os9.os9</td><td>dell_os9</td>
</tr>
<tr>
<td>dellemc.os10.0s10</td><td>dell_os10</td>
</tr>
<tr>
<td>community.network.eric_eccli</td><td>ericsson_ipos</td>
</tr>
<tr>
<td>community.network.exos</td><td>extreme_exos</td>
</tr>
<tr>
<td>community.network.ironware</td><td>extreme_netiron</td>
</tr>
<tr>
<td>community.network.nos</td><td>extreme_nos</td>
</tr>
<tr>
<td>community.network.slxos</td><td>extreme_slx</td>
</tr>
<tr>
<td>community.network.voss</td><td>extreme_vsp</td>
</tr>
<tr>
<td>junipernetworks.junos.junos</td><td>juniper_junos</td>
</tr>
<tr>
<td>community.network.cnos</td><td>lenovo_cnos</td>
</tr>
<tr>
<td>community.network.enos</td><td>lenovo_enos</td>
</tr>
<tr>
<td>community.network.routeros</td><td>mikrotik_routeros</td>
</tr>
<tr>
<td>community.network.netvisor</td><td>pluribus</td>
</tr>
<tr>
<td>community.network.icx</td><td>ruckus_icx</td>
</tr>
<tr>
<td>community.network.sros</td><td>nokia_sros</td>
</tr>
<tr>
<td>vyos.vyos.vyos</td><td>vyos</td>
</tr>
</table>
42 changes: 42 additions & 0 deletions docs/source/netutils/lib_mapping/NAPALM_reverse_table.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. raw:: html

<table border="1" class="docutils">
<th>NORMALIZED</th><th>NAPALM</th>

<tr>
<td>arista_eos</td><td>eos</td>
</tr>
<tr>
<td>brocade_vyos</td><td>vyos</td>
</tr>
<tr>
<td>cisco_asa</td><td>asa</td>
</tr>
<tr>
<td>cisco_ios</td><td>ios</td>
</tr>
<tr>
<td>cisco_nxos</td><td>nxos</td>
</tr>
<tr>
<td>cisco_xr</td><td>iosxr</td>
</tr>
<tr>
<td>cisco_wlc</td><td>cisco_wlc_ssh</td>
</tr>
<tr>
<td>fortinet</td><td>fortios</td>
</tr>
<tr>
<td>huawei_vrp</td><td>huawei</td>
</tr>
<tr>
<td>juniper_junos</td><td>junos</td>
</tr>
<tr>
<td>paloalto_panos</td><td>panos</td>
</tr>
<tr>
<td>nokia_sros</td><td>sros</td>
</tr>
</table>
42 changes: 42 additions & 0 deletions docs/source/netutils/lib_mapping/NAPALM_table.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. raw:: html

<table border="1" class="docutils">
<th>NAPALM</th><th>NORMALIZED</th>

<tr>
<td>asa</td><td>cisco_asa</td>
</tr>
<tr>
<td>cisco_wlc_ssh</td><td>cisco_wlc</td>
</tr>
<tr>
<td>eos</td><td>arista_eos</td>
</tr>
<tr>
<td>fortios</td><td>fortinet</td>
</tr>
<tr>
<td>huawei</td><td>huawei_vrp</td>
</tr>
<tr>
<td>ios</td><td>cisco_ios</td>
</tr>
<tr>
<td>nxos</td><td>cisco_nxos</td>
</tr>
<tr>
<td>iosxr</td><td>cisco_xr</td>
</tr>
<tr>
<td>junos</td><td>juniper_junos</td>
</tr>
<tr>
<td>panos</td><td>paloalto_panos</td>
</tr>
<tr>
<td>sros</td><td>nokia_sros</td>
</tr>
<tr>
<td>vyos</td><td>brocade_vyos</td>
</tr>
</table>
Loading