You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use packaging.version for comparing versions #10197
At least not in conda environments; haven't tried with pyenv & venv, though.
Sorry, I stand corrected, I just tested this and indeed conda and mamba do install setuptools and pip along with python.
I think it's just conda-forge's build system that handles things differently, and requires one to explicitly list setuptools as a runtime dependency if it's required.
OK. But to summarize, we don't even need setuptools because the recommended package to do version checks is packaging, so I'd add that as a dependency. And then remove _compare_version from fixes.
Let's wait for others to chime in, but here's a quote from the pkg_resourcesdocumentation (which is part of setuptools) to direct the discussion:
Use of pkg_resources is discouraged in favor of importlib.resources, importlib.metadata, and their backports (resources, metadata). Please consider using those libraries instead of pkg_resources.
That warning filter is not for our code, it was added because a dependency (nilearn) hadn't switched off of LooseVersion yet (reported here and fixed upstream 6 days ago). Whatever change you end up making, please add a comment to that line indicating why the warning filter exists (e.g., # present in nilearn v 0.8.1, fixed in nilearn main). IMO all our warning filters should have this, so we know when to bother checking whether they're out of date
I'm also +1 for using packaging but I don't see the point of vendoring it. It's developed by pypa and "blessed" as the recommended replacement for this use case, and thus seems likely to be used widely / required by many other libraries / be present on the user's system already.
Yes, we should require a comment for every new filter warning! Maybe someone has the time to check which of these filters are not even necessary anymore?
I'd also try to vendor as few packages as possible, especially when we're talking about core packages provided by pypa.
Activity
hoechenberger commentedon Jan 12, 2022
Hello @cbrnr,
because it "fixes" things for environments which don't have
setuptoolsinstalled, which IIRC is currently not a dependency of MNE-Python.Because this would introduce a dependency on
packaging, which seems less-widespread thansetuptools:)hoechenberger commentedon Jan 12, 2022
That said, I don't mind adding a few deps to make our code cleaner and leaner, but others may disagree
cbrnr commentedon Jan 12, 2022
setuptoolsis bootstrapped with every Python installation, as ispip. So I'm not sure this is really a fix when everybody has it.hoechenberger commentedon Jan 12, 2022
At least not in
condaenvironments; haven't tried withpyenv&venv, though.cbrnr commentedon Jan 12, 2022
But yes, I understand that it's not part of the standard library, so if you compile Python yourself you don't have it.
cbrnr commentedon Jan 12, 2022
I'd make
setuptoolsa dependency. It's used everywhere and it's the recommended replacement of distlib.hoechenberger commentedon Jan 12, 2022
Sorry, I stand corrected, I just tested this and indeed
condaandmambado installsetuptoolsandpipalong withpython.I think it's just
conda-forge's build system that handles things differently, and requires one to explicitly listsetuptoolsas a runtime dependency if it's required.hoechenberger commentedon Jan 12, 2022
No objection from my end. As soon as
distutils.Versiongets removed, we'll have to depend onsetuptoolsanyway.cbrnr commentedon Jan 12, 2022
OK. But to summarize, we don't even need
setuptoolsbecause the recommended package to do version checks ispackaging, so I'd add that as a dependency. And then remove_compare_versionfromfixes.hoechenberger commentedon Jan 12, 2022
Yeah well no, I still think
setuptoolsis the better choice in case we want to pick a dependency that "everybody already has installed"Like I said I personally don't care, but other MNE devs will 😅
cbrnr commentedon Jan 12, 2022
Let's wait for others to chime in, but here's a quote from the
pkg_resourcesdocumentation (which is part ofsetuptools) to direct the discussion:So I'm voting for
packaging.agramfort commentedon Jan 12, 2022
hoechenberger commentedon Jan 12, 2022
Ok, convinced. +1 for
packagingif you believe this is a good solutioncbrnr commentedon Jan 12, 2022
We could also vendor it if we don't want an additional dependency.
larsoner commentedon Jan 12, 2022
+1 for packaging
That might indeed make sense. But let's wait until we settle #10198 to do this (or not).
drammock commentedon Jan 12, 2022
That warning filter is not for our code, it was added because a dependency (nilearn) hadn't switched off of LooseVersion yet (reported here and fixed upstream 6 days ago). Whatever change you end up making, please add a comment to that line indicating why the warning filter exists (e.g.,
# present in nilearn v 0.8.1, fixed in nilearn main). IMO all our warning filters should have this, so we know when to bother checking whether they're out of dateI'm also +1 for using
packagingbut I don't see the point of vendoring it. It's developed by pypa and "blessed" as the recommended replacement for this use case, and thus seems likely to be used widely / required by many other libraries / be present on the user's system already.cbrnr commentedon Jan 12, 2022
Yes, we should require a comment for every new filter warning! Maybe someone has the time to check which of these filters are not even necessary anymore?
I'd also try to vendor as few packages as possible, especially when we're talking about core packages provided by pypa.
hoechenberger commentedon Jan 12, 2022
+1