From e9fccc26bcd494e028021be8ccd17fe2dc3d23c2 Mon Sep 17 00:00:00 2001 From: chaoming Date: Thu, 9 Jul 2026 10:38:32 +0800 Subject: [PATCH] refactor: move __version__ and __version_info__ into _version.py Extract the version definitions from brainpy/__init__.py into a dedicated brainpy/_version.py module and re-export them from the package root, so the canonical version string lives in a single small file. pyproject already reads brainpy.__version__ and lists _version.py in its coverage omit lists. --- brainpy/__init__.py | 4 ++-- brainpy/_version.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 brainpy/_version.py diff --git a/brainpy/__init__.py b/brainpy/__init__.py index 93553d47..c586fea9 100644 --- a/brainpy/__init__.py +++ b/brainpy/__init__.py @@ -14,8 +14,8 @@ # limitations under the License. # ============================================================================== -__version__ = "2.8.0" -__version_info__ = tuple(map(int, __version__.split("."))) +from brainpy._version import __version__ as __version__ +from brainpy._version import __version_info__ as __version_info__ from brainpy import _errors as errors # fundamental supporting modules diff --git a/brainpy/_version.py b/brainpy/_version.py new file mode 100644 index 00000000..907e92e9 --- /dev/null +++ b/brainpy/_version.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2025 BrainX Ecosystem Limited. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +__version__ = "2.8.0" +__version_info__ = tuple(map(int, __version__.split(".")))