Skip to content

Commit

Permalink
Sync PyGeNN version to main GeNN version
Browse files Browse the repository at this point in the history
* Read version.txt to provide package version in setup.py
* Query package to provide version at runtime (pygenn.__version__)
  • Loading branch information
neworderofjamie committed Oct 25, 2021
1 parent e9c7942 commit 1d3299d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
12 changes: 11 additions & 1 deletion pygenn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Import pygenn interface
# python imports
import sys

# pygenn interface
from .genn_groups import SynapseGroup, NeuronGroup, CurrentSource
from .genn_model import GeNNModel

if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata

__version__ = metadata.version("pygenn")
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,12 @@
ext_modules.append(Extension("_" + namespace + "Backend", ["pygenn/genn_wrapper/generated/" + namespace + "Backend.i"],
**backend_extension_kwargs))

# Read version from txt file
with open(os.path.join(genn_path, "version.txt")) as version_file:
version = version_file.read().strip()

setup(name = "pygenn",
version = "0.4.6",
version = version,
packages = find_packages(),
package_data={"pygenn": package_data},

Expand All @@ -189,6 +193,7 @@
ext_modules=ext_modules,

# Requirements
install_requires=["numpy>=1.17", "six", "deprecated", "psutil"],
install_requires=["numpy>=1.17", "six", "deprecated", "psutil",
"importlib-metadata>=1.0;python_version<'3.8'"],
zip_safe=False, # Partly for performance reasons
)

0 comments on commit 1d3299d

Please sign in to comment.