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

Remove "terminal" dependency #672

Merged
merged 2 commits into from
May 1, 2020

Conversation

ktbyers
Copy link
Contributor

@ktbyers ktbyers commented Apr 30, 2020

There was a long-standing issue in TextFSM which caused textfsm to break on Windows. This was due to the TextFSM library importing the "fcntl" library (inside TextFSM's terminal.py module).

ntc-templates had a workaround for this problem where they installed a completely different terminal library.

This worked in textfsm 0.4.1 as textfsm_0_4_1 would put all of its Python files directly into site-packages (literally ./site-packages/terminal.py). Consequently, the install of the other terminal module would overwrite the terminal.py that came installed with textfsm.

With this fix here:

https://github.com/google/textfsm/blob/v1.1.1/textfsm/terminal.py#L25-L29

And with the fact that textfsm is now installed as a proper package in site-packages (in other words site-packages/textfsm/ and then the package files inside that directory).

The installation of the other terminal package should now be useless.

The relevance to me is that I am interested in making ntc-templates a direct Netmiko dependency, but I don't really like installing this separate terminal.py file (https://github.com/lepture/terminal) as that library is unmaintained (last commit in 2013)

Additionally, I have had interoperability issues with the ntc-templates fix to this problem in the paste. And now that it is obsolete, it would be good to get rid of it.

There is no code that is actually by in terminal.py by ntc-templates or Netmiko (in either the old or the new solution). The problem is entirely an import issue.

Copy link
Contributor

@jmcgill298 jmcgill298 left a comment

Choose a reason for hiding this comment

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

If we set the version of TextFSM, then we should also remove the try/except block here:

try:
from textfsm import clitable
except ImportError:
import clitable

@ktbyers
Copy link
Contributor Author

ktbyers commented Apr 30, 2020

You want me to make that edit in this PR also (the parse.py multiple import edit--for old/new textfsm)?

@jmcgill298

@jmcgill298
Copy link
Contributor

That would be great. Thanks

@ktbyers
Copy link
Contributor Author

ktbyers commented May 1, 2020

Sounds good. Will update.

@jmcgill298 jmcgill298 merged commit 8cb73c5 into networktocode:master May 1, 2020
@jmcgill298
Copy link
Contributor

Thanks @ktbyers

@ktbyers ktbyers deleted the remove_terminal_dependency branch May 1, 2020 21:10
thomasblass pushed a commit to thomasblass/ntc-templates that referenced this pull request Oct 25, 2020
* Eliminate terminal dependency

* Fix imports to use only textfsm >=1.1
jvanderaa pushed a commit that referenced this pull request Nov 10, 2021
* Eliminate terminal dependency

* Fix imports to use only textfsm >=1.1
guillaume-mbali pushed a commit to unyc-io/ntc-templates that referenced this pull request Apr 12, 2023
* Eliminate terminal dependency

* Fix imports to use only textfsm >=1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants