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

Packaging #288

Merged
merged 26 commits into from
Dec 30, 2018
Merged

Packaging #288

merged 26 commits into from
Dec 30, 2018

Conversation

micahculpepper
Copy link
Contributor

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT

Python packaging

SUMMARY

Made Python packaging simpler and more deterministic.

This PR:

  1. Commits a symlink to git, so ntc_templates/templates will point to templates. This puts the templates inside the path of the Python project, which makes packaging tools happy. It also allows the templates directory to stay where it is, so existing PRs and tooling can still reference templates in the same location.
  2. Removes unnecessarily complex code for finding the templates folder and version number

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.

71038c7 - I do not think it is a good idea to do import from the package as that might create a circular dependency and cause the install to fail.

Otherwise I think it looks good. I am still talking with a few other people to confirm this works for them.

I am also going to change the requirements to use textfsm instead of gtextfsm so you might need to rebase.

@micahculpepper
Copy link
Contributor Author

Hi @jmcgill298,

I use an import like in 71038c7 to handle gathering the version number in other projects I work on. Unfortunately they're not public for me to be able to link to them. It works, as long as the current working directory when python setup.py sdist is run contains the ntc_templates directory, or the current version of the project is installed in develop mode. Reference.

However, I can understand not wanting to change something that works. I'll go ahead and revert that change so as not to distract from the rest of the PR.

I'm totally in favor of the switch to textfsm and ready to rebase as soon as v1 of their package is available on PyPI.

@micahculpepper
Copy link
Contributor Author

I see setup.py on master has already been updated to require textfsm, so I went ahead and rebased.

It looks like they still only have version 0.4.1 on PyPI, and I think this project will need at least version 1 for import compatibility.

@jmcgill298
Copy link
Contributor

This is a good page highlighting the options for versioning: https://packaging.python.org/guides/single-sourcing-package-version/. Option 6 is similar to what you proposed; if you look at the warning for that option, you will see the concern I had for importing from another file.

Thanks for pointing out the import issues with parse.py; I have updated it to prefer TextFSM as a package and then try how importing the clitable module.

@micahculpepper
Copy link
Contributor Author

@jmcgill298 is there anything outstanding on this PR?

@jmcgill298 jmcgill298 merged commit 5cea42b into networktocode:master Dec 30, 2018
jvanderaa pushed a commit that referenced this pull request Nov 10, 2021
* remove redundant 'templates/*' - these files are covered by package_data in setup.py

* declare package_data files explicitly

* delete red herring comment

* stop messing with symlinks - they are not needed

* remove unused imports

* ln -s ntc_templates/templates ../templates

* simplify version number gathering

* simplify file finding

* whitespace

* document that we are zip-unsafe because we operate on real file paths

* delete redundant comment

* revert version-identification change. See discussion on #288

* remove redundant 'templates/*' - these files are covered by package_data in setup.py

* declare package_data files explicitly

* delete red herring comment

* stop messing with symlinks - they are not needed

* remove unused imports

* ln -s ntc_templates/templates ../templates

* simplify version number gathering

* simplify file finding

* whitespace

* document that we are zip-unsafe because we operate on real file paths

* delete redundant comment

* revert version-identification change. See discussion on #288
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants