-
Notifications
You must be signed in to change notification settings - Fork 54
Remove unused modules, version checks, and PY2 compat. #42
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 unused modules, version checks, and PY2 compat. #42
Conversation
labscript_utils/__init__.py
Outdated
@@ -15,6 +15,7 @@ | |||
import os | |||
import traceback | |||
from pathlib import Path | |||
import importlib | |||
|
|||
from .versions import get_version, NoVersionInfo |
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.
NoVersionInfo
unusedget_version
redefined below (line 59, where unusedVersionException
is imported).get_version
now seems unused by anything.
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.
Can labscript_utils.version.get_version
and labscript_utils.versions.VersionException
further down be omitted as well?
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'm not seeing my own comments here for some reason. Let me know if you see this!
Other labscript suite code uses those functions. But, I've been going through bits of the rest of the suite removing the ones that are no longer needed. If it turns out that's all of them, then I'll remove it from here. But I suspect there are a few legit cases that might remain.
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 couldn't find any with a whole-workspace search.
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 see two uses of VersionException
in NI DAQmx, none of get_version
, and actually I was thinking of check_version()
, there are 77 of those.
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.
(overcounting because it includes both the definitions and the uses to be removed by this PR).
So I can delete get_version, but I suspect after going through the remaining version checks I'll probably be removing or very much downsizing the versions module, so I'll get rid of the others then based on how that goes
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.
With all the other remove-cruft pull requests, these imports (and indeed the whole versions
module) are now unused by labscript suite code so I've removed them.
clean_repo_hook is Python2 and mercurial specific. (Python2 because the presence of .pyc files within a `__pycache__` directory as is done in PY3 does not automatically allow the module to be imported when the .py file is absent). Although we might want to bring something like it back, it's not super necessary now that we use neither. Winshell and Winlauncher are superseded by the desktop-app project. numpy_dtpye_workaround is no longer needed since numpy 1.15, and there are PRs removing it from the labscript projects still importing it. This will require a major version bump in labscript_utils. Code using check_version will break on this, they should either update to allow the newer version or stop using check_version on labscript_utils since packaging tools will handle dependencies now.
Make importlib_metadata requirement unconditional to get us one step closer to being able to build a noarch package, though we can't relistically do that until a new pyqtgraph is in the anaconda repos.
The version checks are not needed since packaging tools handle dependencies.
08fead2
to
39ee71f
Compare
39ee71f
to
e65ce24
Compare
We may bring something like this back for remote version checking, but it will have to be in a different form since the current checks are only for modules, not arbitrary versions strings, and since the error message is not informative enough for a remote situation. Remove VersionException and check_version imports
e979f05
to
d7230c5
Compare
Since it is being removed from labscript_suite.labconfig /labscript-suite/blacs#68 will require this.
Note: This PR deleted |
Ah, damn. Since we did a major version bump we have reserved the right to remove a function, but it was not ideal that we did not have a deprecation period first. Also not ideal that the very function that would have given the error saying "labscript-utils 3.0.0 is too high" was the one removed... Further, analysislib-mloop is not something that pip can help manage dependencies for, and neither is other userlib code. So whilst one could get rid of these lines in analysislib-mloop, actually replicating their behaviour would mean basically reimplementing check_version. Probably a good idea to still support this kind of version check for user code that has not solidified enough to become a package on PyPI (and frankly, to support users sharing code containing version checks and never using setuptools/PyPI regardless of how solid their code is - this is a perfectly valid way to share code). I think I lean toward adding it back in for the sake of user code. |
clean_repo_hook is Python2 and mercurial specific. (Python2 because the
presence of .pyc files within a
__pycache__
directory as is done inPY3 does not automatically allow the module to be imported when the .py
file is absent). Although we might want to bring something like it back,
it's not super necessary now that we use neither.
Winshell and Winlauncher are superseded by the desktop-app project.
numpy_dtpye_workaround is no longer needed since numpy 1.15, and there
are PRs removing it from the labscript projects still importing it.
This will require a major version bump in labscript_utils.
Code using check_version will break on this, they should either update
to allow the newer version or stop using check_version on
labscript_utils since packaging tools will handle dependencies now.
Also removed all
__future__
imports, all code wrapped in a PY2 conditional, and all version checks since they are now declared in setup.cfg.