Skip to content

Add new example with pynautobot #53

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

Merged
merged 25 commits into from
Oct 15, 2021
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
be0954c
Add exampele3 with pynautobot
dgarros Jun 18, 2021
9b0ffb1
Replace sub region with population, add diff and flags
dgarros Oct 8, 2021
5288b5f
Pylint and pydocstyle
dgarros Oct 11, 2021
144820d
exclude examples and docs from mypy
dgarros Oct 11, 2021
8c2d17e
exclude examples and docs from pylint
dgarros Oct 11, 2021
8a4cbd9
Update examples/example3/main.py
dgarros Oct 12, 2021
23ce5b3
Update examples/example3/diff.py
dgarros Oct 12, 2021
7578196
Update examples/example3/local_adapter.py
dgarros Oct 12, 2021
0685de8
Update examples/example3/local_adapter.py
dgarros Oct 12, 2021
f91d5c4
Update examples/example3/local_adapter.py
dgarros Oct 12, 2021
db21ce1
Update examples/example3/README.md
dgarros Oct 12, 2021
1eb9b3e
Update examples/example3/README.md
dgarros Oct 12, 2021
29a0995
Update examples/example3/README.md
dgarros Oct 12, 2021
9924b1d
Update examples/example3/local_adapter.py
dgarros Oct 12, 2021
f1382c2
Update examples/example3/local_adapter.py
dgarros Oct 12, 2021
1f73b74
Update examples/example3/main.py
dgarros Oct 12, 2021
bd43009
Update examples/example3/main.py
dgarros Oct 12, 2021
38e8dd9
Update examples/example3/main.py
dgarros Oct 12, 2021
b0e8b54
Update examples/example3/nautobot_adapter.py
dgarros Oct 12, 2021
b99649d
Update examples/example3/nautobot_adapter.py
dgarros Oct 12, 2021
06ec2d2
Update examples/example3/nautobot_adapter.py
dgarros Oct 12, 2021
b307176
Update examples/example3/nautobot_adapter.py
dgarros Oct 12, 2021
c91eeb5
Update format with black
dgarros Oct 14, 2021
efd36a7
Reenable pylint on the examples folder
dgarros Oct 14, 2021
e47dd69
fix import error for pylint in example3
dgarros Oct 14, 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
Prev Previous commit
Next Next commit
exclude examples and docs from pylint
  • Loading branch information
dgarros committed Oct 11, 2021
commit 8c2d17ef7eeb9d85a8340e0fc0e0e75665361964
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def pylint(context, name=NAME, image_ver=IMAGE_VER, local=INVOKE_LOCAL):
"""
# pty is set to true to properly run the docker commands due to the invocation process of docker
# https://docs.pyinvoke.org/en/latest/api/runners.html - Search for pty for more information
exec_cmd = 'find . -name "*.py" | xargs pylint'
exec_cmd = 'find . -name "*.py" -not -path "*/examples/*" -not -path "*/docs/*" | xargs pylint'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not run pylint against the example code? Seems like it'd be good practice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the list of errors reported by pylint when it's enabled.
It feels like pylint is expecting all python code to be part of the same package and it is not happy because we have some redundant code and library across some examples.

DOCKER - Running command: find . -name "*.py" | xargs pylint container: diffsync-py3.7:1.3.0
************* Module diff
examples/example3/diff.py:11:24: W0612: Unused variable 'child' (unused-variable)
************* Module main
examples/example3/main.py:9:0: C0411: third party import "from local_adapter import LocalAdapter" should be placed before "from diffsync.enum import DiffSyncFlags" (wrong-import-order)
examples/example3/main.py:10:0: C0411: third party import "from nautobot_adapter import NautobotAdapter" should be placed before "from diffsync.enum import DiffSyncFlags" (wrong-import-order)
examples/example3/main.py:11:0: C0411: third party import "from diff import AlphabeticalOrderDiff" should be placed before "from diffsync.enum import DiffSyncFlags" (wrong-import-order)
************* Module local_adapter
examples/example3/local_adapter.py:4:0: E0401: Unable to import 'slugify' (import-error)
examples/example3/local_adapter.py:28:4: W0221: Parameters differ from overridden 'load' method (arguments-differ)
************* Module nautobot_models
examples/example3/nautobot_models.py:2:0: E0401: Unable to import 'pynautobot' (import-error)
examples/example3/nautobot_models.py:86:33: E1101: Instance of 'NautobotCountry' has no 'slug' member (no-member)
examples/example3/nautobot_models.py:5:0: C0411: third party import "from models import Region, Country" should be placed before "from diffsync import DiffSync" (wrong-import-order)
************* Module nautobot_adapter
examples/example3/nautobot_adapter.py:3:0: E0401: Unable to import 'pynautobot' (import-error)
examples/example3/nautobot_adapter.py:79:4: W0222: Signature differs from overridden 'sync_from' method (signature-differs)
examples/example3/nautobot_adapter.py:47:8: W0201: Attribute 'nautobot' defined outside __init__ (attribute-defined-outside-init)
************* Module backend_b
examples/example1/backend_b.py:20:0: E0611: No name 'Site' in module 'models' (no-name-in-module)
examples/example1/backend_b.py:20:0: E0611: No name 'Device' in module 'models' (no-name-in-module)
examples/example1/backend_b.py:20:0: E0611: No name 'Interface' in module 'models' (no-name-in-module)
************* Module backend_c
examples/example1/backend_c.py:20:0: E0611: No name 'Site' in module 'models' (no-name-in-module)
examples/example1/backend_c.py:20:0: E0611: No name 'Device' in module 'models' (no-name-in-module)
examples/example1/backend_c.py:20:0: E0611: No name 'Interface' in module 'models' (no-name-in-module)
************* Module backend_a
examples/example1/backend_a.py:20:0: E0611: No name 'Site' in module 'models' (no-name-in-module)
examples/example1/backend_a.py:20:0: E0611: No name 'Device' in module 'models' (no-name-in-module)
examples/example1/backend_a.py:20:0: E0611: No name 'Interface' in module 'models' (no-name-in-module)

https://github.com/networktocode/diffsync/runs/3861062794

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Does renaming the duplicated models.py files to example1_models.py and example3_models.py respectively help to fix this?

run_cmd(context, exec_cmd, name, image_ver, local)


Expand Down