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

Type hints for napalm.base and napalm.nxos #1434

Closed
wants to merge 61 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
e33c3c5
Add models and annotate NetworkDriver class with types
Kircheneer Mar 22, 2021
b9ee5a2
Make tests pass by ignoring the annotations part of the arg spec
Kircheneer Mar 22, 2021
e675ef6
Unpack optional in NXOSDevice.load_merge_candidate()
Kircheneer Mar 22, 2021
2f54a67
Add lots of type hints, asserts and some abstract methods. Enable typ…
Kircheneer Mar 22, 2021
f699c7e
Solve type errors
Kircheneer Mar 27, 2021
4f35164
Add type checker to github actions
Kircheneer Mar 27, 2021
292a820
Merge branch 'type-hinting' into develop
Kircheneer Mar 27, 2021
0864a0b
Specify mypy config file in github action
Kircheneer Mar 27, 2021
288f5cc
Fix unused imports
Kircheneer Mar 27, 2021
ca8fe10
Black formatting
Kircheneer Mar 27, 2021
79a2489
Fix further pipeline problems
Kircheneer Mar 27, 2021
114206c
Fix further pipeline errors
Kircheneer Mar 27, 2021
4d51281
Put type in quotes
Kircheneer Mar 27, 2021
ff87341
Convert all typing_extensions try/except imports to pure typing_exten…
Kircheneer Mar 27, 2021
6606fd1
Import TypedDict from typing_extensions in nxos.py
Kircheneer Mar 27, 2021
2c5f31d
Merge branch 'develop' into develop
mirceaulinic Apr 1, 2021
cd4e0c8
add outgoing_interface in get_route_to for isoxr
Apr 9, 2021
c727d49
black reformatting
Apr 9, 2021
a9c71a8
edit test to follow the behavior change in get_route_to
Apr 9, 2021
d874019
Add IOS-XR NETCONF support (#1432)
ktbyers Apr 30, 2021
66cfcea
Ignore typing errors from napalm.iosxr_netconf
Kircheneer Apr 30, 2021
7bda710
Merge branch 'develop' into develop
Kircheneer Apr 30, 2021
08cc1c7
Fix Callable import in mock.py
Kircheneer May 1, 2021
b0c7653
Merge branch 'develop' into develop
Kircheneer May 7, 2021
cfc4aca
Merge branch 'develop' into develop
ktbyers May 7, 2021
2fd7efc
Merge branch 'develop' into develop
mirceaulinic May 18, 2021
13f20e6
Fix #1387
DavidVentura May 18, 2021
82f21f6
fix bgp flap_count issue
minefuto May 21, 2021
16e6498
change test_get_bgp_neighbors_detail
minefuto May 21, 2021
0c805a7
refactor connection_down_count
minefuto May 21, 2021
43d7006
Merge pull request #1449 from minefuto/iosxr-bgp-flapcount
mirceaulinic May 24, 2021
2999a0b
Merge branch 'develop' into fix-ios-keyerror
mirceaulinic May 24, 2021
1bb3e91
Bump coveralls from 3.0.1 to 3.1.0
dependabot[bot] May 25, 2021
275c227
Add source_interface argument to ping
chadell May 26, 2021
8f5a1f7
change the function cli when result is xml object
Laurel-rao May 27, 2021
8f1c615
Merge pull request #1447 from DavidVentura/fix-ios-keyerror
mirceaulinic May 27, 2021
009d545
Merge pull request #1453 from napalm-automation/dependabot/pip/covera…
mirceaulinic May 27, 2021
7b56cdd
Merge branch 'develop' into ping-source-interface
mirceaulinic May 27, 2021
2f8d6a2
Merge branch 'develop' into patch-1
mirceaulinic May 27, 2021
56b341d
Merge pull request #1455 from chadell/ping-source-interface
mirceaulinic May 27, 2021
b955451
Merge branch 'develop' into patch-1
mirceaulinic May 27, 2021
d72e194
Merge pull request #1456 from Laurel-rao/patch-1
mirceaulinic May 27, 2021
0b7ab94
Add models and annotate NetworkDriver class with types
Kircheneer Mar 22, 2021
8d02a76
Make tests pass by ignoring the annotations part of the arg spec
Kircheneer Mar 22, 2021
26045dc
Unpack optional in NXOSDevice.load_merge_candidate()
Kircheneer Mar 22, 2021
0036232
Add lots of type hints, asserts and some abstract methods. Enable typ…
Kircheneer Mar 22, 2021
1e89bb0
Solve type errors
Kircheneer Mar 27, 2021
eb7250c
Add type checker to github actions
Kircheneer Mar 27, 2021
79950ef
Specify mypy config file in github action
Kircheneer Mar 27, 2021
9857dc6
Fix unused imports
Kircheneer Mar 27, 2021
a0a7fa2
Black formatting
Kircheneer Mar 27, 2021
a6f01bf
Fix further pipeline problems
Kircheneer Mar 27, 2021
024c854
Fix further pipeline errors
Kircheneer Mar 27, 2021
076b1fc
Put type in quotes
Kircheneer Mar 27, 2021
0375a51
Convert all typing_extensions try/except imports to pure typing_exten…
Kircheneer Mar 27, 2021
3cd8909
Import TypedDict from typing_extensions in nxos.py
Kircheneer Mar 27, 2021
19a9a8d
Ignore typing errors from napalm.iosxr_netconf
Kircheneer Apr 30, 2021
7b21a63
Fix Callable import in mock.py
Kircheneer May 1, 2021
1802446
Merge branch 'develop' of https://github.com/Kircheneer/napalm into d…
Kircheneer Jun 4, 2021
3671424
Black
Kircheneer Jun 4, 2021
ea7e1dd
Black
Kircheneer Jun 4, 2021
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
8 changes: 6 additions & 2 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
---
name: build
on: [push, pull_request]
jobs:
Expand Down Expand Up @@ -33,10 +33,14 @@ jobs:
run: |
pylama .

- name: Run type checker
run: |
mypy -p napalm --config-file mypy.ini

- name: Run Tests
run: |
py.test --cov=napalm --cov-report term-missing -vs --pylama

build_docs:
needs: std_tests
runs-on: ubuntu-latest
Expand Down
18 changes: 18 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ allow_redefinition = True
[mypy-napalm.base.*]
disallow_untyped_defs = True

[mypy-napalm.nxos.*]
disallow_untyped_defs = True

[mypy-napalm.eos.*]
ignore_errors = True

[mypy-napalm.ios.*]
ignore_errors = True

[mypy-napalm.iosxr_netconf.*]
ignore_errors = True

[mypy-napalm.nxapi_plumbing.*]
disallow_untyped_defs = True

[mypy-napalm.base.clitools.*]
ignore_errors = True

[mypy-napalm.base.test.*]
ignore_errors = True

Expand Down
4 changes: 3 additions & 1 deletion napalm/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import importlib

# NAPALM base
from typing import Type

from napalm.base.base import NetworkDriver
from napalm.base.exceptions import ModuleImportError
from napalm.base.mock import MockDriver
Expand All @@ -29,7 +31,7 @@
]


def get_network_driver(name, prepend=True):
def get_network_driver(name: str, prepend: bool = True) -> Type[NetworkDriver]:
"""
Searches for a class derived form the base NAPALM class NetworkDriver in a specific library.
The library name must repect the following pattern: napalm_[DEVICE_OS].
Expand Down
Loading