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 version checks in brian2.__init__.py? #1443

Open
mstimberg opened this issue Nov 16, 2022 · 1 comment
Open

Remove version checks in brian2.__init__.py? #1443

mstimberg opened this issue Nov 16, 2022 · 1 comment

Comments

@mstimberg
Copy link
Member

When importing the brian2 package, we check a few packages for outdated versions:

brian2/brian2/__init__.py

Lines 74 to 100 in 4886c46

# Check for outdated dependency versions
def _check_dependency_version(name, version):
from packaging.version import Version
from .core.preferences import prefs
from .utils.logger import get_logger
import sys
logger = get_logger(__name__)
module = sys.modules[name]
if not isinstance(module.__version__, str): # mocked module
return
if not Version(module.__version__) >= Version(version):
message = f'{name} is outdated (got version {module.__version__}, need version {version})'
if prefs.core.outdated_dependency_error:
raise ImportError(message)
else:
logger.warn(message, 'outdated_dependency')
def _check_dependency_versions():
for name, version in [('numpy', '1.10'),
('sympy', '1.2'),
('jinja2', '2.7')]:
_check_dependency_version(name, version)
_check_dependency_versions()

I'm not entirely convinced anymore that this is a good idea, so maybe we should simply remove these checks. But it would be good to have a look first how/if other packages are handling this. If we keep this, we should at least make sure that the checked requirements stay in sync with the actual requirements, by reading them in from some canonical source (requirements.txt, pyproject.toml, ...).

@bdevans
Copy link
Contributor

bdevans commented Nov 17, 2022

Yes, I agree that this needs to be read in from another source if you want to keep it but provided the installed packages meet the minimum requirements to install & run Brian, maybe this should just be left to pip or conda to nag users to upgrade? The main reason I can imagine for this scenario (recommending but not requiring an upgrade) would be for better performance, however if it makes that much of a difference, maybe we should just bump the minimum requirements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants