-
Notifications
You must be signed in to change notification settings - Fork 10
Provide an import shim for 'vcstool' API compatibility #94
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Scott K Logan <[email protected]>
849e3d6 to
a84055d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
=======================================
Coverage 26.96% 26.96%
=======================================
Files 31 31
Lines 2240 2240
Branches 393 393
=======================================
Hits 604 604
Misses 1576 1576
Partials 60 60 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
j-rivero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great!
|
|
||
| import vcs2l | ||
| from vcs2l import * # noqa: F403 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether this would count as an improvement, but we can add a warning that the shim will be removed in the future when the API breaks.
| warnings.warn( | |
| "The 'vcstool' import is deprecated. Please update your code to use 'vcs2l' instead. " | |
| 'This shim will be removed in a future version.', | |
| DeprecationWarning, | |
| stacklevel=2, | |
| ) |
leander-dsouza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great :)
Basic Info
Description of contribution in a few bullet points
This presents vcs2l as a wholesale replacement for vcstool and should satisfy any existing dependencies on vcstool without requiring changes to vcs2l itself. It operates under the fact that the existing vcs2l API is similar enough to vcstool that it can simply be installed and used under that name.
When the vcs2l API deviates from vcstool enough, this commit may be reverted and the shim module dropped.
Thanks to @j-rivero for presenting this as a significantly lighter-weight alternative to #90
Description of how this change was tested
pre-commit run --allpython3 -m pytest -s -v testpython3-vcstool